loleaflet/debug/document/document_simple_example.html | 20 +++++++++--------- loleaflet/src/control/Scroll.js | 3 ++ loleaflet/src/layer/tile/TileLayer.js | 5 ++++ 3 files changed, 18 insertions(+), 10 deletions(-)
New commits: commit 35a1ac1d8616610d923f0cf943f6e1248f481831 Author: Mihai Varga <mihai.va...@collabora.com> Date: Thu Aug 6 16:53:43 2015 +0300 loleaflet: rename the global map variable to avoid referencing it To avoid mistakes like writing 'map.fire' instead of 'this._map.fire' diff --git a/loleaflet/debug/document/document_simple_example.html b/loleaflet/debug/document/document_simple_example.html index eae6cdf..5a75be0 100644 --- a/loleaflet/debug/document/document_simple_example.html +++ b/loleaflet/debug/document/document_simple_example.html @@ -57,7 +57,7 @@ vex.dialog.alert('Wrong host, usage: host=ws://localhost:9980'); } - var map = L.map('map', { + var globalMap = L.map('map', { center: [0, 0], zoom: 10, minZoom: 1, @@ -67,14 +67,14 @@ }); ////// Controls ///// - map.addControl(L.control.buttons()); - map.addControl(L.control.zoom()); - map.addControl(L.control.parts()); - map.addControl(L.control.search()); - map.addControl(L.control.permissionSwitch()); - map.addControl(L.control.selection()); - map.addControl(L.control.statusIndicator()); - map.addControl(L.control.scroll()); + globalMap.addControl(L.control.buttons()); + globalMap.addControl(L.control.zoom()); + globalMap.addControl(L.control.parts()); + globalMap.addControl(L.control.search()); + globalMap.addControl(L.control.permissionSwitch()); + globalMap.addControl(L.control.selection()); + globalMap.addControl(L.control.statusIndicator()); + globalMap.addControl(L.control.scroll()); ////// Document layer //// var docLayer = new L.TileLayer('', { @@ -84,6 +84,6 @@ timestamp: timestamp, readOnly: false }); - map.addLayer(docLayer); + globalMap.addLayer(docLayer); </script> </body></html> commit 6a7d33cdb5b414c1ca03a8e33fee86cbcaa04252 Author: Mihai Varga <mihai.va...@collabora.com> Date: Thu Aug 6 16:48:41 2015 +0300 loleaflet: update scroll offset after dragging The scroll offset is updated on the 'moveend' event which occurs after the document has been released. But we don't want to update the scroll offset when scrolling diff --git a/loleaflet/src/control/Scroll.js b/loleaflet/src/control/Scroll.js index e20b3e1..fab91bf 100644 --- a/loleaflet/src/control/Scroll.js +++ b/loleaflet/src/control/Scroll.js @@ -6,6 +6,7 @@ L.Map.include({ if (typeof (x) !== 'number' || typeof (y) !== 'number') { return; } + this.off('moveend', this._docLayer._updateScrollOffset, this._docLayer); this.panBy(new L.Point(x, y), {animate: false}); }, @@ -28,11 +29,13 @@ L.Map.include({ scrollTop: function (y) { var offset = this.scrollOffset(); + this.off('moveend', this._docLayer._updateScrollOffset, this._docLayer); this.panBy(new L.Point(0, y - offset.y), {animate: false}); }, scrollLeft: function (x) { var offset = this.scrollOffset(); + this.off('moveend', this._docLayer._updateScrollOffset, this._docLayer); this.panBy(new L.Point(x - offset.x, 0), {animate: false}); } }); diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 1675a07..56f0004 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -110,6 +110,7 @@ L.TileLayer = L.GridLayer.extend({ this._map.on('clearselection', this._clearSelections, this); this._map.on('copy', this._onCopy, this); this._map.on('zoomend', this._onUpdateCursor, this); + this._map.on('dragstart', this._onDragStart, this); this._startMarker.on('drag dragend', this._onSelectionHandleDrag, this); this._endMarker.on('drag dragend', this._onSelectionHandleDrag, this); this._textArea = this._map._textArea; @@ -734,6 +735,10 @@ L.TileLayer = L.GridLayer.extend({ else { e.clipboardData.setData('text/plain', this._selectionTextContent); } + }, + + _onDragStart: function () { + this._map.on('moveend', this._updateScrollOffset, this); } }); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits