Skip to content

Commit

Permalink
slider value change event + shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
J.P.P Treub committed Feb 23, 2016
1 parent b28335d commit 13042bc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions framer/Components/SliderComponent.coffee
Expand Up @@ -17,6 +17,8 @@ valueForPoint(<n>)
animateToValue(value, animationOptions={})
"""

Events.SliderValueChange = "sliderValueChange"

class Knob extends Layer

constructor: (options) ->
Expand Down Expand Up @@ -235,6 +237,7 @@ class exports.SliderComponent extends Layer

_updateValue: =>
@emit("change:value", @value)
@emit(Events.SliderValueChange, @value)

pointForValue: (value) ->
if @width > @height
Expand Down Expand Up @@ -269,3 +272,8 @@ class exports.SliderComponent extends Layer
@knob.on("change:y", @_updateValue)

@knob.animate(animationOptions)

##############################################################
## EVENT HELPERS

onValueChange: (cb) -> @on(Events.SliderValueChange, cb)

0 comments on commit 13042bc

Please sign in to comment.