Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#3415 closed defect (fixed)

[PATCH] GUI - Dropdowns & Lists act as if scrollbar is visible, even if it's not

Reported by: elexis Owned by: elexis
Priority: Should Have Milestone: Alpha 19
Component: UI & Simulation Keywords:
Cc: Patch:

Description

Take a look at dropdownlists that might have scrollbars, but only have so few elements that the scrollbar is not required and therefore invisible.

If you hover an element of that list at the righthand side, then that item will not be selected, while it should be. CDropDown.cpp acts as if the scrollbar is present, even if it's not.

This is generally not a problem, but annoying for the color picker in #1580, where the elements only contain one character.

Attachments (4)

t3415_cleanup_dropdown_v1.patch (2.8 KB ) - added by elexis 9 years ago.
Simplifies existing code by reusing m_HideScrollBar.
t3415_fix_lists_invisible_scrollbar_v1.patch (13.6 KB ) - added by elexis 9 years ago.
Fixes the bug (48 lines of context to make reviewing easier).
without_patch.jpg (14.2 KB ) - added by elexis 9 years ago.
without_patch_after_resizing.jpg (4.2 KB ) - added by elexis 9 years ago.

Download all attachments as: .zip

Change History (18)

by elexis, 9 years ago

Simplifies existing code by reusing m_HideScrollBar.

by elexis, 9 years ago

Fixes the bug (48 lines of context to make reviewing easier).

comment:1 by elexis, 9 years ago

Keywords: patch review added
Milestone: BacklogAlpha 19
Summary: GUI - Dropdown list acts as if scrollbar is present, even if it's not[PATCH] GUI - Dropdowns & Lists act as if scrollbar is visible, even if it's not

A workaround would be to just add scrollbar="false" to the XML declaration.

comment:2 by elexis, 9 years ago

1) Reproduce selection-highlight-bug with DropDown:

  • Open gamesetup
  • Click on the Civ dropdown list
  • Hover over multiple civs at the righthand side (last 10 pixels)

=> Although the mouse cursor is clearly on that civ item, the selection highlight is not updated

2) Reproduce click-bug with DropDown:

  • Open gamesetup
  • Click on the Civ dropdown list
  • Try to select a civ by clicking on the righthand side (last 10 pixels)

=> Clicking won't have an effect

3) Reproduce click-bug with List:

  • Open lobby
  • Make sure only a few users are online, so that the scrollbar is invisible
  • Try to select a player by clicking on the right side (last 10 pixels)

=> Clicking won't have an effect

comment:3 by elexis, 9 years ago

Why the patch works:

  1. Bug is fixed by the first change in CDropDown.cpp
  2. Bug is fixed by the change in CList.cpp. The change in IGUIScrollBar.h introduces that used function. The change in CGUIScrollBarVertical.cpp doesn't change the logic, but simplifies the code by using that function again.
  1. Bug is fixed by the bugfix of 3. and the second change in CDropDown.cpp

comment:4 by elexis, 9 years ago

Milestone: Alpha 19Alpha 20

As mentioned above, #1580 has this bug and the workaround doesn't work around for 1600x1200. Since it does for lower resolutions and since probably nobody cares about the bug & patch in the next days, push it.

comment:5 by mimo, 9 years ago

Milestone: Alpha 20Alpha 19

keep it in A19 as it is a bug with an available fix, so someone may have time to look at it during FF.

comment:6 by Stan, 9 years ago

Owner: set to elexis

comment:8 by ffm, 9 years ago

in 4K resolution only the first 5 colors are selectable.

comment:9 by Josh, 9 years ago

Keywords: reviewed added; review removed

Looks good. Someone should commit this.

comment:10 by mimo, 9 years ago

Well, I tested it some time ago and was not fond of these narrower dropdown when scrollbars. It looks weird for me. Couldn't they be enlarged to fit the whole size ? I mean enlarging the active area instead of shrinking the area to the presently active one.

Last edited 9 years ago by mimo (previous) (diff)

by elexis, 9 years ago

Attachment: without_patch.jpg added

by elexis, 9 years ago

in reply to:  10 comment:11 by elexis, 9 years ago

Replying to mimo:

not fond of these narrower dropdown when scrollbars.

Not sure what you are talking about. The size of the dropdown list doesn't change at all with the patch. It only changes the behavior of when clicks/mouseovers are processed.

  • The part in GUIM_MOUSE_MOTION implements that hovering the mouse over the element works on the whole item area.
  • The two parts that update GUIM_MOUSE_PRESS_LEFT implement that clicking an element works on the whole item area.
  • The part in CGUIScrollBarVertical::Draw doesn't change the behavior at all, it is equivalent only beautifies the code.

Is this what you mean? The game already looks like this and my patch doesn't affect this.

http://trac.wildfiregames.com/raw-attachment/ticket/3415/without_patch.jpg


I noticed a different bug though. When you resize the window, the color picker dropdown element from #1580 will be messed up sometimes. In this screenshot I resized from 1280x1024 to something else and back to 1280x1024. Notice the last three elements are missing.

http://trac.wildfiregames.com/raw-attachment/ticket/3415/without_patch_after_resizing.jpg

This seems to be caused by the scrollbar="false" property of that playerColorPicker[n] element. It should be fixed for sure, but it has nothing to do with the patch.

comment:12 by mimo, 9 years ago

Yes, you are right. My problem was the one shown on your without_patch.jpg, I just noticed it when testing your patch and (wrongly) thought it was duer to it. So that's fine for me.

comment:13 by JoshuaJB, 8 years ago

Resolution: fixed
Status: newclosed

In 17149:

Fix #3415. Removes 'ghost' scrollbar bounding to enable extreme-right hover and selection in dropdowns. Patch by elexis.

comment:14 by Josh, 8 years ago

Keywords: patch reviewed removed

Thanks for the patch!

Note: See TracTickets for help on using tickets.