loleaflet/src/control/Control.Scale.js |    4 +-
 loleaflet/src/map/Map.js               |   62 +++++++++++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 5 deletions(-)

New commits:
commit d58cf803773db8362e784f1bda7cb4cbc0466ba6
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Tue Jul 7 13:45:59 2020 +0530
Commit:     Dennis Francis <dennis.fran...@collabora.com>
CommitDate: Wed Jul 8 16:52:16 2020 +0200

    split-panes: respect split position when...
    
    converting to/from container coordinates. Also introduce the
    corresponding 'IgnoreSplits' versions of changed methods because they
    are needed for repositioning the map-view which is independent of the splits
    position. They are also needed for stuff outside the map which need not
    be aware of the splits.
    
    Change-Id: I9044a185e5762fa4c4866590e1b7cf456fb2d1dd
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98352
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Dennis Francis <dennis.fran...@collabora.com>

diff --git a/loleaflet/src/control/Control.Scale.js 
b/loleaflet/src/control/Control.Scale.js
index 403c88f7c..a3e15406a 100644
--- a/loleaflet/src/control/Control.Scale.js
+++ b/loleaflet/src/control/Control.Scale.js
@@ -43,8 +43,8 @@ L.Control.Scale = L.Control.extend({
                    y = map.getSize().y / 2;
 
                var maxMeters = L.CRS.Earth.distance(
-                               map.containerPointToLatLng([0, y]),
-                               
map.containerPointToLatLng([this.options.maxWidth, y]));
+                               map.containerPointToLatLngIgnoreSplits([0, y]),
+                               
map.containerPointToLatLngIgnoreSplits([this.options.maxWidth, y]));
 
                this._updateScales(maxMeters);
        },
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index b6027ffc4..b4be77964 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -504,10 +504,10 @@ L.Map = L.Evented.extend({
        setZoomAround: function (latlng, zoom, options) {
                var scale = this.getZoomScale(zoom),
                    viewHalf = this.getSize().divideBy(2),
-                   containerPoint = latlng instanceof L.Point ? latlng : 
this.latLngToContainerPoint(latlng),
+                   containerPoint = latlng instanceof L.Point ? latlng : 
this.latLngToContainerPointIgnoreSplits(latlng),
 
                    centerOffset = 
containerPoint.subtract(viewHalf).multiplyBy(1 - 1 / scale),
-                   newCenter = 
this.containerPointToLatLng(viewHalf.add(centerOffset));
+                   newCenter = 
this.containerPointToLatLngIgnoreSplits(viewHalf.add(centerOffset));
 
                return this.setView(newCenter, zoom, {zoom: options});
        },
@@ -913,10 +913,57 @@ L.Map = L.Evented.extend({
        },
 
        containerPointToLayerPoint: function (point) { // (Point)
+               if (!this._splitPanesContext) {
+                       return 
this.containerPointToLayerPointIgnoreSplits(point);
+               }
+               var splitPos = this._splitPanesContext.getSplitPos();
+               var pixelOrigin = this.getPixelOrigin();
+               var mapPanePos = this._getMapPanePos();
+               var result = L.point(point);
+               if (point.x <= splitPos.x) {
+                       result.x -= pixelOrigin.x;
+               }
+               else {
+                       result.x -= mapPanePos.x;
+               }
+
+               if (point.y <= splitPos.y) {
+                       result.y -= pixelOrigin.y;
+               }
+               else {
+                       result.y -= mapPanePos.y;
+               }
+
+               return result;
+       },
+
+       containerPointToLayerPointIgnoreSplits: function (point) { // (Point)
                return L.point(point).subtract(this._getMapPanePos());
        },
 
        layerPointToContainerPoint: function (point) { // (Point)
+
+               if (!this._splitPanesContext) {
+                       return 
this.layerPointToContainerPointIgnoreSplits(point);
+               }
+
+               var splitPos = this._splitPanesContext.getSplitPos();
+               var pixelOrigin = this.getPixelOrigin();
+               var mapPanePos = this._getMapPanePos();
+               var result = L.point(point)._add(pixelOrigin);
+
+               if (result.x > splitPos.x) {
+                       result.x -= (pixelOrigin.x - mapPanePos.x);
+               }
+
+               if (result.y > splitPos.y) {
+                       result.y -= (pixelOrigin.y - mapPanePos.y);
+               }
+
+               return result;
+       },
+
+       layerPointToContainerPointIgnoreSplits: function (point) { // (Point)
                return L.point(point).add(this._getMapPanePos());
        },
 
@@ -925,6 +972,15 @@ L.Map = L.Evented.extend({
                return this.layerPointToLatLng(layerPoint);
        },
 
+       containerPointToLatLngIgnoreSplits: function (point) {
+               var layerPoint = 
this.containerPointToLayerPointIgnoreSplits(L.point(point));
+               return this.layerPointToLatLng(layerPoint);
+       },
+
+       latLngToContainerPointIgnoreSplits: function (latlng) {
+               return 
this.layerPointToContainerPointIgnoreSplits(this.latLngToLayerPoint(L.latLng(latlng)));
+       },
+
        latLngToContainerPoint: function (latlng) {
                return 
this.layerPointToContainerPoint(this.latLngToLayerPoint(L.latLng(latlng)));
        },
@@ -1624,7 +1680,7 @@ L.Map = L.Evented.extend({
 
        // layer point of the current center
        _getCenterLayerPoint: function () {
-               return 
this.containerPointToLayerPoint(this.getSize()._divideBy(2));
+               return 
this.containerPointToLayerPointIgnoreSplits(this.getSize()._divideBy(2));
        },
 
        // offset of the specified place to the current center in pixels
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to