Merge pull request #3340 from MazeMap/focus-pane-bug

Fix #3333 by catching the onScroll event on the map container
This commit is contained in:
Vladimir Agafonkin 2015-03-30 17:35:27 +03:00
commit 1378bea0d1

View File

@ -440,6 +440,7 @@ L.Map = L.Evented.extend({
throw new Error('Map container is already initialized.'); throw new Error('Map container is already initialized.');
} }
L.DomEvent.addListener(container, 'scroll', this._onScroll, this);
container._leaflet = true; container._leaflet = true;
}, },
@ -569,6 +570,11 @@ L.Map = L.Evented.extend({
function () { this.invalidateSize({debounceMoveend: true}); }, this, false, this._container); function () { this.invalidateSize({debounceMoveend: true}); }, this, false, this._container);
}, },
_onScroll: function () {
this._container.scrollTop = 0;
this._container.scrollLeft = 0;
},
_handleDOMEvent: function (e) { _handleDOMEvent: function (e) {
if (!this._loaded || L.DomEvent._skipped(e)) { return; } if (!this._loaded || L.DomEvent._skipped(e)) { return; }