FyroxEngine / Fyrox

3D and 2D game engine written in Rust
https://fyrox.rs
MIT License
7.48k stars 339 forks source link

added code to make indicator size adaptive #628

Closed shyamjayakannan closed 2 months ago

shyamjayakannan commented 2 months ago

199

Added code to make the indicator (thumb) size of the scrollbar adaptive to the ScrollViewer. Behavior shown below:

https://github.com/FyroxEngine/Fyrox/assets/120047549/09f05263-d381-44eb-bd9a-a2d5a93085e4

I hope the behavior is as expected. But there is an issue: It seems to be working fine when the container is extended, but when it is shrunk below a certain size, the indicator's movement gets offset by a certain distance (can be seen in the video where the indicator doesn't touch the top arrow and extends below the bottom arrow)

Any help with this would be greatly appreciated. I hope this helps

Also, I have set the minimum size of the indicator to 15. Please let me know if this should be changed or handled differently.

mrDIMAS commented 2 months ago

The code looks nice, great job. The issue you described looks to be related to this https://github.com/FyroxEngine/Fyrox/blob/b45c90960c1292bd693a544eb7f10cf15ec29c4e/fyrox-ui/src/scroll_bar.rs#L588-L595 min size settings. I think it should be set to 15 too and the issue should disappear.

shyamjayakannan commented 2 months ago

Thank you so much @mrDIMAS . I have made the changes and everything looks fine.