Fix wxGenericTreeCtrl::ScrollTo() for all ports, not just wxOSX.
When scrolling down, make the item being scrolled into view completely visible instead of just showing its top part. The fix was already used for wxOSX but not for the other ports for some reason, do use it everywhere as this code is generic and behaves in the same way in all ports. Also fix the wrong comments about scrolling direction. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76014 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
b01d1a5e97
commit
b1273c0d8a
@ -2308,21 +2308,20 @@ void wxGenericTreeCtrl::ScrollTo(const wxTreeItemId &item)
|
||||
|
||||
if ( itemY + itemHeight > start_y*PIXELS_PER_UNIT + clientHeight )
|
||||
{
|
||||
// need to scroll up by enough to show this item fully
|
||||
// need to scroll down by enough to show this item fully
|
||||
itemY += itemHeight - clientHeight;
|
||||
#ifdef __WXOSX__
|
||||
|
||||
// because itemY below will be divided by PIXELS_PER_UNIT it may
|
||||
// be rounded down, with the result of the item still only being
|
||||
// partially visible, so make sure we are rounding up
|
||||
itemY += PIXELS_PER_UNIT-1;
|
||||
#endif
|
||||
itemY += PIXELS_PER_UNIT - 1;
|
||||
}
|
||||
else if ( itemY > start_y*PIXELS_PER_UNIT )
|
||||
{
|
||||
// item is already fully visible, don't do anything
|
||||
return;
|
||||
}
|
||||
//else: scroll down to make this item the top one displayed
|
||||
//else: scroll up to make this item the top one displayed
|
||||
|
||||
Scroll(-1, itemY/PIXELS_PER_UNIT);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user