From 14e76fa86124fc9de1b5751a78079bc927f35979 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 13 Sep 2021 20:19:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=A7=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/collection/collection.js | 33 +++++++++++++++-------------- src/base/grid/grid.js | 35 ++++++++++++++++--------------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index 3cb3b6721..2634edfac 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -161,20 +161,20 @@ BI.CollectionView = BI.inherit(BI.Widget, { var index = this.renderedKeys[datum.index] && this.renderedKeys[datum.index][1]; var child; if (index >= 0) { - if (datum.width !== this.renderedCells[index]._width) { - this.renderedCells[index]._width = datum.width; - this.renderedCells[index].el.setWidth(datum.width); - } - if (datum.height !== this.renderedCells[index]._height) { - this.renderedCells[index]._height = datum.height; - this.renderedCells[index].el.setHeight(datum.height); - } - if (this.renderedCells[index]._left !== datum.x) { - this.renderedCells[index].el.element.css("left", datum.x / BI.pixRatio + BI.pixUnit); - } - if (this.renderedCells[index]._top !== datum.y) { - this.renderedCells[index].el.element.css("top", datum.y / BI.pixRatio + BI.pixUnit); - } + // if (datum.width !== this.renderedCells[index]._width) { + // this.renderedCells[index]._width = datum.width; + this.renderedCells[index].el.setWidth(datum.width); + // } + // if (datum.height !== this.renderedCells[index]._height) { + // this.renderedCells[index]._height = datum.height; + this.renderedCells[index].el.setHeight(datum.height); + // } + // if (this.renderedCells[index]._left !== datum.x) { + this.renderedCells[index].el.element.css("left", datum.x / BI.pixRatio + BI.pixUnit); + // } + // if (this.renderedCells[index]._top !== datum.y) { + this.renderedCells[index].el.element.css("top", datum.y / BI.pixRatio + BI.pixUnit); + // } renderedCells.push(child = this.renderedCells[index]); } else { child = BI._lazyCreateWidget(BI.extend({ @@ -192,8 +192,8 @@ BI.CollectionView = BI.inherit(BI.Widget, { top: datum.y, _left: datum.x, _top: datum.y, - _width: datum.width, - _height: datum.height + // _width: datum.width, + // _height: datum.height }); } var startTopIndex = topMap[datum.y] | 0; @@ -281,6 +281,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { this.container.setWidth(this._width); this.container.setHeight(this._height); + this._debounceRelease(); this._calculateChildrenToRender(); // 元素未挂载时不能设置scrollTop try { diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index b0a331a7f..ea6601585 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -137,20 +137,20 @@ BI.GridView = BI.inherit(BI.Widget, { var index = this.renderedKeys[key] && this.renderedKeys[key][2]; var child; if (index >= 0) { - if (columnDatum.size !== this.renderedCells[index]._width) { - this.renderedCells[index]._width = columnDatum.size; - this.renderedCells[index].el.setWidth(columnDatum.size); - } - if (rowDatum.size !== this.renderedCells[index]._height) { - this.renderedCells[index]._height = rowDatum.size; - this.renderedCells[index].el.setHeight(rowDatum.size); - } - if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) { - this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) / BI.pixRatio + BI.pixUnit); - } - if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) { - this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) / BI.pixRatio + BI.pixUnit); - } + // if (columnDatum.size !== this.renderedCells[index]._width) { + // this.renderedCells[index]._width = columnDatum.size; + this.renderedCells[index].el.setWidth(columnDatum.size); + // } + // if (rowDatum.size !== this.renderedCells[index]._height) { + // this.renderedCells[index]._height = rowDatum.size; + this.renderedCells[index].el.setHeight(rowDatum.size); + // } + // if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) { + this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) / BI.pixRatio + BI.pixUnit); + // } + // if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) { + this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) / BI.pixRatio + BI.pixUnit); + // } child = this.renderedCells[index].el; renderedCells.push(this.renderedCells[index]); } else { @@ -171,8 +171,8 @@ BI.GridView = BI.inherit(BI.Widget, { top: rowDatum.offset + verticalOffsetAdjustment, _left: columnDatum.offset + horizontalOffsetAdjustment, _top: rowDatum.offset + verticalOffsetAdjustment, - _width: columnDatum.size, - _height: rowDatum.size + // _width: columnDatum.size, + // _height: rowDatum.size }); } minX = Math.min(minX, columnDatum.offset + horizontalOffsetAdjustment); @@ -224,7 +224,7 @@ BI.GridView = BI.inherit(BI.Widget, { /** * 获取真实的可滚动的最大宽度 * 对于grid_view如果没有全部渲染过,this._columnSizeAndPositionManager.getTotalSize获取的宽度是不准确的 - * 因此在调用setScrollLeft等函数时会造成没法移动到最右端(预估可移动具体太短) + * 因此在调用setScrollLeft等函数时会造成没法移动到最右端(预估可移动距离太短) */ _getRealMaxScrollLeft: function () { var o = this.options; @@ -267,6 +267,7 @@ BI.GridView = BI.inherit(BI.Widget, { this._columnSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.columnCount, o.columnWidthGetter, o.estimatedColumnSize); this._rowSizeAndPositionManager = new BI.ScalingCellSizeAndPositionManager(this.rowCount, o.rowHeightGetter, o.estimatedRowSize); + this._debounceRelease(); this._calculateChildrenToRender(); // 元素未挂载时不能设置scrollTop try {