FyroxEngine / Fyrox

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

Improving behaviour of BringIntoView for ScrollPanel #638

Closed b-guild closed 2 months ago

b-guild commented 2 months ago

I have made BringIntoView more reliable by separating the handling for horizontal and vertical, and by preventing BringIntoView from scrolling beyond the usual scroll limits. This means that it won't try to scroll vertically so long as the item in question is within view vertically, even if the item may not be within view horizontally, and it won't try to scroll horizontally so long as the item is within view horizontally.

I have not been able to properly test horizontal scrolling, since the Fyroxed makes very little use of horizontal scrolling, if any, but by inspection it seems that it ought to work identically to vertical scrolling, and vertical scrolling certainly works better with these changes. Hopefully horizontal scrolling can be tested to confirm that there are no problems introduced by this change. This may require developing a custom test widget for the purpose of exercising horizontal scrolling.