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

Marco Cecchetti marco.cecchetti at collabora.com
Mon Jan 25 10:07:09 PST 2016


 loleaflet/src/dom/Draggable.js |    6 +++++-
 loleaflet/src/map/Map.js       |   28 ++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit a6364328e19b588b5696cd6565b81aa27ae8f459
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon Jan 25 17:07:38 2016 +0100

    loleaftlet - enable propagation of the onmousedown in view mode
    
    For details see bug bccu1446.
    
    Change-Id: I91585e2402aea2e72645b7358ee68efc8b7de313

diff --git a/loleaflet/src/dom/Draggable.js b/loleaflet/src/dom/Draggable.js
index 4e7280d..aebaf11 100644
--- a/loleaflet/src/dom/Draggable.js
+++ b/loleaflet/src/dom/Draggable.js
@@ -48,7 +48,11 @@ L.Draggable = L.Evented.extend({
 
 		if (e.shiftKey || ((e.which !== 1) && (e.button !== 0) && !e.touches)) { return; }
 
-		L.DomEvent.stopPropagation(e);
+		// enable propagation of the mousedown event from map pane to parent elements in view mode
+		// see bug bccu1446
+		if (!L.DomUtil.hasClass(this._element, 'leaflet-map-pane')) {
+			L.DomEvent.stopPropagation(e);
+		}
 
 		if (this._preventOutline) {
 			L.DomUtil.preventOutline(this._element);
commit c3083e9048a69ec1141d6ce2de09aa3d66147911
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon Jan 25 15:46:11 2016 +0100

    loleaflet - active cursor in multiple documents - fixed
    
    Added handlers for focus and blur events.
    
    Change-Id: Ie85ae264696e5221168f7ac280ba91732e9f5df3

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 87dd60f..eb430a9 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -607,6 +607,9 @@ L.Map = L.Evented.extend({
 		if (this.options.trackResize && this._resizeDetector.contentWindow) {
 			L.DomEvent[onOff](this._resizeDetector.contentWindow, 'resize', this._onResize, this);
 		}
+
+		L.DomEvent[onOff](window, 'blur', this._onLostFocus, this);
+		L.DomEvent[onOff](window, 'focus', this._onGotFocus, this);
 	},
 
 	_onResize: function () {
@@ -615,6 +618,31 @@ L.Map = L.Evented.extend({
 		        function () { this.invalidateSize({debounceMoveend: true}); }, this, false, this._container);
 	},
 
+	_onLostFocus: function () {
+		var doclayer = this._docLayer;
+		if (doclayer._isCursorVisible && doclayer._isCursorOverlayVisible) {
+			doclayer._visibleCursorOnLostFocus = doclayer._visibleCursor;
+			doclayer._isCursorOverlayVisibleOnLostFocus = doclayer._isCursorVisibleOnLostFocus = true;
+			doclayer._isCursorOverlayVisible = false;
+			doclayer._onUpdateCursor();
+		}
+	},
+
+	_onGotFocus: function () {
+		var doclayer = this._docLayer;
+		if (doclayer._isCursorVisibleOnLostFocus && doclayer._isCursorOverlayVisibleOnLostFocus) {
+			// we restore the old cursor position by a small delay, so that if the user clicks
+			// inside the document we skip to restore it, so that the user does not see the cursor
+			// jumping from the old position to the new one
+			setTimeout(function () {
+				if (doclayer._isCursorOverlayVisible) { return; } // user has clicked inside the document
+				doclayer._isCursorOverlayVisible = doclayer._isCursorVisible = true;
+				doclayer._visibleCursor = doclayer._visibleCursorOnLostFocus;
+				doclayer._onUpdateCursor();
+			}, 300);
+		}
+	},
+
 	_isMouseEnteringLeaving: function (e) {
 		var target = e.target || e.srcElement,
 			related = e.relatedTarget;


More information about the Libreoffice-commits mailing list