libui: Propagate Container events only if they are in the child widget's rect
This commit is contained in:
parent
a023811c26
commit
5908b07ee2
@ -26,7 +26,8 @@ namespace ui
|
||||
|
||||
Result<EventResult> Container::handle_mouse_move(Point position)
|
||||
{
|
||||
return m_widget->handle_mouse_move(position);
|
||||
if (m_widget->rect().contains(position)) return m_widget->handle_mouse_move(position);
|
||||
return ui::EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<EventResult> Container::handle_mouse_leave()
|
||||
@ -36,12 +37,14 @@ namespace ui
|
||||
|
||||
Result<EventResult> Container::handle_mouse_down(Point position, int buttons)
|
||||
{
|
||||
return m_widget->handle_mouse_down(position, buttons);
|
||||
if (m_widget->rect().contains(position)) return m_widget->handle_mouse_down(position, buttons);
|
||||
return ui::EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<EventResult> Container::handle_mouse_up(Point position, int buttons)
|
||||
{
|
||||
return m_widget->handle_mouse_up(position, buttons);
|
||||
if (m_widget->rect().contains(position)) return m_widget->handle_mouse_up(position, buttons);
|
||||
return ui::EventResult::DidNotHandle;
|
||||
}
|
||||
|
||||
Result<void> Container::draw(Canvas& canvas)
|
||||
|
Loading…
Reference in New Issue
Block a user