Permalink
Browse files

Fix slider event emission

  • Loading branch information...
Benjamin den Boer
Benjamin den Boer committed Mar 2, 2017
1 parent 82f1159 commit 6d64ea94bc0378b9663b7d4e2319481c06f004d0
Showing with 10 additions and 2 deletions.
  1. +10 −2 framer/Components/RangedSliderComponent.coffee
@@ -112,21 +112,25 @@ class exports.RangedSliderComponent extends Layer
if clickedValue > @maxValue
@maxValue = clickedValue
@maxKnob.draggable._touchStart(event)
+ @emit(Events.SliderMaxValueChange, @maxValue)
if clickedValue < @minValue
@minValue = clickedValue
@minKnob.draggable._touchStart(event)
+ @emit(Events.SliderMinValueChange, @minValue)
else
clickedValue = @valueForPoint(Events.touchEvent(event).clientY - @screenScaledFrame().y) / @canvasScaleY() - offsetY
if clickedValue > @maxValue
@maxValue = clickedValue
@maxKnob.draggable._touchStart(event)
+ @emit(Events.SliderMaxValueChange, @maxValue)
if clickedValue < @minValue
@minValue = clickedValue
@minKnob.draggable._touchStart(event)
+ @emit(Events.SliderMinValueChange, @minValue)
@_updateValue()
@@ -284,8 +288,12 @@ class exports.RangedSliderComponent extends Layer
_updateValue: =>
@emit(Events.SliderValueChange)
- @emit(Events.SliderMinValueChange, @minValue)
- @emit(Events.SliderMaxValueChange, @maxValue)
+
+ if @minKnob.draggable.isMoving
+ @emit(Events.SliderMinValueChange, @minValue)
+
+ if @maxKnob.draggable.isMoving
+ @emit(Events.SliderMaxValueChange, @maxValue)
# Retrieve the point (x or y coordinate) of a certain numeric value.
pointForValue: (value) ->

0 comments on commit 6d64ea9

Please sign in to comment.