Fixed a scrolling of the selected item in ObjectList (SPE-849)

This commit is contained in:
YuSanka 2019-03-07 15:26:19 +01:00
parent 000a60e198
commit ef3482a427

View file

@ -1928,11 +1928,23 @@ void ObjectList::update_selections()
select_items(sels);
/* Because of ScrollLines() and GetItemRect() functions are implemented
* only for GENERIC DataViewCtrl in current version of wxWidgets,
* use this part of code only for MSW
*/
#if defined(wxUSE_GENERICDATAVIEWCTRL)
// Scroll selected Item in the middle of an object list
if (GetSelection()) {
const int sel_item_row = m_objects_model->GetRowByItem(GetSelection());
ScrollLines(sel_item_row - m_selected_row);
m_selected_row = sel_item_row;
const wxRect& sel_rc = GetItemRect(GetSelection());
const wxRect& main_rc = GetClientRect();
if (sel_rc.GetBottom() <= main_rc.GetTop()+sel_rc.height ||
sel_rc.GetTop() >= main_rc.GetBottom() )
{
const wxRect& top_rc = GetItemRect(GetTopItem());
ScrollLines(int((sel_rc.y - top_rc.y) / top_rc.GetHeight()) - 0.5*GetCountPerPage());
}
}
#endif
}
void ObjectList::update_selections_on_canvas()