TGUI builder 0.8.5 - missing vertical slider

  • 6 Replies
  • 41 Views
TGUI builder 0.8.5 - missing vertical slider
« on: 10 August 2019, 20:45:27 »
Hi. The option is missing. did it get removed from the builder?

Also; If possible, it would be nice if we could set the angles of scrollbars, sliders, etc.
« Last Edit: 10 August 2019, 20:47:44 by Hexile »

*

texus

  • *****
  • 1414
    • View Profile
    • Texus's Blog
Re: TGUI builder 0.8.5 - missing vertical slider
« Reply #1 on: 10 August 2019, 22:40:14 »
Quote
The option is missing.
You actually just have to set the Height to a larger value than the Width. I'll put on my todo list that I should add a property for it in the gui builder to make it more intuitive, because someone else recently had the same problem with a Slider and I agree that it isn't obvious at all.

Quote
Also; If possible, it would be nice if we could set the angles of scrollbars, sliders, etc.
When rotating over an angle other than 90° there is no more obvious definition about where the top left position actually is. There are multiple ways the scrollbar could be positioned after e.g. a 45° turn. I've never seen diagonal scrollbar, is there a use case that you have in mind where you would need to rotate it over such a non-standard angle?

Re: TGUI builder 0.8.5 - missing vertical slider
« Reply #2 on: 11 August 2019, 01:39:33 »
Quote
The option is missing.
You actually just have to set the Height to a larger value than the Width. I'll put on my todo list that I should add a property for it in the gui builder to make it more intuitive, because someone else recently had the same problem with a Slider and I agree that it isn't obvious at all.
Alright.

Quote
Also; If possible, it would be nice if we could set the angles of scrollbars, sliders, etc.
When rotating over an angle other than 90° there is no more obvious definition about where the top left position actually is. There are multiple ways the scrollbar could be positioned after e.g. a 45° turn. I've never seen diagonal scrollbar, is there a use case that you have in mind where you would need to rotate it over such a non-standard angle?

I do agree that beyond 45 degrees do not make sense, however, i'm interested in replicating the EQ sliders on an obscure hifi unit i saw a while back.
Instead of them being vertical |||||| they were slanted/angled like //////
« Last Edit: 11 August 2019, 01:54:48 by Hexile »

*

texus

  • *****
  • 1414
    • View Profile
    • Texus's Blog
Re: TGUI builder 0.8.5 - missing vertical slider
« Reply #3 on: 11 August 2019, 10:26:44 »
The problem isn't going beyond 45°, any angle that can't be divided by 90 is problematic. If an object has to be rotated, around what point should the rotation take place?
Imagine you have a slider of 400 pixels width and 20 pixels height. The slider is places on position (100, 100).
- If you rotate 90° clockwise around the top-left corner then the new top-left position will be at (80, 100).
- If you rotate around the center of the widget, a rotation of 90° will put the top left of the slider on position (290, -100).

What I do in TGUI is correct the offset and move it back to position (100, 100). In the first case (which is what TGUI uses), I simply add 20 pixels to the left position of the slider before the rotation even happens. After the rotation the slider will end up rotated 90° and at position (100,100), which is what the user asked for.

But what happens if you rotate by 45° (or even just 1°), what is the top left position then? I could take a bounding box around the entire widget, but that box would change size for every degree you rotate, so the result will be that the slider position is unpredictable and you have to experiment a bit to find the best position for the slider.

The only way that I see to properly support it, is if I let the user set the position of the center of the widget instead of the top left position. That way you could rotate around any angle and the center would remain on the same spot, hence the result of where the slider will end up would be is predictable.

Another problem is going to be detecting when the mouse is on top of the widget. Right now there are only a handful of widgets that can be rotated and the 90° rotation makes it easy to check the mouse position. If a widget can be freely rotated around any angle, checking when the mouse is on top of the widget (and on which part) gets more difficult.

So although the feature would be nice to have, I currently have no plans to add something like that in TGUI as it involves a lot of work.

Re: TGUI builder 0.8.5 - missing vertical slider
« Reply #4 on: 11 August 2019, 16:18:13 »
Supposedly, it could be made working using slider 2d and clamping the xpos to something determined by the ypos.
Or at least I think it should be...

I understand it wouldn't be easy to add full rotation support, but it's nice to hear your thoughts on that feature.

*

texus

  • *****
  • 1414
    • View Profile
    • Texus's Blog
Re: TGUI builder 0.8.5 - missing vertical slider
« Reply #5 on: 11 August 2019, 16:32:44 »
Actually the Slider2d widget no longer exists. In 0.7 it seems like it was still in an extra folder (together with AnimatedPicture and SpriteSheet), but these 3 "widgets" were removed in 0.8. They didn't fully fit in a gui library and I decided that I wasn't going to keep maintaining them (since every version update required rewriting a lot of code in all widgets).

It wouldn't really solve the issue with detecting where the mouse is. The Slider2d class just acted as one big rectangle and would absorb all mouse events in that area, even if your diagonal slider would only fill a small part of that area. The changes required to Slider2d are so large that you might as well just create a new widget for it

If anyone comes up with the necessary code to make rotation work then I would of course merge it, but I have no intention of writing it myself on short term.

Re: TGUI builder 0.8.5 - missing vertical slider
« Reply #6 on: 11 August 2019, 16:42:25 »
hmm, okay. It might be worth adding an "obsolete section" in the docs then, in case there is more things no longer supported.