Fix: IGUIContextMenu now raises sub-menu when they would otherwise be displayed below bottom-border of root gui element.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5558 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
c30590eeaf
commit
bb74f9034a
|
@ -1,6 +1,7 @@
|
|||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
|
||||
- Prevent initializing/quitting SDL several times when using more than one Irrlicht device.
|
||||
- Reduce log-messages for "loaded texture" and "loaded mesh" from ELL_INFORMATION to ELL_DEBUG.
|
||||
- Add IGUIButton::setOverrideColor to allow overriding text-color (same function as statictexts and editboxes have).
|
||||
- Add functions IGUIButton::getClickShiftState and IGUIButton::getClickControlState to get shift/ctrl key-state when a button was clicked. Thanks @StarSonata for patch.
|
||||
|
|
|
@ -668,16 +668,27 @@ void CGUIContextMenu::recalculateSize()
|
|||
|
||||
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 it would be drawn beyond the right border, then add it to the left side
|
||||
if ( getAbsolutePosition().UpperLeftCorner.X+subRect.LowerRightCorner.X > rectRoot.LowerRightCorner.X )
|
||||
{
|
||||
subRect.UpperLeftCorner.X = -w;
|
||||
subRect.LowerRightCorner.X = 0;
|
||||
}
|
||||
|
||||
// if it would be drawn below bottom border, move it up, but not further than to top.
|
||||
irr::s32 belowBottom = getAbsolutePosition().UpperLeftCorner.Y+subRect.LowerRightCorner.Y - rectRoot.LowerRightCorner.Y;
|
||||
if ( belowBottom > 0 )
|
||||
{
|
||||
irr::s32 belowTop = getAbsolutePosition().UpperLeftCorner.Y+subRect.UpperLeftCorner.Y;
|
||||
irr::s32 moveUp = belowBottom < belowTop ? belowBottom : belowTop;
|
||||
subRect.UpperLeftCorner.Y -= moveUp;
|
||||
subRect.LowerRightCorner.Y -= moveUp;
|
||||
}
|
||||
}
|
||||
|
||||
Items[i].SubMenu->setRelativePosition(subRect);
|
||||
|
|
Loading…
Reference in New Issue