Skip to content
Permalink
Browse files

Rename some events without Did

  • Loading branch information...
Koen Bok
Koen Bok committed Feb 2, 2016
1 parent 941bbdc commit b1ec9bc57d95c07c165a284b3674abfa89db1339
@@ -46,9 +46,9 @@ EventMappers[Events.Move] = Events.Move
EventMappers[Events.ScrollStart] = Events.DragStart
EventMappers[Events.ScrollMove] = Events.DragMove
EventMappers[Events.ScrollEnd] = Events.DragEnd
EventMappers[Events.ScrollAnimationDidStart] = Events.DragAnimationDidStart
EventMappers[Events.ScrollAnimationDidEnd] = Events.DragAnimationDidEnd
EventMappers[Events.DirectionLockDidStart] = Events.DirectionLockDidStart
EventMappers[Events.ScrollAnimationDidStart] = Events.DragAnimationStart
EventMappers[Events.ScrollAnimationDidEnd] = Events.DragAnimationEnd
EventMappers[Events.DirectionLockStart] = Events.DirectionLockStart

class exports.ScrollComponent extends Layer

@@ -1028,9 +1028,9 @@ class exports.Layer extends BaseClass
onDragDidMove: (cb) -> @on(Events.DragDidMove, cb)
onDrag: (cb) -> @on(Events.Drag, cb)
onDragEnd: (cb) -> @on(Events.DragEnd, cb)
onDragAnimationDidStart: (cb) -> @on(Events.DragAnimationDidStart, cb)
onDragAnimationDidEnd: (cb) -> @on(Events.DragAnimationDidEnd, cb)
onDirectionLockDidStart: (cb) -> @on(Events.DirectionLockDidStart, cb)
onDragAnimationStart: (cb) -> @on(Events.DragAnimationStart, cb)
onDragAnimationEnd: (cb) -> @on(Events.DragAnimationEnd, cb)
onDirectionLockStart: (cb) -> @on(Events.DirectionLockStart, cb)

# Gestures

@@ -15,11 +15,9 @@ Events.DragMove = "dragmove"
Events.DragDidMove = "dragmove"
Events.Drag = "dragmove"
Events.DragEnd = "dragend"
Events.DragAnimationDidStart = "draganimationdidstart"
Events.DragAnimationDidEnd = "draganimationdidend"
Events.DirectionLockDidStart = "directionlockdidstart"
Events.Pinch = Gestures.Pinch
Events.Rotate = Gestures.Rotate
Events.DragAnimationStart = "draganimationstart"
Events.DragAnimationEnd = "draganimationend"
Events.DirectionLockStart = "directionlockstart"

"""
@@ -391,7 +389,7 @@ class exports.LayerDraggable extends BaseClass
# @_directionLockEnabledX = @_directionLockEnabledY = true if (xSlightlyPreferred and ySlightlyPreferred)

if @_directionLockEnabledX or @_directionLockEnabledY
@emit Events.DirectionLockDidStart,
@emit Events.DirectionLockStart,
x: @_directionLockEnabledX
y: @_directionLockEnabledY

@@ -519,7 +517,7 @@ class exports.LayerDraggable extends BaseClass
v: velocityY
@_simulation.y.start() if startSimulationY

@emit(Events.DragAnimationDidStart)
@emit(Events.DragAnimationStart)

_stopSimulation: =>
@_isAnimating = false
@@ -528,7 +526,7 @@ class exports.LayerDraggable extends BaseClass
@_simulation?.y.stop()
@_simulation = null
@emit(Events.Move, @layer.point)
@emit(Events.DragAnimationDidEnd)
@emit(Events.DragAnimationEnd)

animateStop: ->
@_stopSimulation()
@@ -543,7 +541,7 @@ class exports.LayerDraggable extends BaseClass
onDragDidMove: (cb) -> @on(Events.DragDidMove, cb)
onDrag: (cb) -> @on(Events.Drag, cb)
onDragEnd: (cb) -> @on(Events.DragEnd, cb)
onDragAnimationDidStart: (cb) -> @on(Events.DragAnimationDidStart, cb)
onDragAnimationDidEnd: (cb) -> @on(Events.DragAnimationDidEnd, cb)
onDirectionLockDidStart: (cb) -> @on(Events.DirectionLockDidStart, cb)
onDragAnimationStart: (cb) -> @on(Events.DragAnimationStart, cb)
onDragAnimationEnd: (cb) -> @on(Events.DragAnimationEnd, cb)
onDirectionLockStart: (cb) -> @on(Events.DirectionLockStart, cb)

@@ -3,8 +3,8 @@ eventKeys = [
"DragStart",
"DragMove",
"DragEnd",
"DragAnimationDidStart",
"DragAnimationDidEnd",
"DragAnimationStart",
"DragAnimationEnd",
]

layer = new Layer
@@ -20,8 +20,8 @@ for index in [0..2]
pageContent.scrollHorizontal = false
pageContent.directionLock = true

page.on Events.DirectionLockDidStart, (direction) ->
print "pageContent.DirectionLockDidStart", direction
page.on Events.DirectionLockStart, (direction) ->
print "pageContent.DirectionLockStart", direction

rows = 10
gutter = 2
@@ -43,5 +43,5 @@ for index in [0..2]
"line-height": "#{cellLayer.height}px"


page.on Events.DirectionLockDidStart, (direction) ->
print "page.DirectionLockDidStart", direction
page.on Events.DirectionLockStart, (direction) ->
print "page.DirectionLockStart", direction
@@ -58,5 +58,5 @@ sliderA.on "change:value", ->
valueLayer.states.switch "nofade" if this.value >= 75

# Return after DragEnd
sliderA.knob.on Events.DragAnimationDidEnd, ->
sliderA.knob.on Events.DragAnimationEnd, ->
valueLayer.states.switch "scaleDown"
@@ -58,5 +58,5 @@ sliderA.on "change:value", ->
valueLayer.states.switch "nofade" if this.value >= 75

# Return after DragEnd
sliderA.knob.on Events.DragAnimationDidEnd, ->
sliderA.knob.on Events.DragAnimationEnd, ->
valueLayer.states.switch "scaleDown"

0 comments on commit b1ec9bc

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