Inverted values with a drag slider


#1

I’ve been trying to create a slider that shows a number in a box based upon how much you drag on the y coordiate.

I’m nearly there! but the number in the box is not correct :frowning:

I want the value in the box inverted, so as you drag down the number decreases and as you drag upwards the number increases so it matches the graph coordinates. Any ideas?

demo.rp (1.4 MB)


#2

I think this is what you are looking for.

The formula for the dotsperinch value ends up being …

[[((((LineWidget.height-This.height) - (This.y-LineWidget.y))/(LineWidget.height-This.height))*160).toFixed(0)]]

Note - I also adjusted the size of the graph so that the arrow could go all the way to the top and all the way to the bottom

Hope this helps.

demo.rp (1.4 MB)


#3

I just noticed that clicking on the plus and minus bottoms is a bit broken. It doesn’t allow you to go all the way to the top or bottom but hopefully you can sort that out from here.


#4

@David_YOW Wow! Thanks so much for the solution, it works really well.

I don’t really understand it though :slight_smile:
If I write it out will you be able to explain how it works?

(LineWidget.height = Pixel height of the vertical line widget minus This.height)
What the ‘this.height’ refering to?

(This.y minus LineWidget.y))
Is the y, the y coordinate of the slider handle?


#5

This refers to whichever widget it’s present on.