stop pan key event even when pan anim is in progress (#6231)
When pressing pan key multiple times while pan animation is in progress, `stop` function isn't invoked. This led to document scroll (if document is scrollable) This commit fixes the issue to stop pan key event even when pan animation is in progress.
This commit is contained in:
parent
d7f91d9a9d
commit
b507e21c51
@ -145,20 +145,18 @@ export var Keyboard = Handler.extend({
|
||||
offset;
|
||||
|
||||
if (key in this._panKeys) {
|
||||
if (!map._panAnim || !map._panAnim._inProgress) {
|
||||
offset = this._panKeys[key];
|
||||
if (e.shiftKey) {
|
||||
offset = toPoint(offset).multiplyBy(3);
|
||||
}
|
||||
|
||||
if (map._panAnim && map._panAnim._inProgress) { return; }
|
||||
map.panBy(offset);
|
||||
|
||||
offset = this._panKeys[key];
|
||||
if (e.shiftKey) {
|
||||
offset = toPoint(offset).multiplyBy(3);
|
||||
if (map.options.maxBounds) {
|
||||
map.panInsideBounds(map.options.maxBounds);
|
||||
}
|
||||
}
|
||||
|
||||
map.panBy(offset);
|
||||
|
||||
if (map.options.maxBounds) {
|
||||
map.panInsideBounds(map.options.maxBounds);
|
||||
}
|
||||
|
||||
} else if (key in this._zoomKeys) {
|
||||
map.setZoom(map.getZoom() + (e.shiftKey ? 3 : 1) * this._zoomKeys[key]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user