added check for noMoveStart option in map.flyTo (#5923)

* added check for noMoveStart option in map.flyTo

* added implicit false parameter to _moveStart when noMoveStart option is not set

* Shorten option check

* Fix typo :(
This commit is contained in:
Isak Prytz 2017-11-17 16:08:26 +01:00 committed by Per Liedman
parent d6739c20c1
commit 4c0c3acdd6
2 changed files with 9 additions and 6 deletions

View File

@ -426,7 +426,7 @@ export var Map = Evented.extend({
} }
} }
this._moveStart(true); this._moveStart(true, options.noMoveStart);
frame.call(this); frame.call(this);
return this; return this;
@ -1143,7 +1143,7 @@ export var Map = Evented.extend({
var zoomChanged = this._zoom !== zoom; var zoomChanged = this._zoom !== zoom;
this this
._moveStart(zoomChanged) ._moveStart(zoomChanged, false)
._move(center, zoom) ._move(center, zoom)
._moveEnd(zoomChanged); ._moveEnd(zoomChanged);
@ -1160,7 +1160,7 @@ export var Map = Evented.extend({
} }
}, },
_moveStart: function (zoomChanged) { _moveStart: function (zoomChanged, noMoveStart) {
// @event zoomstart: Event // @event zoomstart: Event
// Fired when the map zoom is about to change (e.g. before zoom animation). // Fired when the map zoom is about to change (e.g. before zoom animation).
// @event movestart: Event // @event movestart: Event
@ -1168,7 +1168,10 @@ export var Map = Evented.extend({
if (zoomChanged) { if (zoomChanged) {
this.fire('zoomstart'); this.fire('zoomstart');
} }
return this.fire('movestart'); if (!noMoveStart) {
this.fire('movestart');
}
return this;
}, },
_move: function (center, zoom, data) { _move: function (center, zoom, data) {
@ -1601,7 +1604,7 @@ export var Map = Evented.extend({
Util.requestAnimFrame(function () { Util.requestAnimFrame(function () {
this this
._moveStart(true) ._moveStart(true, false)
._animateZoom(center, zoom, true); ._animateZoom(center, zoom, true);
}, this); }, this);

View File

@ -91,7 +91,7 @@ export var TouchZoom = Handler.extend({
} }
if (!this._moved) { if (!this._moved) {
map._moveStart(true); map._moveStart(true, false);
this._moved = true; this._moved = true;
} }