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 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.

andythenorth
andythenorth previously approved these changes Jan 13, 2019
Copy link
Contributor

@andythenorth 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 Jan 14, 2019
…scroll it to its very bottom.

This "prevents" the fast movement towards the bottom when holding down the mouse button.
@@ -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);
Copy link
Contributor Author

@J0anJosep J0anJosep Jan 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resizedropdown
Should I open another PR for this?

Copy link
Member

@LordAro LordAro Jan 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, is fine here

Copy link
Contributor Author

@J0anJosep J0anJosep Jan 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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> ?

Copy link
Member

@LordAro LordAro Jan 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants