fix Propagation mousewheel event in game

Propagation mousewheel event was introduce to have the opportunity to
parent handle this event if an only if the child doenst handle and the
parent set a handler for that event.
The error foundedd by elexis inside a game relay on the message waw
propagated outsie IGUIObjects to CGUI.cpp that shouldnt be at the
beggin. I forget to stop the propagation when all objects in the tree
was validated, because of that the message was propagate to CGUI.cpp
andd then hanle by camera.
the fix suggest to only propagate the event in the GUI tree, not outside
the GUI tree
This commit is contained in:
trompetin17
2024-11-05 13:07:41 -05:00
parent 73a3602475
commit 4e98704b71
+7 -2
View File
@@ -415,8 +415,13 @@ InReaction IGUIObject::SendMouseEvent(EGUIMessageType type, const CStr& eventNam
// inform to parents until get to the root object
// for now only wheel events are inform to parents
if (GetParent() && (type == GUIM_MOUSE_WHEEL_UP || type == GUIM_MOUSE_WHEEL_DOWN || type == GUIM_MOUSE_WHEEL_LEFT || type == GUIM_MOUSE_WHEEL_RIGHT) && msg.skipped)
msg.Skip(GetParent()->SendMouseEvent(type, eventName) == IN_PASS);
if ((type == GUIM_MOUSE_WHEEL_UP || type == GUIM_MOUSE_WHEEL_DOWN || type == GUIM_MOUSE_WHEEL_LEFT || type == GUIM_MOUSE_WHEEL_RIGHT) && msg.skipped)
{
if (GetParent())
msg.Skip(GetParent()->SendMouseEvent(type, eventName) == IN_PASS);
else
msg.Skip(false);
}
return msg.skipped ? IN_PASS : IN_HANDLED;
}