Avoid accidental zooms while drawing beeline

This commit is contained in:
Norbert Renner 2021-04-30 18:30:01 +02:00
parent b4368c1f51
commit 6ea972bcf8
2 changed files with 65 additions and 0 deletions

View file

@ -180,6 +180,16 @@ BR.Routing = L.Routing.extend({
this._draw
);
// avoid accidental shift-drag zooms while drawing beeline with shift-click
this._map.boxZoom.disable();
this._map.addHandler('boxZoom', BR.ClickTolerantBoxZoom);
this._draw.on('enabled', function () {
this._map.boxZoom.tolerant = true;
});
this._draw.on('disabled', function () {
this._map.boxZoom.tolerant = false;
});
// remove listeners registered in super.onAdd, keys not working when map container lost focus
// (by navbar/sidebar interaction), use document instead
L.DomEvent.removeListener(this._container, 'keydown', this._keydownListener, this);