Skip to content

Commit 928883d

Browse files
author
@soyjavi
committed
No velocity
1 parent c2cf144 commit 928883d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

source/quo.gestures.swipe.coffee

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ Quo.Gestures.add
1818

1919
handler : do (base = Quo.Gestures) ->
2020
GAP = (if window.devicePixelRatio >= 2 then 15 else 20)
21-
VELOCITY_SMOOTHING = .5
2221
_target = null
2322
_start = null
2423
_start_axis = null
2524
_last = null
26-
is_first = _last is null
27-
_timeStamp = new Date().getTime()
28-
dt = (if is_first then 1 else _timeStamp - _last.timeStamp)
2925

3026
start = (target, data) ->
3127
if data.length is 1
@@ -35,10 +31,9 @@ Quo.Gestures.add
3531

3632
move = (target, data) ->
3733
if data.length is 1
38-
delta = x: (data[0].x - _start.x), y: (data[0].y - _start.y),
39-
vx: (if is_first then (data[0].x - _start.x) / dt else _last.delta.vx * VELOCITY_SMOOTHING + ((data[0].x - _last.x) / dt) * (1 - VELOCITY_SMOOTHING)),
40-
vy: (if is_first then (data[0].x - _start.y) / dt else _last.delta.vy * VELOCITY_SMOOTHING + ((data[0].y - _last.y) / dt) * (1 - VELOCITY_SMOOTHING))
41-
_last = x: data[0].x, y: data[0].y, timeStamp: _timeStamp, delta: delta
34+
delta = x: (data[0].x - _start.x), y: (data[0].y - _start.y)
35+
is_first = _last is null
36+
_last = x: data[0].x, y: data[0].y, delta: delta
4237
_check(true, is_first)
4338
else
4439
_last = null

0 commit comments

Comments
 (0)