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-e03cc46cb475master
parent
bfb66d1494
commit
76b921b2c6
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue