Don't stop every touches when only one ends.
This commit is contained in:
parent
6b0f739237
commit
0897fe5c5b
@ -223,7 +223,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
UI = (function() {
|
UI = (function() {
|
||||||
var dialog, drag, dragend, dragstart, hover, hoverend, hoverstart, touchmove;
|
var dialog, drag, dragend, dragstart, hover, hoverend, hoverstart, touchend, touchmove;
|
||||||
dialog = function(id, position, html) {
|
dialog = function(id, position, html) {
|
||||||
var el, move;
|
var el, move;
|
||||||
el = d.createElement('div');
|
el = d.createElement('div');
|
||||||
@ -259,7 +259,7 @@
|
|||||||
if (isTouching) {
|
if (isTouching) {
|
||||||
o.identifier = e.identifier;
|
o.identifier = e.identifier;
|
||||||
o.move = touchmove.bind(o);
|
o.move = touchmove.bind(o);
|
||||||
o.up = dragend.bind(o);
|
o.up = touchend.bind(o);
|
||||||
d.addEventListener('touchmove', o.move, false);
|
d.addEventListener('touchmove', o.move, false);
|
||||||
d.addEventListener('touchend', o.up, false);
|
d.addEventListener('touchend', o.up, false);
|
||||||
return d.addEventListener('touchcancel', o.up, false);
|
return d.addEventListener('touchcancel', o.up, false);
|
||||||
@ -277,7 +277,6 @@
|
|||||||
touch = _ref[_i];
|
touch = _ref[_i];
|
||||||
if (touch.identifier === this.identifier) {
|
if (touch.identifier === this.identifier) {
|
||||||
drag.call(this, touch);
|
drag.call(this, touch);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -310,6 +309,16 @@
|
|||||||
return this.style.bottom = null;
|
return this.style.bottom = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
touchend = function(e) {
|
||||||
|
var touch, _i, _len, _ref;
|
||||||
|
_ref = e.changedTouches;
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
touch = _ref[_i];
|
||||||
|
if (touch.identifier === this.identifier) {
|
||||||
|
dragend.call(this, touch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
dragend = function(e) {
|
dragend = function(e) {
|
||||||
if (e.type === 'mouseup') {
|
if (e.type === 'mouseup') {
|
||||||
d.removeEventListener('mousemove', this.move, false);
|
d.removeEventListener('mousemove', this.move, false);
|
||||||
|
|||||||
@ -210,7 +210,7 @@ UI = (->
|
|||||||
if isTouching
|
if isTouching
|
||||||
o.identifier = e.identifier
|
o.identifier = e.identifier
|
||||||
o.move = touchmove.bind o
|
o.move = touchmove.bind o
|
||||||
o.up = dragend.bind o
|
o.up = touchend.bind o
|
||||||
d.addEventListener 'touchmove', o.move, false
|
d.addEventListener 'touchmove', o.move, false
|
||||||
d.addEventListener 'touchend', o.up, false
|
d.addEventListener 'touchend', o.up, false
|
||||||
d.addEventListener 'touchcancel', o.up, false
|
d.addEventListener 'touchcancel', o.up, false
|
||||||
@ -223,7 +223,7 @@ UI = (->
|
|||||||
for touch in e.changedTouches
|
for touch in e.changedTouches
|
||||||
if touch.identifier is @identifier
|
if touch.identifier is @identifier
|
||||||
drag.call @, touch
|
drag.call @, touch
|
||||||
return
|
return
|
||||||
drag = (e) ->
|
drag = (e) ->
|
||||||
left = e.clientX - @dx
|
left = e.clientX - @dx
|
||||||
top = e.clientY - @dy
|
top = e.clientY - @dy
|
||||||
@ -243,6 +243,11 @@ UI = (->
|
|||||||
else
|
else
|
||||||
@style.top = top / @screenHeight * 100 + '%'
|
@style.top = top / @screenHeight * 100 + '%'
|
||||||
@style.bottom = null
|
@style.bottom = null
|
||||||
|
touchend = (e) ->
|
||||||
|
for touch in e.changedTouches
|
||||||
|
if touch.identifier is @identifier
|
||||||
|
dragend.call @, touch
|
||||||
|
return
|
||||||
dragend = (e) ->
|
dragend = (e) ->
|
||||||
if e.type is 'mouseup'
|
if e.type is 'mouseup'
|
||||||
d.removeEventListener 'mousemove', @move, false
|
d.removeEventListener 'mousemove', @move, false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user