Permalink
Browse files

Fixing SliderComponent calculations when device is shown

  • Loading branch information...
nvh committed Oct 9, 2017
1 parent 0524216 commit bac4ce93cb575d523f5f646e97fdc4fad2c490dc
Showing with 10 additions and 4 deletions.
  1. +6 −2 framer/Components/RangeSliderComponent.coffee
  2. +4 −2 framer/Components/SliderComponent.coffee
@@ -104,7 +104,9 @@ class exports.RangeSliderComponent extends Layer
event.preventDefault()
if @width > @height
clickedValue = @valueForPoint((Events.touchEvent(event).clientX / @canvasScaleX()) - @screenScaledFrame().x)
touchX = Events.touchEvent(event).clientX - Screen.canvasFrame.x
scaleX = @canvasScaleX()
clickedValue = @valueForPoint(touchX / scaleX - @x)
if clickedValue > @maxValue
@maxValue = clickedValue
@@ -117,7 +119,9 @@ class exports.RangeSliderComponent extends Layer
@emit(Events.SliderMinValueChange, @minValue)
else
clickedValue = @valueForPoint((Events.touchEvent(event).clientY / @canvasScaleY()) - @screenScaledFrame().y)
touchY = Events.touchEvent(event).clientY - Screen.canvasFrame.y
scaleY = @canvasScaleY()
clickedValue = @valueForPoint(touchY / scaleY - @y)
if clickedValue > @maxValue
@maxValue = clickedValue
@@ -94,11 +94,13 @@ class exports.SliderComponent extends Layer
event.preventDefault()
if @width > @height
touchX = Events.touchEvent(event).clientX - Screen.canvasFrame.x
scaleX = @canvasScaleX()
@value = @valueForPoint((Events.touchEvent(event).clientX / scaleX) - @screenScaledFrame().x)
@value = @valueForPoint(touchX / scaleX - @x)
else
touchY = Events.touchEvent(event).clientY - Screen.canvasFrame.y
scaleY = @canvasScaleY()
@value = @valueForPoint((Events.touchEvent(event).clientY / scaleY) - @screenScaledFrame().y)
@value = @valueForPoint(touchY / scaleY - @y)
@knob.draggable._touchStart(event)
@_updateValue()

0 comments on commit bac4ce9

Please sign in to comment.