Express tool position rectangle position consistently

Use tool position as offset from group position and not vice versa, both
because this was already done like this in the other places and because
this makes more sense: the tool is inside the group, so its position is
relative to it.

No real changes.
This commit is contained in:
Vadim Zeitlin
2021-01-10 19:26:33 +01:00
parent aed13bb9a9
commit 5c1a27488f

View File

@@ -439,7 +439,7 @@ wxRibbonToolBarToolBase* wxRibbonToolBar::GetToolByPos(wxCoord x, wxCoord y)cons
for ( size_t t = 0; t < tool_count; ++t ) for ( size_t t = 0; t < tool_count; ++t )
{ {
wxRibbonToolBarToolBase* tool = group->tools.Item(t); wxRibbonToolBarToolBase* tool = group->tools.Item(t);
wxRect rect(tool->position + group->position, tool->size); wxRect rect(group->position + tool->position, tool->size);
if(rect.Contains(x, y)) if(rect.Contains(x, y))
{ {
return tool; return tool;
@@ -535,7 +535,7 @@ wxRect wxRibbonToolBar::GetToolRect(int tool_id)const
wxRibbonToolBarToolBase* tool = group->tools.Item(t); wxRibbonToolBarToolBase* tool = group->tools.Item(t);
if (tool->id == tool_id) if (tool->id == tool_id)
{ {
return wxRect(tool->position + group->position, tool->size); return wxRect(group->position + tool->position, tool->size);
} }
++pos; ++pos;
} }