Skip to content
Permalink
Browse files

Fixed positioning of draggable

- Call the event before setting the position so we can influence the speed
- Set the position based on the current event delta
  • Loading branch information...
koenbok committed Nov 14, 2013
1 parent e4c5467 commit 5fce26486cf2149e5a9c1027e0b5fccd2c7cb04f
Showing with 9 additions and 9 deletions.
  1. +9 −9 src/ui/draggable.coffee
@@ -57,27 +57,27 @@ class exports.Draggable extends EventEmitter
velocity.y = 0 if velocity.y is Infinity

velocity

_updatePosition: (event) =>


@emit Events.DragMove, event

touchEvent = Events.touchEvent event

delta =
x: touchEvent.clientX - @_start.x
y: touchEvent.clientY - @_start.y
x: touchEvent.webkitMovementX
y: touchEvent.webkitMovementY

# Correct for current drag speed
correctedDelta =
x: delta.x * @speed.x
y: delta.y * @speed.y
t: event.timeStamp

@view.x = @_start.x + correctedDelta.x - @_offset.x
@view.y = @_start.y + correctedDelta.y - @_offset.y
@view.x += correctedDelta.x
@view.y += correctedDelta.y

@_deltas.push correctedDelta

@emit Events.DragMove, event

_touchStart: (event) =>

0 comments on commit 5fce264

Please sign in to comment.
You can’t perform that action at this time.