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

Jan Holesovsky kendy at collabora.com
Mon Jan 25 03:35:46 PST 2016


 loleaflet/src/layer/tile/TileLayer.js |   18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

New commits:
commit f7d4a2cfa1554431325095f752ffecd3cc539400
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Jan 25 12:32:50 2016 +0100

    loleaflet: Position the mouse with 'drop' always (even html snippet).

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 22d8306..71855f5 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1051,8 +1051,15 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_onDrop: function (e) {
-		// The original event doesn't contain the coordinates.
+		// Move the cursor, so that the insert position is as close to the drop coordinates as possible.
 		var latlng = e.latlng;
+		var docLayer = this._map._docLayer;
+		var mousePos = docLayer._latLngToTwips(latlng);
+		var count = 1;
+		var buttons = 1;
+		var modifier = this._map.keyboard.modifier;
+		this._postMouseEvent('buttondown', mousePos.x, mousePos.y, count, buttons, modifier);
+		this._postMouseEvent('buttonup', mousePos.x, mousePos.y, count, buttons, modifier);
 
 		e = e.originalEvent;
 		e.preventDefault();
@@ -1082,15 +1089,6 @@ L.TileLayer = L.GridLayer.extend({
 				for (var i = 0; i < files.length; ++i) {
 					var file = files[i];
 					if (file.type.match(/image.*/)) {
-						// Move the cursor, so that the insert position is as close to the drop coordinates as possible.
-						var docLayer = this._map._docLayer;
-						var mousePos = docLayer._latLngToTwips(latlng);
-						var count = 1;
-						var buttons = 1;
-						var modifier = this._map.keyboard.modifier;
-						this._postMouseEvent('buttondown', mousePos.x, mousePos.y, count, buttons, modifier);
-						this._postMouseEvent('buttonup', mousePos.x, mousePos.y, count, buttons, modifier);
-
 						var reader = new FileReader();
 						var socket = this._map._socket;
 						reader.onload = (function(aImg) {


More information about the Libreoffice-commits mailing list