loleaflet/src/map/handler/Map.Scroll.js |   30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

New commits:
commit a3c1a685cd4107f229b97619bcce9a3646fc7730
Author: dewana-dewan <iit2015...@iiita.ac.in>
Date:   Thu Mar 16 23:08:27 2017 +0530

    implemented zooming with Ctrl-<mousewheel>
    
    Change-Id: I27e53715719fd84b3e22940cc5688e87ae1f0805
    Reviewed-on: https://gerrit.libreoffice.org/35288
    Reviewed-by: pranavk <pran...@collabora.co.uk>
    Tested-by: pranavk <pran...@collabora.co.uk>

diff --git a/loleaflet/src/map/handler/Map.Scroll.js 
b/loleaflet/src/map/handler/Map.Scroll.js
index f7a98f3c..593e1dfb 100644
--- a/loleaflet/src/map/handler/Map.Scroll.js
+++ b/loleaflet/src/map/handler/Map.Scroll.js
@@ -38,7 +38,12 @@ L.Map.Scroll = L.Handler.extend({
                var left = Math.max(debounce - (+new Date() - this._startTime), 
0);
 
                clearTimeout(this._timer);
-               this._timer = setTimeout(L.bind(this._performScroll, this), 
left);
+               if (e.ctrlKey) {
+                       this._timer = setTimeout(L.bind(this._performZoom, 
this), left);
+               }
+               else {
+                       this._timer = setTimeout(L.bind(this._performScroll, 
this), left);
+               }
 
                L.DomEvent.stop(e);
        },
@@ -53,6 +58,29 @@ L.Map.Scroll = L.Handler.extend({
 
                if (!delta) { return; }
                map.fire('scrollby', {x: 0, y: delta * scrollAmount});
+       },
+
+       _performZoom: function () {
+               var map = this._map,
+                   delta = this._delta,
+                   zoom = map.getZoom();
+
+               map.stop(); // stop panning and fly animations if any
+
+               delta = delta > 0 ? Math.ceil(delta) : Math.floor(delta);
+               delta = Math.max(Math.min(delta, 4), -4);
+               delta = map._limitZoom(zoom + delta) - zoom;
+
+               this._delta = 0;
+               this._startTime = null;
+
+               if (!delta) { return; }
+
+               if (map.options.scrollWheelZoom === 'center') {
+                       map.setZoom(zoom + delta);
+               } else {
+                       map.setZoomAround(this._lastMousePos, zoom + delta);
+               }
        }
 });
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to