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

Change #6060: Allow drawing dropdown lists with scrollbars above and fix scrolling movement #7056

Merged
merged 3 commits into from Jan 20, 2019

Conversation

@J0anJosep
Copy link
Contributor

J0anJosep commented Jan 13, 2019

Rewrite of the code for choosing where to open a dropdown.

With this patch, dropdown can be created above the opening widget and with scrollbar enabled.

In case of opening above and with scrollbar, list is moved to show the last items. Otherwise, if mouse button is held down, it starts scrolling down without moving the mouse.

Copy link
Contributor

andythenorth left a comment

With this applied, comboboxes scroll exactly as expected in all cases I tried.

I didn't test for any unexpected side effects of this elsewhere, dunno if they're possible / likely.

Nice fix.

@andythenorth andythenorth dismissed their stale review Jan 13, 2019

I only tested it, didn't review code, bit premature.

J0anJosep added 3 commits Oct 15, 2014
…it to its very bottom.

This "prevents" the fast movement towards the bottom when holding down the mouse button.
@J0anJosep J0anJosep force-pushed the J0anJosep:Dropdown branch from e711be9 to 8408e5a Jan 14, 2019
@@ -3516,8 +3516,9 @@ void ChangeVehicleViewports(VehicleID from_index, VehicleID to_index)
*/
void RelocateAllWindows(int neww, int newh)
{
Window *w;
DeleteWindowById(WC_DROPDOWN_MENU, 0);

This comment has been minimized.

Copy link
@J0anJosep

J0anJosep Jan 14, 2019

Author Contributor

resizedropdown
Should I open another PR for this?

This comment has been minimized.

Copy link
@LordAro

LordAro Jan 14, 2019

Member

Nah, is fine here

This comment has been minimized.

Copy link
@J0anJosep

J0anJosep Jan 14, 2019

Author Contributor

@LordAro
I saw your comment about:

i feel like max<uint> would be cleaner - no need to cast after the function call (+ available_height_above below)

... but cannot find it now on GitHub.
I think the parameters of the max function can be negative. I prefer making the cast after the max is calculated (it won't be negative). Is it really necessary to use max<uint> ?

This comment has been minimized.

Copy link
@LordAro

LordAro Jan 14, 2019

Member

I deleted it because I saw it was stupid, don't worry about it :)

@PeterN PeterN merged commit 9ce9252 into OpenTTD:master Jan 20, 2019
1 check passed
1 check passed
OpenTTD CI Build #20190116.7 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.