Permalink
Browse files

Only update the value when the knob is moved, not when the frame is c…

…hanged in another way.
  • Loading branch information...
eelco committed May 6, 2016
1 parent 94e779d commit 0e4aac05d9169023244d69fb1fe9d361e96a2bca
Showing with 4 additions and 1 deletion.
  1. +4 −1 framer/Components/SliderComponent.coffee
@@ -86,7 +86,10 @@ class exports.SliderComponent extends Layer
@on("change:borderRadius", @_setRadius)
@knob.on("change:size", @_updateKnob)
@knob.on("change:frame", @_updateFill)
@knob.on("change:frame", @_updateValue)
# Only update the value on move events, not on frame change (to prevent events loop)
@knob.on Events.Move, =>

This comment has been minimized.

@koenbok

koenbok May 10, 2016

Owner

Hmm you reverted this later, but there is a typo here, you don't call the function.
@_updateValue()

This comment has been minimized.

@eelco

eelco May 10, 2016

Collaborator

Hmm, good catch 😖 Maybe it wasn’t a bad fix then after all. I reverted because I realized I might have broken a lot of stuff when I started testing some examples.

The question is mainly what’s desired behavior: should the SliderComponent emit change events when the knob is programatically, or not? The case for not doing it is that usually you don’t need the event, because you actually changed it (you could still force the event if needed) and that it can cause problems in the case of using the slider as a progress bar for audio/video players.

@_updateValue
@sliderOverlay.on(Events.TapStart, @_touchStart)
@sliderOverlay.on(Events.TapEnd, @_touchEnd)

0 comments on commit 0e4aac0

Please sign in to comment.