Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetScrollMaxX/Y return incorrect value #1271

Closed
degracode opened this issue Aug 7, 2017 · 4 comments
Closed

GetScrollMaxX/Y return incorrect value #1271

degracode opened this issue Aug 7, 2017 · 4 comments

Comments

@degracode
Copy link

They both subtract the scrollbar Size, when it should add instead:
return window->SizeContents.x - window->SizeFull.x + window->ScrollbarSizes.x;

If you call SetScrollX(GetScrollMaxX()), then the scrollbar will go almost to the end, but not quite.

If you drag a scrollbar all the way to its extent, you'll get the max value, eg 35. However GetScrollMaxX will return 3 basedon this maths:

window->SizeContents.x - window->SizeFull.x = 19
window->ScrollbarSizes.x = 16
19-16 = 3, but 19+16 = 35.

ocornut added a commit that referenced this issue Aug 7, 2017
@ocornut
Copy link
Owner

ocornut commented Aug 7, 2017

You are correct, fixed now. It wasn't extremely obvious because it requires the other scrollbar to notice. I also updated the demo to display more stuff and made the Begin code use those functions as it should have.

@ocornut
Copy link
Owner

ocornut commented Aug 7, 2017

Thanks :)

@degracode
Copy link
Author

Ah, thanks! I forgot to mention that I had both scroll-bars turned on.

@ocornut
Copy link
Owner

ocornut commented Aug 7, 2017

Closing. There's another bug (not directly related) right now when Horizontal Scrollbar is enabled and straddle the limit of a disabled Vertical Scrollbar it doesn't automatically enable the Vertical Scrollbar.

(PS: I'd be nice if you have screenshots from your game to share in the Gallery threads)

@ocornut ocornut closed this as completed Aug 7, 2017
ocornut added a commit that referenced this issue Aug 7, 2017
…bled Horizontal Scrollbar straddle the vertical limit. (#1271, #246)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants