small refactoring

This commit is contained in:
mourner 2010-09-21 18:36:00 +03:00
parent 480120e3f3
commit 1ec2971172

View File

@ -51,23 +51,29 @@ L.Draggable = L.Class.extend({
_onMove: function(e) {
L.DomEvent.preventDefault(e);
//L.DomEvent.stopPropagation(e);
if (e.touches && e.touches.length > 1) { return; }
if (e.touches && e.touches.length == 1) { e = e.touches[0]; }
var offset = new L.Point(e.clientX - this._startX, e.clientY - this._startY),
newPos = this._dragStartPos.add(offset);
var offset = new L.Point(e.clientX - this._startX, e.clientY - this._startY);
this._newPos = this._dragStartPos.add(offset);
this._updatePosition();
if (!this._moved) {
this.fire('dragstart');
this._moved = true;
}
L.DomUtil.setPosition(this._element, newPos);
this.fire('drag');
},
_updatePosition: function() {
L.DomUtil.setPosition(this._element, this._newPos);
},
_onUp: function(e) {
this._enableTextSelection();