return asap

This commit is contained in:
Nicolas Stepien 2012-09-22 04:00:30 +02:00
parent 92bece87ea
commit bef732ac26
2 changed files with 19 additions and 15 deletions

View File

@ -254,7 +254,8 @@
height: screenHeight - rect.height,
width: screenWidth - rect.width,
screenHeight: screenHeight,
screenWidth: screenWidth
screenWidth: screenWidth,
isTouching: isTouching
};
if (isTouching) {
o.identifier = e.identifier;
@ -277,6 +278,7 @@
touch = _ref[_i];
if (touch.identifier === this.identifier) {
drag.call(this, touch);
return;
}
}
};
@ -315,18 +317,19 @@
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
touch = _ref[_i];
if (touch.identifier === this.identifier) {
dragend.call(this, touch);
dragend.call(this);
return;
}
}
};
dragend = function(e) {
if (e.type === 'mouseup') {
d.removeEventListener('mousemove', this.move, false);
d.removeEventListener('mouseup', this.up, false);
} else {
dragend = function() {
if (this.isTouching) {
d.removeEventListener('touchmove', this.move, false);
d.removeEventListener('touchend', this.up, false);
d.removeEventListener('touchcancel', this.up, false);
} else {
d.removeEventListener('mousemove', this.move, false);
d.removeEventListener('mouseup', this.up, false);
}
return localStorage.setItem("" + g.NAMESPACE + this.id + ".position", this.style.cssText);
};

View File

@ -206,6 +206,7 @@ UI = (->
width: screenWidth - rect.width
screenHeight: screenHeight
screenWidth: screenWidth
isTouching: isTouching
}
if isTouching
o.identifier = e.identifier
@ -223,7 +224,7 @@ UI = (->
for touch in e.changedTouches
if touch.identifier is @identifier
drag.call @, touch
return
return
drag = (e) ->
left = e.clientX - @dx
top = e.clientY - @dy
@ -246,16 +247,16 @@ UI = (->
touchend = (e) ->
for touch in e.changedTouches
if touch.identifier is @identifier
dragend.call @, touch
return
dragend = (e) ->
if e.type is 'mouseup'
d.removeEventListener 'mousemove', @move, false
d.removeEventListener 'mouseup', @up, false
else # touchend or touchcancel
dragend.call @
return
dragend = ->
if @isTouching
d.removeEventListener 'touchmove', @move, false
d.removeEventListener 'touchend', @up, false
d.removeEventListener 'touchcancel', @up, false
else # mouseup
d.removeEventListener 'mousemove', @move, false
d.removeEventListener 'mouseup', @up, false
localStorage.setItem "#{g.NAMESPACE}#{@id}.position", @style.cssText
hoverstart = (root, el, events, cb) ->