Merge pull request #538 from giscloud/inertia.few.fixes

Inertia.few.fixes
This commit is contained in:
Vladimir Agafonkin 2012-02-25 01:36:00 -08:00
commit 667964bad1
2 changed files with 5 additions and 7 deletions

View File

@ -97,7 +97,7 @@ L.Transition = L.Transition.extend({
this.fire('step'); this.fire('step');
if (e instanceof window.Event) { if (e instanceof Object) {
this.fire('end'); this.fire('end');
} }
} }

View File

@ -91,11 +91,8 @@ L.Map.Drag = L.Handler.extend({
options = map.options, options = map.options,
delay = +new Date() - this._lastTime; delay = +new Date() - this._lastTime;
if (!options.inertia || delay > options.inertiaThreshold) { if (!options.inertia || delay > options.inertiaThreshold || this._positions[0] === undefined) {
map map.fire('moveend');
.fire('moveend')
.fire('dragend');
} else { } else {
var direction = this._lastPos.subtract(this._positions[0]), var direction = this._lastPos.subtract(this._positions[0]),
@ -125,6 +122,7 @@ L.Map.Drag = L.Handler.extend({
L.Util.requestAnimFrame(this._panInsideMaxBounds, map, true, map._container); L.Util.requestAnimFrame(this._panInsideMaxBounds, map, true, map._container);
} }
} }
map.fire('dragend');
}, },
_panInsideMaxBounds: function () { _panInsideMaxBounds: function () {