Commit 88f41622 authored by cutealien's avatar cutealien

- bugfix (2796207): menu acted (wrongly) on left-click down instead of left-click up.

  Was reported by HackLeX in http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=33371
- Fixed problem with highlighting menus when mouse was outside sub-menu area. Made it work similar to 
firefox menus.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2403 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b02776af
...@@ -142,19 +142,35 @@ bool CGUIMenu::OnEvent(const SEvent& event) ...@@ -142,19 +142,35 @@ bool CGUIMenu::OnEvent(const SEvent& event)
if (!AbsoluteClippingRect.isPointInside(p)) if (!AbsoluteClippingRect.isPointInside(p))
{ {
shouldCloseSubMenu = false; shouldCloseSubMenu = false;
s32 t = sendClick(p);
if ((t==0 || t==1) && Environment->hasFocus(this))
Environment->removeFocus(this);
} }
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true); highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true);
if ( shouldCloseSubMenu ) if ( shouldCloseSubMenu )
closeAllSubMenus(); {
Environment->removeFocus(this);
}
return true; return true;
} }
case EMIE_LMOUSE_LEFT_UP:
{
core::position2d<s32> p(event.MouseInput.X, event.MouseInput.Y);
if (!AbsoluteClippingRect.isPointInside(p))
{
s32 t = sendClick(p);
if ((t==0 || t==1) && Environment->hasFocus(this))
Environment->removeFocus(this);
}
return true;
}
case EMIE_MOUSE_MOVED: case EMIE_MOUSE_MOVED:
if (Environment->hasFocus(this)) if (Environment->hasFocus(this) && HighLighted >= 0)
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), hasOpenSubMenu()); {
s32 oldHighLighted = HighLighted;
highlight(core::position2d<s32>(event.MouseInput.X, event.MouseInput.Y), true);
if ( HighLighted < 0 )
HighLighted = oldHighLighted; // keep last hightlight active when moving outside the area
}
return true; return true;
default: default:
break; break;
......
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