libui: Propagate Container events only if they are in the child widget's rect
This commit is contained in:
parent
f0f1a9c46c
commit
2c7ae3c61b
@ -26,7 +26,8 @@ namespace ui
|
|||||||
|
|
||||||
Result<EventResult> Container::handle_mouse_move(Point position)
|
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()
|
Result<EventResult> Container::handle_mouse_leave()
|
||||||
@ -36,12 +37,14 @@ namespace ui
|
|||||||
|
|
||||||
Result<EventResult> Container::handle_mouse_down(Point position, int buttons)
|
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)
|
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)
|
Result<void> Container::draw(Canvas& canvas)
|
||||||
|
Loading…
Reference in New Issue
Block a user