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

Mihai Varga mihai.varga at collabora.com
Thu Aug 20 06:27:18 PDT 2015


 loleaflet/dist/leaflet.css |    8 ++++++++
 loleaflet/src/map/Map.js   |   17 ++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

New commits:
commit debf81369e19f160dfff7e1fbfc9a994faefde32
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Thu Aug 20 15:56:06 2015 +0300

    loleaflet: use an iframe to detect window size changes
    
    If running in a popup

diff --git a/loleaflet/dist/leaflet.css b/loleaflet/dist/leaflet.css
index 7c09fb6..7e045b3 100644
--- a/loleaflet/dist/leaflet.css
+++ b/loleaflet/dist/leaflet.css
@@ -673,6 +673,14 @@ a.leaflet-control-buttons:hover:first-child {
 	padding: 0px;
 }
 
+.resize-detector {
+    position: absolute;
+    width: 100%;
+    height: 100%;
+    z-index: 0;
+    visibility: hidden;
+}
+
 .parts-preview {
 	background: #DFDFDF;
 	position: absolute;
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index c3f091a..eb2e4c7 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -475,6 +475,7 @@ L.Map = L.Evented.extend({
 
 		var textAreaContainer = L.DomUtil.create('div', 'clipboard-container', container.parentElement);
 		this._textArea = L.DomUtil.create('textarea', 'clipboard', textAreaContainer);
+		this._resizeDetector = L.DomUtil.create('iframe', 'resize-detector', container);
 
 		container._leaflet = true;
 	},
@@ -596,7 +597,11 @@ L.Map = L.Evented.extend({
 		L.DomEvent[onOff](this._textArea, 'copy keydown keypress keyup', this._handleDOMEvent, this);
 
 		if (this.options.trackResize) {
-			L.DomEvent[onOff](window, 'resize', this._onResize, this);
+			var target = window;
+			if (window.opener) {
+				target = this._resizeDetector.contentWindow;
+			}
+			L.DomEvent[onOff](target, 'resize', this._onResize, this);
 		}
 	},
 
commit 70b041a7dd12a6eb0f073dbd77beb85000ef3b99
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Thu Aug 20 15:46:10 2015 +0300

    Revert "loleaflet: always return the current size"
    
    This actually ruins zooming
    This reverts commit 573c6e5b3d3b82029560210878b13498b4f2e5c0.

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index ebe67ee..c3f091a 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -333,11 +333,13 @@ L.Map = L.Evented.extend({
 	},
 
 	getSize: function () {
-		this._size = new L.Point(
-			this._container.clientWidth,
-			this._container.clientHeight);
+		if (!this._size || this._sizeChanged) {
+			this._size = new L.Point(
+				this._container.clientWidth,
+				this._container.clientHeight);
 
-		this._sizeChanged = false;
+			this._sizeChanged = false;
+		}
 		return this._size.clone();
 	},
 


More information about the Libreoffice-commits mailing list