fix shift-double-click on maps with vector layers #2189

This commit is contained in:
Vladimir Agafonkin 2013-11-14 18:50:29 +02:00
parent 01b714426c
commit 88e60af971

View File

@ -38,21 +38,22 @@ L.Map.BoxZoom = L.Handler.extend({
this._startLayerPoint = this._map.mouseEventToLayerPoint(e);
this._box = L.DomUtil.create('div', 'leaflet-zoom-box', this._pane);
L.DomUtil.setPosition(this._box, this._startLayerPoint);
//TODO refactor: move cursor to styles
this._container.style.cursor = 'crosshair';
L.DomEvent
.on(document, 'mousemove', this._onMouseMove, this)
.on(document, 'mouseup', this._onMouseUp, this)
.on(document, 'keydown', this._onKeyDown, this);
this._map.fire('boxzoomstart');
},
_onMouseMove: function (e) {
if (!this._moved) {
this._box = L.DomUtil.create('div', 'leaflet-zoom-box', this._pane);
L.DomUtil.setPosition(this._box, this._startLayerPoint);
//TODO refactor: move cursor to styles
this._container.style.cursor = 'crosshair';
this._map.fire('boxzoomstart');
}
var startPoint = this._startLayerPoint,
box = this._box,
@ -73,8 +74,10 @@ L.Map.BoxZoom = L.Handler.extend({
},
_finish: function () {
this._pane.removeChild(this._box);
this._container.style.cursor = '';
if (this._moved) {
this._pane.removeChild(this._box);
this._container.style.cursor = '';
}
L.DomUtil.enableTextSelection();
L.DomUtil.enableImageDrag();