Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#3391 closed defect (fixed)

[PATCH] Lists are sorted when clicking on the first item

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

Description

If you click 4 pixels below the header of a sortable OList, then the list will be sorted and the first item will be selected. But since you clicked below the header, it shouldn't sort - only select the first item.

The issue was introduced with the initial commit r16781 that implements sortable lists #2405 and is caused by adding those 4 pixels explicitly:

CPos leftTopCorner = m_CachedActualSize.TopLeft() + CPos(xpos, 4);

Setting that value to 0 solves the issue.

(Having greater or smaller column heights as defined in m_HeadingHeight(30.f) doesn't change the bug)

You can easily reproduce the issue with the playerlist in the lobby. But also the visual replay menu #3258 will suffer from this flaw.

Attachments (2)

t3391_fix_sortable_list_column_header_v1.patch (1.7 KB ) - added by elexis 9 years ago.
t3391_fix_sortable_list_column_header_v2.patch (7.2 KB ) - added by elexis 9 years ago.
Added comments. Those 4 pixels were added because the column header text was drawn 4 pixels below the start of the list header. But that doesn't mean that we need to extend the area where clicks are registered, which is defined by m_HeadingHeight(30.f), so removing those 4 pixels there is correct.

Download all attachments as: .zip

Change History (4)

by elexis, 9 years ago

Added comments. Those 4 pixels were added because the column header text was drawn 4 pixels below the start of the list header. But that doesn't mean that we need to extend the area where clicks are registered, which is defined by m_HeadingHeight(30.f), so removing those 4 pixels there is correct.

comment:1 by Itms, 9 years ago

Owner: set to Itms
Resolution: fixed
Status: newclosed

In 16976:

Fix wrong offset when clicking too close to the header of sortable lists. Also added some code comments.
Patch by elexis, fixes #3391

comment:2 by Itms, 9 years ago

Component: Core engineUI & Simulation
Keywords: review removed

Nice catch, thanks for fixing this bug :)

Note: See TracTickets for help on using tickets.