Reputation: 21
I want to start marker dragging after 2 seconds on the mousedown. I know how to enable/disable the dragging, but not find how to start dragging by code.
I tried :
marker.on('mousedown', function(e){
setTimeout(() => {
marker.dragging.enable();
marker.dragging._draggable._onDown(e);
}, 2000);
});
The draggable option is enable, but the marker does not move.
Of course, I can move it on the 2nd mousedown.
Upvotes: 0
Views: 481
Reputation: 21
this is solve my problem :
marker.on('mousedown', function(e){
setTimeout(() => {
map.dragging._draggable.finishDrag();
marker.dragging.enable();
marker.dragging._draggable._onDown(e.originalEvent);
}, 2000);
});
Upvotes: 1