[Libreoffice-commits] online.git: loleaflet/src

Henry Castro hcastro at collabora.com
Mon Nov 9 18:03:03 PST 2015


 loleaflet/src/control/Control.ColumnHeader.js |   13 +++++++++++--
 loleaflet/src/control/Control.RowHeader.js    |   12 ++++++++++--
 loleaflet/src/control/Control.Scroll.js       |    3 +--
 loleaflet/src/layer/tile/CalcTileLayer.js     |   14 ++++++++++----
 4 files changed, 32 insertions(+), 10 deletions(-)

New commits:
commit 75ad86bee187cddc05e7e8b7c46d670ddcdac9c9
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon Nov 9 22:00:09 2015 -0400

    loleaflet: fix row/column, scroll issues

diff --git a/loleaflet/src/control/Control.ColumnHeader.js b/loleaflet/src/control/Control.ColumnHeader.js
index 7280bc2..7c3934c 100644
--- a/loleaflet/src/control/Control.ColumnHeader.js
+++ b/loleaflet/src/control/Control.ColumnHeader.js
@@ -17,6 +17,8 @@ L.Control.ColumnHeader = L.Control.extend({
                 L.DomUtil.create('tbody', '', this._table);
                 this._columns = L.DomUtil.create('tr','', this._table.firstChild);
 
+                this._position = 0;
+
                 // dummy initial header
                 L.DomUtil.create('th','spreadsheet-table-column-cell', this._columns);
 
@@ -28,8 +30,15 @@ L.Control.ColumnHeader = L.Control.extend({
                 this._columns = L.DomUtil.create('tr', '', this._table.firstChild);
         },
 
-        offsetColumn: function (point) {
-                L.DomUtil.setStyle(this._table, 'left', point + 'px');
+
+        setScrollPosition: function (position) {
+                this._position = position;
+                L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
+        },
+
+        offsetScrollPosition: function (offset) {
+                this._position = this._position - offset;
+                L.DomUtil.setStyle(this._table, 'left', this._position + 'px');
         },
 
         fillColumns: function (columns, converter, context) {
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index 141527f..02625ae 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -11,6 +11,8 @@ L.Control.RowHeader = L.Control.extend({
                 this._table.id = 'spreadsheet-table-row';
                 this._rows = L.DomUtil.create('tbody', '', this._table);
 
+                this._position = 0;
+
                 // dummy initial row header
                 var row = L.DomUtil.create('tr', '', this._rows);
                 L.DomUtil.create('th','spreadsheet-table-row-cell', row);
@@ -23,8 +25,14 @@ L.Control.RowHeader = L.Control.extend({
                 this._rows = L.DomUtil.create('tbody', '', this._table);
         },
 
-        offsetRow: function (value) {
-                L.DomUtil.setStyle(this._table, 'top', value + 'px');
+        setScrollPosition: function (position) {
+                this._position = position;
+                L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
+        },
+
+        offsetScrollPosition: function (offset) {
+                this._position = this._position - offset;
+                L.DomUtil.setStyle(this._table, 'top', this._position + 'px');
         },
 
         fillRows: function (rows, converter, context) {
diff --git a/loleaflet/src/control/Control.Scroll.js b/loleaflet/src/control/Control.Scroll.js
index f9813a4..bb7c194 100644
--- a/loleaflet/src/control/Control.Scroll.js
+++ b/loleaflet/src/control/Control.Scroll.js
@@ -55,14 +55,13 @@ L.Control.Scroll = L.Control.extend({
 			this._prevScrollY = -e.mcs.top;
 			this._prevScrollX = -e.mcs.left;
 			this._map.scroll(offset.x, offset.y);
+                        this._map.fire('scrolloffset', offset);
 		}
-                this._map.fire('scroll', e.mcs);
 	},
 
 	_onScrollEnd: function (e) {
 		this._prevScrollY = -e.mcs.top;
 		this._prevScrollX = -e.mcs.left;
-                this._map.fire('scroll', e.mcs);
 	},
 
 	_onScrollTo: function (e) {
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index d1f5a42..c81eaed 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -11,7 +11,8 @@ L.CalcTileLayer = L.TileLayer.extend({
                 map.addControl(this._columns);
                 map.addControl(this._rows);
                 map.addControl(L.control.tabs());
-                map.on('scroll', this._onScroll, this);
+                map.on('scrolloffset', this._onScrollOffset, this);
+                map.on('updatescrolloffset', this._onUpdateScrollOffset, this);
                 map.on('zoomend', this._onZoomRowColumns, this);
         },
 
@@ -111,9 +112,14 @@ L.CalcTileLayer = L.TileLayer.extend({
 		}
 	},
 
-        _onScroll: function(point) {
-                this._columns.offsetColumn(point.left);
-                this._rows.offsetRow(point.top);
+        _onScrollOffset: function(offset) {
+                this._columns.offsetScrollPosition(offset.x);
+                this._rows.offsetScrollPosition(offset.y);
+        },
+
+        _onUpdateScrollOffset: function (e) {
+                this._columns.setScrollPosition(-e.x);
+                this._rows.setScrollPosition(-e.y);
         },
 
         _onZoomRowColumns: function () {


More information about the Libreoffice-commits mailing list