dresscode-bricks
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -20,2 +20,3 @@ //#require Bricks.Component | ||
this._lastPos = null; | ||
this._dragMode = false; | ||
@@ -35,12 +36,14 @@ var eventName = 'mousedown'; | ||
$$_onMouseDown: function(evt) { | ||
var isTouch = evt.type == 'touchstart'; | ||
this._lastPos = Bricks.Event.getPos(evt); | ||
if (isTouch && evt.touches.length > 1) { | ||
return; | ||
if (!this._dragMode) { | ||
var isTouch = evt.type === 'touchstart'; | ||
this._lastPos = Bricks.Event.getPos(evt); | ||
if (!isTouch || evt.touches.length === 1) { | ||
if (this._fireEvent('start', {event: evt})) { | ||
this._dragMode = true; | ||
this._events.on(this._doc, isTouch ? 'touchmove' : 'mousemove', this.$$_onMouseMove, this); | ||
this._events.on(this._doc, isTouch ? 'touchend' : 'mouseup', this.$$_onMouseUp, this); | ||
Bricks.Event.stop(evt); | ||
} | ||
} | ||
} | ||
if (this._fireEvent('start', {event: evt})) { | ||
this._events.on(this._doc, isTouch ? 'touchmove' : 'mousemove', this.$$_onMouseMove, this); | ||
this._events.on(this._doc, isTouch ? 'touchend' : 'mouseup', this.$$_onMouseUp, this); | ||
Bricks.Event.stop(evt); | ||
} | ||
}, | ||
@@ -62,2 +65,3 @@ | ||
this._fireEvent('end', {event: evt}); | ||
this._dragMode = false; | ||
this._events.un(this._doc, 'mousemove,touchmove', this.$$_onMouseMove, this); | ||
@@ -64,0 +68,0 @@ this._events.un(this._doc, 'mouseup,touchend', this.$$_onMouseUp, this); |
{ | ||
"name": "dresscode-bricks", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"author": { | ||
@@ -5,0 +5,0 @@ "name": "Kolyaj", |
131205
3212