From f638558b0727cb72dfeb0b580743990af0a70c72 Mon Sep 17 00:00:00 2001 From: guy <141592Wc> Date: Sat, 13 May 2017 13:41:03 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E5=8A=A0=E5=85=A5=E6=A8=AA?= =?UTF-8?q?=E5=90=91=E6=BB=9A=E5=8A=A8=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 139 +++++++++++++++++++---- docs/base.js | 139 +++++++++++++++++++---- src/base/table/table.collection.quick.js | 71 ++++++++++-- src/base/table/table.grid.quick.js | 68 +++++++++-- 4 files changed, 348 insertions(+), 69 deletions(-) diff --git a/bi/base.js b/bi/base.js index 8c75b6e8e..39be28e36 100644 --- a/bi/base.js +++ b/bi/base.js @@ -29036,26 +29036,54 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { mounted: function () { BI.QuickCollectionTable.superclass.mounted.apply(this, arguments); var self = this; - this._leftWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); - this._rightWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); + this._bottomRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this.topLeftCollection.element.mousewheel(function (e) { + self._topLeftWheelHandler.onWheel(e.originalEvent); + }); + this.topRightCollection.element.mousewheel(function (e) { + self._topRightWheelHandler.onWheel(e.originalEvent); + }); this.bottomLeftCollection.element.mousewheel(function (e) { - self._leftWheelHandler.onWheel(e.originalEvent); + self._bottomLeftWheelHandler.onWheel(e.originalEvent); }); this.bottomRightCollection.element.mousewheel(function (e) { - self._rightWheelHandler.onWheel(e.originalEvent); + self._bottomRightWheelHandler.onWheel(e.originalEvent); }); }, - _shouldHandleX: function (delta) { - return false; + _shouldHandleLeftX: function (delta) { + if (delta > 0) { + return this.bottomLeftCollection.getScrollLeft() < this.bottomLeftCollection.getMaxScrollLeft(); + } else { + return this.bottomLeftCollection.getScrollLeft() > 0; + } + }, + + _shouldHandleRightX: function (delta) { + if (delta > 0) { + return this.bottomRightCollection.getScrollLeft() < this.bottomRightCollection.getMaxScrollLeft(); + } else { + return this.bottomRightCollection.getScrollLeft() > 0; + } }, _shouldHandleY: function (delta) { @@ -29066,19 +29094,38 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { } }, - _onWheelY: function (deltaX, deltaY) { + _onWheelLeft: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomLeftCollection.getScrollTop(); + var scrollLeft = this.bottomLeftCollection.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftCollection.setScrollTop(scrollTop); + this.bottomRightCollection.setScrollTop(scrollTop); + this.topLeftCollection.setScrollLeft(scrollLeft); + this.bottomLeftCollection.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _onWheelRight: function (deltaX, deltaY) { var self = this; var scrollTop = this.bottomRightCollection.getScrollTop(); + var scrollLeft = this.bottomRightCollection.getScrollLeft(); scrollTop += deltaY; + scrollLeft += deltaX; this.bottomLeftCollection.setScrollTop(scrollTop); this.bottomRightCollection.setScrollTop(scrollTop); + this.topRightCollection.setScrollLeft(scrollLeft); + this.bottomRightCollection.setScrollLeft(scrollLeft); self._populateScrollbar(); this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); }, _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { @@ -29691,26 +29738,54 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { mounted: function () { BI.QuickGridTable.superclass.mounted.apply(this, arguments); var self = this; - this._leftWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); - this._rightWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); + this._bottomRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this.topLeftGrid.element.mousewheel(function (e) { + self._topLeftWheelHandler.onWheel(e.originalEvent); + }); + this.topRightGrid.element.mousewheel(function (e) { + self._topRightWheelHandler.onWheel(e.originalEvent); + }); this.bottomLeftGrid.element.mousewheel(function (e) { - self._leftWheelHandler.onWheel(e.originalEvent); + self._bottomLeftWheelHandler.onWheel(e.originalEvent); }); this.bottomRightGrid.element.mousewheel(function (e) { - self._rightWheelHandler.onWheel(e.originalEvent); + self._bottomRightWheelHandler.onWheel(e.originalEvent); }); }, - _shouldHandleX: function (delta) { - return false; + _shouldHandleLeftX: function (delta) { + if (delta > 0) { + return this.bottomLeftGrid.getScrollLeft() < this.bottomLeftGrid.getMaxScrollLeft(); + } else { + return this.bottomLeftGrid.getScrollLeft() > 0; + } + }, + + _shouldHandleRightX: function (delta) { + if (delta > 0) { + return this.bottomRightGrid.getScrollLeft() < this.bottomRightGrid.getMaxScrollLeft(); + } else { + return this.bottomRightGrid.getScrollLeft() > 0; + } }, _shouldHandleY: function (delta) { @@ -29721,12 +29796,30 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { } }, - _onWheelY: function (deltaX, deltaY) { + _onWheelLeft: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomLeftGrid.getScrollTop(); + var scrollLeft = this.bottomLeftGrid.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftGrid.setScrollTop(scrollTop); + this.bottomRightGrid.setScrollTop(scrollTop); + this.topLeftGrid.setScrollLeft(scrollLeft); + this.bottomLeftGrid.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _onWheelRight: function (deltaX, deltaY) { var self = this; var scrollTop = this.bottomRightGrid.getScrollTop(); + var scrollLeft = this.bottomRightGrid.getScrollLeft(); scrollTop += deltaY; + scrollLeft += deltaX; this.bottomLeftGrid.setScrollTop(scrollTop); this.bottomRightGrid.setScrollTop(scrollTop); + this.topRightGrid.setScrollLeft(scrollLeft); + this.bottomRightGrid.setScrollLeft(scrollLeft); self._populateScrollbar(); this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); }, diff --git a/docs/base.js b/docs/base.js index 8c75b6e8e..39be28e36 100644 --- a/docs/base.js +++ b/docs/base.js @@ -29036,26 +29036,54 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { mounted: function () { BI.QuickCollectionTable.superclass.mounted.apply(this, arguments); var self = this; - this._leftWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); - this._rightWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); + this._bottomRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this.topLeftCollection.element.mousewheel(function (e) { + self._topLeftWheelHandler.onWheel(e.originalEvent); + }); + this.topRightCollection.element.mousewheel(function (e) { + self._topRightWheelHandler.onWheel(e.originalEvent); + }); this.bottomLeftCollection.element.mousewheel(function (e) { - self._leftWheelHandler.onWheel(e.originalEvent); + self._bottomLeftWheelHandler.onWheel(e.originalEvent); }); this.bottomRightCollection.element.mousewheel(function (e) { - self._rightWheelHandler.onWheel(e.originalEvent); + self._bottomRightWheelHandler.onWheel(e.originalEvent); }); }, - _shouldHandleX: function (delta) { - return false; + _shouldHandleLeftX: function (delta) { + if (delta > 0) { + return this.bottomLeftCollection.getScrollLeft() < this.bottomLeftCollection.getMaxScrollLeft(); + } else { + return this.bottomLeftCollection.getScrollLeft() > 0; + } + }, + + _shouldHandleRightX: function (delta) { + if (delta > 0) { + return this.bottomRightCollection.getScrollLeft() < this.bottomRightCollection.getMaxScrollLeft(); + } else { + return this.bottomRightCollection.getScrollLeft() > 0; + } }, _shouldHandleY: function (delta) { @@ -29066,19 +29094,38 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { } }, - _onWheelY: function (deltaX, deltaY) { + _onWheelLeft: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomLeftCollection.getScrollTop(); + var scrollLeft = this.bottomLeftCollection.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftCollection.setScrollTop(scrollTop); + this.bottomRightCollection.setScrollTop(scrollTop); + this.topLeftCollection.setScrollLeft(scrollLeft); + this.bottomLeftCollection.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _onWheelRight: function (deltaX, deltaY) { var self = this; var scrollTop = this.bottomRightCollection.getScrollTop(); + var scrollLeft = this.bottomRightCollection.getScrollLeft(); scrollTop += deltaY; + scrollLeft += deltaX; this.bottomLeftCollection.setScrollTop(scrollTop); this.bottomRightCollection.setScrollTop(scrollTop); + this.topRightCollection.setScrollLeft(scrollLeft); + this.bottomRightCollection.setScrollLeft(scrollLeft); self._populateScrollbar(); this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); }, _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { @@ -29691,26 +29738,54 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { mounted: function () { BI.QuickGridTable.superclass.mounted.apply(this, arguments); var self = this; - this._leftWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); - this._rightWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); + this._bottomRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this.topLeftGrid.element.mousewheel(function (e) { + self._topLeftWheelHandler.onWheel(e.originalEvent); + }); + this.topRightGrid.element.mousewheel(function (e) { + self._topRightWheelHandler.onWheel(e.originalEvent); + }); this.bottomLeftGrid.element.mousewheel(function (e) { - self._leftWheelHandler.onWheel(e.originalEvent); + self._bottomLeftWheelHandler.onWheel(e.originalEvent); }); this.bottomRightGrid.element.mousewheel(function (e) { - self._rightWheelHandler.onWheel(e.originalEvent); + self._bottomRightWheelHandler.onWheel(e.originalEvent); }); }, - _shouldHandleX: function (delta) { - return false; + _shouldHandleLeftX: function (delta) { + if (delta > 0) { + return this.bottomLeftGrid.getScrollLeft() < this.bottomLeftGrid.getMaxScrollLeft(); + } else { + return this.bottomLeftGrid.getScrollLeft() > 0; + } + }, + + _shouldHandleRightX: function (delta) { + if (delta > 0) { + return this.bottomRightGrid.getScrollLeft() < this.bottomRightGrid.getMaxScrollLeft(); + } else { + return this.bottomRightGrid.getScrollLeft() > 0; + } }, _shouldHandleY: function (delta) { @@ -29721,12 +29796,30 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { } }, - _onWheelY: function (deltaX, deltaY) { + _onWheelLeft: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomLeftGrid.getScrollTop(); + var scrollLeft = this.bottomLeftGrid.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftGrid.setScrollTop(scrollTop); + this.bottomRightGrid.setScrollTop(scrollTop); + this.topLeftGrid.setScrollLeft(scrollLeft); + this.bottomLeftGrid.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _onWheelRight: function (deltaX, deltaY) { var self = this; var scrollTop = this.bottomRightGrid.getScrollTop(); + var scrollLeft = this.bottomRightGrid.getScrollLeft(); scrollTop += deltaY; + scrollLeft += deltaX; this.bottomLeftGrid.setScrollTop(scrollTop); this.bottomRightGrid.setScrollTop(scrollTop); + this.topRightGrid.setScrollLeft(scrollLeft); + this.bottomRightGrid.setScrollLeft(scrollLeft); self._populateScrollbar(); this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); }, diff --git a/src/base/table/table.collection.quick.js b/src/base/table/table.collection.quick.js index ab1cd926f..1e9565860 100644 --- a/src/base/table/table.collection.quick.js +++ b/src/base/table/table.collection.quick.js @@ -28,26 +28,54 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { mounted: function () { BI.QuickCollectionTable.superclass.mounted.apply(this, arguments); var self = this; - this._leftWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); - this._rightWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), BI.bind(this._shouldHandleY, this) ); + this._bottomLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this.topLeftCollection.element.mousewheel(function (e) { + self._topLeftWheelHandler.onWheel(e.originalEvent); + }); + this.topRightCollection.element.mousewheel(function (e) { + self._topRightWheelHandler.onWheel(e.originalEvent); + }); this.bottomLeftCollection.element.mousewheel(function (e) { - self._leftWheelHandler.onWheel(e.originalEvent); + self._bottomLeftWheelHandler.onWheel(e.originalEvent); }); this.bottomRightCollection.element.mousewheel(function (e) { - self._rightWheelHandler.onWheel(e.originalEvent); + self._bottomRightWheelHandler.onWheel(e.originalEvent); }); }, - _shouldHandleX: function (delta) { - return false; + _shouldHandleLeftX: function (delta) { + if (delta > 0) { + return this.bottomLeftCollection.getScrollLeft() < this.bottomLeftCollection.getMaxScrollLeft(); + } else { + return this.bottomLeftCollection.getScrollLeft() > 0; + } + }, + + _shouldHandleRightX: function (delta) { + if (delta > 0) { + return this.bottomRightCollection.getScrollLeft() < this.bottomRightCollection.getMaxScrollLeft(); + } else { + return this.bottomRightCollection.getScrollLeft() > 0; + } }, _shouldHandleY: function (delta) { @@ -58,19 +86,38 @@ BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { } }, - _onWheelY: function (deltaX, deltaY) { + _onWheelLeft: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomLeftCollection.getScrollTop(); + var scrollLeft = this.bottomLeftCollection.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftCollection.setScrollTop(scrollTop); + this.bottomRightCollection.setScrollTop(scrollTop); + this.topLeftCollection.setScrollLeft(scrollLeft); + this.bottomLeftCollection.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _onWheelRight: function (deltaX, deltaY) { var self = this; var scrollTop = this.bottomRightCollection.getScrollTop(); + var scrollLeft = this.bottomRightCollection.getScrollLeft(); scrollTop += deltaY; + scrollLeft += deltaX; this.bottomLeftCollection.setScrollTop(scrollTop); this.bottomRightCollection.setScrollTop(scrollTop); + this.topRightCollection.setScrollLeft(scrollLeft); + this.bottomRightCollection.setScrollLeft(scrollLeft); self._populateScrollbar(); this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); }, _populateTable: function () { var self = this, o = this.options; - var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [], totalRowSize = o.items.length * o.rowSize; var freezeColLength = this._getFreezeColLength(); BI.each(o.columnSize, function (i, size) { if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { diff --git a/src/base/table/table.grid.quick.js b/src/base/table/table.grid.quick.js index 62e4a4a7e..8bd73149d 100644 --- a/src/base/table/table.grid.quick.js +++ b/src/base/table/table.grid.quick.js @@ -28,26 +28,54 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { mounted: function () { BI.QuickGridTable.superclass.mounted.apply(this, arguments); var self = this; - this._leftWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), BI.bind(this._shouldHandleY, this) ); - this._rightWheelHandler = new BI.WheelHandler( - BI.bind(this._onWheelY, this), - BI.bind(this._shouldHandleX, this), + this._topRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), BI.bind(this._shouldHandleY, this) ); + this._bottomLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this.topLeftGrid.element.mousewheel(function (e) { + self._topLeftWheelHandler.onWheel(e.originalEvent); + }); + this.topRightGrid.element.mousewheel(function (e) { + self._topRightWheelHandler.onWheel(e.originalEvent); + }); this.bottomLeftGrid.element.mousewheel(function (e) { - self._leftWheelHandler.onWheel(e.originalEvent); + self._bottomLeftWheelHandler.onWheel(e.originalEvent); }); this.bottomRightGrid.element.mousewheel(function (e) { - self._rightWheelHandler.onWheel(e.originalEvent); + self._bottomRightWheelHandler.onWheel(e.originalEvent); }); }, - _shouldHandleX: function (delta) { - return false; + _shouldHandleLeftX: function (delta) { + if (delta > 0) { + return this.bottomLeftGrid.getScrollLeft() < this.bottomLeftGrid.getMaxScrollLeft(); + } else { + return this.bottomLeftGrid.getScrollLeft() > 0; + } + }, + + _shouldHandleRightX: function (delta) { + if (delta > 0) { + return this.bottomRightGrid.getScrollLeft() < this.bottomRightGrid.getMaxScrollLeft(); + } else { + return this.bottomRightGrid.getScrollLeft() > 0; + } }, _shouldHandleY: function (delta) { @@ -58,12 +86,30 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, { } }, - _onWheelY: function (deltaX, deltaY) { + _onWheelLeft: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomLeftGrid.getScrollTop(); + var scrollLeft = this.bottomLeftGrid.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftGrid.setScrollTop(scrollTop); + this.bottomRightGrid.setScrollTop(scrollTop); + this.topLeftGrid.setScrollLeft(scrollLeft); + this.bottomLeftGrid.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _onWheelRight: function (deltaX, deltaY) { var self = this; var scrollTop = this.bottomRightGrid.getScrollTop(); + var scrollLeft = this.bottomRightGrid.getScrollLeft(); scrollTop += deltaY; + scrollLeft += deltaX; this.bottomLeftGrid.setScrollTop(scrollTop); this.bottomRightGrid.setScrollTop(scrollTop); + this.topRightGrid.setScrollLeft(scrollLeft); + this.bottomRightGrid.setScrollLeft(scrollLeft); self._populateScrollbar(); this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); },