-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Context
uses WidgetRects
to store the rectangles of all widgets from the previous frame. Context::interact
uses this to check that no tother widget is covering the current widget.
This code could be simplified by doing the hit-test once at the start of the frame, using the WidgetRects
from the previous frame.
With full knowledge, we could to a smart hit-test where we look for all widget within a certain small radius of the pointer, and hover/click/drag the closest one. This allows for slightly bigger hit-boxes, making things easier to click. This could replace the current hack of growing hit boxes by item_spacing / 2
.
Note that we needs to find the top widget for clicks and for drags separately, because the top widget that is click-sensitive (e.g. a button) can be different from the top widget that is drag-sensitive (e.g. a ScrollArea).