コード例 #1
0
		initialize: function(options) {
			Backbone.on('call:rowsAllHeadContainer', this.callRowsAllHeadContainer, this);
			Backbone.on('event:rowsAllHeadContainer:adaptHeight', this.adaptHeight, this);
			this.currentRule = clone.clone(cache.CurrentRule);

			//记录冻结情况下导致视图移动大小
			if (cache.TempProp.isFrozen === true) {
				this.userViewTop = headItemRows.getModelByAlias(cache.UserView.rowAlias).get('top');
				this.offsetTop = this.currentRule.displayPosition.offsetTop;
			} else {
				this.userViewTop = 0;
				this.offsetTop = 0;
			}
			this.listenTo(siderLineRows, 'add', this.addSiderLineRow);
			this.boxAttributes = options.boxAttributes;
		},
コード例 #2
0
		initialize: function(options) {
			this.viewCellsContainer = options.parentView;
			if (this.model.get('selectType') === 'selected') {
				Backbone.on('event:selectRegion:patchOprCell', this.patchOprCell, this);
			}
			Backbone.on('event:selectRegionContainer:adapt', this.adapt, this);
			//添加视图
			this.listenTo(this.model, 'change:tempPosi', this.changePosi);
			this.listenTo(this.model, 'change:physicsBox', this.changeBox);
			this.listenTo(this.model, 'destroy', this.destroy);

			if (options.currentRule !== undefined) {
				this.currentRule = options.currentRule;
			} else {
				this.currentRule = util.clone(cache.CurrentRule);
			}

			this.userViewTop = cache.TempProp.isFrozen ? headItemRows.getModelByAlias(cache.UserView.rowAlias).get('top') : 0;
			this.userViewLeft = cache.TempProp.isFrozen ? headItemCols.getModelByAlias(cache.UserView.colAlias).get('left') : 0;
			this.offsetLeft = cache.TempProp.isFrozen ? (this.currentRule.displayPosition.offsetLeft || 0) : 0;
			this.offsetTop = cache.TempProp.isFrozen ? (this.currentRule.displayPosition.offsetTop || 0) : 0;
		},
コード例 #3
0
ファイル: original.js プロジェクト: iCloudWorkGroup/fengniao
		restoreSelectRegion: function() {
			var headItemRowModel,
				headItemColModel,
				rowAlias,
				colAlias,
				colIndex,
				endRowAlias,
				endColAlias,
				endColIndex,
				endRowIndex,
				startColIndex,
				startRowIndex,
				cellsPositionX,
				cell,
				len, i,
				selectRegionModel;

			rowAlias = cache.UserView.rowAlias;
			colAlias = cache.UserView.colAlias;

			headItemRowModel = headItemRows.getModelByAlias(rowAlias);
			colIndex = headItemCols.getIndexByAlias(colAlias);


			headItemColModel = headItemCols.models[colIndex];

			len = headItemCols.length;
			for (i = colIndex; i < len; i++) {
				if (headItemColModel.get('hidden')) {
					headItemColModel = headItemCols.models[++colIndex];
					colAlias = headItemColModel.get('alias');
				} else {
					break;
				}
			}

			cellsPositionX = cache.CellsPosition.strandX;

			if (cellsPositionX[colAlias] !== undefined &&
				cellsPositionX[colAlias][rowAlias] !== undefined) {
				cell = cells.models[cellsPositionX[colAlias][rowAlias]];
			}
			if (cell !== undefined) {
				endRowAlias = cell.get('occupy').y;
				endRowAlias = endRowAlias[endRowAlias.length - 1];
				endColAlias = cell.get('occupy').x;
				endColAlias = endColAlias[endColAlias.length - 1];

				endColIndex = headItemCols.getIndexByAlias(endColAlias);
				endRowIndex = headItemRows.getIndexByAlias(endRowAlias);
				startColIndex = headItemCols.getIndexByAlias(colAlias);
				startRowIndex = headItemRows.getIndexByAlias(rowAlias);

				selectRegionModel = {
					physicsBox: {
						top: cell.get('physicsBox').top,
						left: cell.get('physicsBox').left,
						width: cell.get('physicsBox').width,
						height: cell.get('physicsBox').height
					},
					wholePosi: {
						startX: colAlias,
						startY: rowAlias,
						endX: endColAlias,
						endY: endRowAlias
					}
				};
				selectRegions.add(selectRegionModel);
				siderLineCols.add({
					left: cell.get('physicsBox').left,
					width: cell.get('physicsBox').width
				});
				siderLineRows.add({
					top: cell.get('physicsBox').top,
					height: cell.get('physicsBox').height
				});


				len = headItemRows.length;

				for (i = 0; i < len; i++) {
					headItemRows.models[i].set({
						activeState: false
					});
				}

				len = headItemCols.length;
				for (i = 0; i < len; i++) {
					headItemCols.models[i].set({
						activeState: false
					});
				}
				for (i = 0; i < endColIndex - startColIndex + 1; i++) {
					headItemCols.models[startColIndex + i].set({
						activeState: true
					});
				}
				for (i = 0; i < endRowIndex - startRowIndex + 1; i++) {
					headItemRows.models[startRowIndex + i].set({
						activeState: true
					});
				}
			} else {
				selectRegionModel = {
					physicsBox: {
						width: headItemColModel.get('width'),
						height: headItemRowModel.get('height'),
						top: headItemRowModel.get('top'),
						left: headItemColModel.get('left')
					},
					wholePosi: {
						startX: colAlias,
						startY: rowAlias,
						endX: colAlias,
						endY: rowAlias
					}
				};
				selectRegions.add(selectRegionModel);
				siderLineCols.add({
					left: headItemColModel.get('left'),
					width: headItemColModel.get('width')
				});
				siderLineRows.add({
					top: headItemRowModel.get('top'),
					height: headItemRowModel.get('height')
				});
			}

		},