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

Mihai Varga mihai.varga at collabora.com
Tue Sep 29 03:22:35 PDT 2015


 loleaflet/src/dom/Draggable.js        |   12 ++++++++++++
 loleaflet/src/map/handler/Map.Drag.js |    1 +
 2 files changed, 13 insertions(+)

New commits:
commit 0ee3c64dd860ba26f7d7587b1a5726f7fcaa092f
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Tue Sep 29 13:12:30 2015 +0300

    loleaflet: don't pan horiz/vertic when doc fits viewing area

diff --git a/loleaflet/src/dom/Draggable.js b/loleaflet/src/dom/Draggable.js
index 2263074..3df1342 100644
--- a/loleaflet/src/dom/Draggable.js
+++ b/loleaflet/src/dom/Draggable.js
@@ -83,6 +83,18 @@ L.Draggable = L.Evented.extend({
 		    newPoint = new L.Point(first.clientX, first.clientY),
 		    offset = newPoint.subtract(this._startPoint);
 
+		if (this._map) {
+			if (this._map.getDocSize().x < this._map.getSize().x) {
+				// don't pan horizontaly when the document fits in the viewing
+				// area horizontally (docWidth < viewAreaWidth)
+				offset.x = 0;
+			}
+			if (this._map.getDocSize().y < this._map.getSize().y) {
+				// don't pan vertically when the document fits in the viewing
+				// area horizontally (docHeight < viewAreaHeight)
+				offset.y = 0;
+			}
+		}
 		if (!offset.x && !offset.y) { return; }
 		if (L.Browser.touch && Math.abs(offset.x) + Math.abs(offset.y) < 3) { return; }
 
diff --git a/loleaflet/src/map/handler/Map.Drag.js b/loleaflet/src/map/handler/Map.Drag.js
index 62ec332..10b3b4a 100644
--- a/loleaflet/src/map/handler/Map.Drag.js
+++ b/loleaflet/src/map/handler/Map.Drag.js
@@ -20,6 +20,7 @@ L.Map.Drag = L.Handler.extend({
 			var map = this._map;
 
 			this._draggable = new L.Draggable(map._mapPane, map._container);
+			this._draggable._map = map;
 
 			this._draggable.on({
 				down: this._onDown,


More information about the Libreoffice-commits mailing list