loleaflet/src/layer/tile/TileLayer.js | 12 ++++++++++++ 1 file changed, 12 insertions(+)
New commits: commit 6fb558741cec29af5cb32edc864ae0bece82e619 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Thu Jan 21 16:54:11 2016 +0100 leaflet: position cursor before image drop So we insert the image (close to or even exactly) at the drop position, instead of the last cursor position, which may be far away. With this, we're closer to the desktop image drop behavior in the browser. diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index a6b2d84..846a7c6 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -954,6 +954,9 @@ L.TileLayer = L.GridLayer.extend({ }, _onDrop: function (e) { + // The original event doesn't contain the coordinates. + var latlng = e.latlng; + e = e.originalEvent; e.preventDefault(); @@ -982,6 +985,15 @@ 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) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits