-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
masonry: reimplement
Widget::get_child_at_pos
(#565)
The `Widget::get_child_at_pos` has a default linear search implementation, upholding some conditions (e.g., picking the last child in "z-order" in case of overlap). Widgets can override this with a custom implementation (e.g., a widget with many children that maintains a quadtree to search through). Custom implementations should uphold the same conditions, we can add some debug assertions to check this in a later PR. This introduces a `QueryCtx`, allowing widget methods access to the global state, widget state, and widget subtree. `QueryCtx` is similar to the other (mutable) context types, but can be shared. This also changes `WidgetRef` to consist of a `Widget` and a `QueryCtx`, similar to `WidgetMut` consisting of a `Widget` and `MutateCtx`. This required changing where `WidgetRef` can be constructed. This resolves code comment https://github.com/linebender/xilem/blob/ac95f2524ac33fccd02f444b8a75ae0daaf98c3c/masonry/src/widget/widget_ref.rs#L192-L199
- Loading branch information
Showing
7 changed files
with
158 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.