loleaflet/src/layer/tile/TileLayer.js |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 1714df5f9e832ea921f621f2a775b3c348ba671d
Author: Mihai Varga <mihai.va...@collabora.com>
Date:   Mon Jun 29 19:02:58 2015 +0300

    Scroll to cursor position if it's out of the viewing area

diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 0c31520..fbe61f6 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -862,7 +862,8 @@ L.TileLayer = L.GridLayer.extend({
                        var pixBounds = 
L.bounds(this._map.latLngToLayerPoint(this._visibleCursor.getSouthWest()),
                                                 
this._map.latLngToLayerPoint(this._visibleCursor.getNorthEast()));
 
-                       this._cursorMarker = 
L.cursor(this._visibleCursor.getNorthWest());
+                       var cursorPos = this._visibleCursor.getNorthWest();
+                       this._cursorMarker = L.cursor(cursorPos);
                        this._map.addLayer(this._cursorMarker);
                        this._cursorMarker.setSize(pixBounds.getSize());
 
@@ -875,6 +876,13 @@ L.TileLayer = L.GridLayer.extend({
                                
this._endMarker.setLatLng(this._startMarker.getLatLng());
                                this._startMarker.setLatLng(swap);
                        }
+                       if (!this._map.getBounds().contains(cursorPos)) {
+                               var center = this._map.project(cursorPos);
+                               center = 
center.subtract(this._map.getSize().divideBy(2));
+                               center.x = center.x < 0 ? 0 : center.x;
+                               center.y = center.y < 0 ? 0 : center.y;
+                               
$('#scroll-container').mCustomScrollbar('scrollTo', [center.y, center.x]);
+                       }
                }
                else if (this._cursorMarker) {
                        this._map.removeLayer(this._cursorMarker);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to