nakarte

Source code of https://map.sikmir.ru (fork)
git clone git://git.sikmir.ru/nakarte
Log | Files | Refs | LICENSE

commit 08803c5f849514c698f4616454712066467e312e
parent b6e1b4188f7882b0451e137ce561c838099c1f00
Author: Sergej Orlov <wladimirych@gmail.com>
Date:   Mon, 20 Mar 2017 11:44:10 +0300

monkey patch for leaflet bug: map sends click whithout point when enter pressed

Diffstat:
Msrc/lib/leaflet.fixes/index.js | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/lib/leaflet.fixes/index.js b/src/lib/leaflet.fixes/index.js @@ -4,6 +4,7 @@ import './style.css'; function fixAll() { fixPanAnimationBug(); fixTouchDetection(); + fixMapKeypressEvent(); } // https://github.com/Leaflet/Leaflet/issues/3575 @@ -26,4 +27,15 @@ function fixTouchDetection() { L.Browser.touch &= ((navigator.pointerEnabled && !L.Browser.ie)|| navigator.maxTouchPoints) } +function fixMapKeypressEvent() { + const originalHandleDOMEvent = L.Map.prototype._handleDOMEvent; + L.Map.prototype._handleDOMEvent = function(e) { + if (e.type === 'keypress' && e.keyCode === 13) { + this._fireDOMEvent(e, e.type); + } else { + originalHandleDOMEvent.call(this, e); + } + } +} + export {fixAll}