prevent focus outline when dragging objects
This commit is contained in:
parent
0a68b25ce5
commit
63753d8564
@ -20,9 +20,10 @@ L.Draggable = L.Evented.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (element, dragStartTarget) {
|
initialize: function (element, dragStartTarget, preventOutline) {
|
||||||
this._element = element;
|
this._element = element;
|
||||||
this._dragStartTarget = dragStartTarget || element;
|
this._dragStartTarget = dragStartTarget || element;
|
||||||
|
this._preventOutline = preventOutline;
|
||||||
},
|
},
|
||||||
|
|
||||||
enable: function () {
|
enable: function () {
|
||||||
@ -49,6 +50,10 @@ L.Draggable = L.Evented.extend({
|
|||||||
|
|
||||||
L.DomEvent.stopPropagation(e);
|
L.DomEvent.stopPropagation(e);
|
||||||
|
|
||||||
|
if (this._preventOutline) {
|
||||||
|
L.DomEvent.preventDefault(e);
|
||||||
|
}
|
||||||
|
|
||||||
if (L.DomUtil.hasClass(this._element, 'leaflet-zoom-anim')) { return; }
|
if (L.DomUtil.hasClass(this._element, 'leaflet-zoom-anim')) { return; }
|
||||||
|
|
||||||
L.DomUtil.disableImageDrag();
|
L.DomUtil.disableImageDrag();
|
||||||
|
@ -11,7 +11,7 @@ L.Handler.MarkerDrag = L.Handler.extend({
|
|||||||
var icon = this._marker._icon;
|
var icon = this._marker._icon;
|
||||||
|
|
||||||
if (!this._draggable) {
|
if (!this._draggable) {
|
||||||
this._draggable = new L.Draggable(icon, icon);
|
this._draggable = new L.Draggable(icon, icon, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._draggable.on({
|
this._draggable.on({
|
||||||
|
@ -581,7 +581,7 @@ L.Map = L.Evented.extend({
|
|||||||
!L.DomEvent._checkMouse(this._container, e)) { return; }
|
!L.DomEvent._checkMouse(this._container, e)) { return; }
|
||||||
|
|
||||||
// prevents outline when clicking on keyboard-focusable element
|
// prevents outline when clicking on keyboard-focusable element
|
||||||
if (type === 'mousedown') {
|
if (target && type === 'mousedown') {
|
||||||
L.DomEvent.preventDefault(e);
|
L.DomEvent.preventDefault(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user