Make sure mousemove events have lastPoint set even for the first move so event.delta is always defined for them.

This commit is contained in:
Jürg Lehni 2011-06-02 15:33:30 +01:00
parent 8b7eea4663
commit 016476d1dc

View file

@ -293,7 +293,9 @@ var Tool = this.Tool = Base.extend({
if (needsChange && pt.equals(this._point))
return false;
}
this._lastPoint = this._point;
// Make sure mousemove events have lastPoint set even for the first move
// so event.delta is always defined for them.
this._lastPoint = first && type == 'mousemove' ? pt : this._point;
this._point = pt;
switch (type) {
case 'mousedown':