loleaflet: Position the mouse with 'drop' always (even html snippet).
This commit is contained in:
parent
650ea84b4f
commit
f7d4a2cfa1
1 changed files with 8 additions and 10 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue