Better vertical navigation in dynamic ribbon

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5167 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-04-11 17:21:46 +00:00
parent a009b2ef6c
commit ce1f3fed61

View File

@ -604,7 +604,10 @@ void DynamicRibbonWidget::propagateSelection()
if (selected_ribbon == NULL) continue;
const int relative_selection = selected_ribbon->m_selection[p];
const float where = (float)relative_selection / (float)(selected_ribbon->m_children.size() - 1);
assert(where >= 0.0f);
assert(where <= 1.0f);
if (m_combo)
{
m_selected_item[p] = relative_selection + m_scroll_offset;
@ -618,7 +621,7 @@ void DynamicRibbonWidget::propagateSelection()
RibbonWidget* ribbon = m_rows.get(n);
if (ribbon != selected_ribbon)
{
ribbon->m_selection[p] = std::min(relative_selection, ribbon->m_children.size()-1);
ribbon->m_selection[p] = (int)round(where*(ribbon->m_children.size()-1));
ribbon->updateSelection();
}
}