mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-12 22:22:55 +00:00
GWidget: Add a flag to ignore greediness in GWidget::hit_test()
Normally if a GWidget has the is_greedy_for_hits() flag set, all hit tests will hit the widget itself instead of its descendants. Sometimes it may be desirable to override this behavior, and so this flag now allows you to do that.
This commit is contained in:
parent
a77814bdee
commit
ce44d9a32f
Notes:
sideshowbarker
2024-07-19 12:03:52 +09:00
Author: https://github.com/awesomekling
Commit: ce44d9a32f
2 changed files with 4 additions and 3 deletions
|
@ -333,9 +333,9 @@ GWidget* GWidget::child_at(const Point& point) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GWidget::HitTestResult GWidget::hit_test(const Point& position)
|
||||
GWidget::HitTestResult GWidget::hit_test(const Point& position, ShouldRespectGreediness should_respect_greediness)
|
||||
{
|
||||
if (is_greedy_for_hits())
|
||||
if (should_respect_greediness == ShouldRespectGreediness::Yes && is_greedy_for_hits())
|
||||
return { this, position };
|
||||
if (auto* child = child_at(position))
|
||||
return child->hit_test(position - child->relative_position());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue