Commit 76b921b2 authored by cutealien's avatar cutealien

Draw sub-menues to the left side fi they would be outside main-window otherwise.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2866 dfc29bdd-3216-0410-991c-e03cc46cb475
parent bfb66d14
......@@ -651,9 +651,21 @@ void CGUIContextMenu::recalculateSize()
const s32 w = Items[i].SubMenu->getAbsolutePosition().getWidth();
const s32 h = Items[i].SubMenu->getAbsolutePosition().getHeight();
Items[i].SubMenu->setRelativePosition(
core::rect<s32>(width-5, Items[i].PosY,
width+w-5, Items[i].PosY+h));
core::rect<s32> subRect(width-5, Items[i].PosY, width+w-5, Items[i].PosY+h);
// if it would be drawn beyond the right border, then add it to the left side
gui::IGUIElement * root = Environment->getRootGUIElement();
if ( root )
{
core::rect<s32> rectRoot( root->getAbsolutePosition() );
if ( getAbsolutePosition().UpperLeftCorner.X+subRect.LowerRightCorner.X > rectRoot.LowerRightCorner.X )
{
subRect.UpperLeftCorner.X = -w;
subRect.LowerRightCorner.X = 0;
}
}
Items[i].SubMenu->setRelativePosition(subRect);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment