Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split Layout::find_id, renaming to probe, try_probe #462

Merged
merged 4 commits into from
Dec 30, 2024
Merged

Split Layout::find_id, renaming to probe, try_probe #462

merged 4 commits into from
Dec 30, 2024

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented Dec 30, 2024

These methods differ slightly:

  • fn Layout::try_probe(coord) -> Option<Id> is auto-generated, returning None when !self.rect().contains(coord) otherwise calling self.probe(coord)
  • fn Layout::probe(coord) -> Id is customizable, returning either the result of try_probe on a child or self.id()

The former should not be customized (enforced by #[widget] macro). It is intended that only try_probe gets called, though there's no real issue with calling probe.

This change allows cleaner documentation and smaller implementations in user-defined widgets as well as enforcing that the method does not return None when self.rect().contains(coord).

@dhardy dhardy merged commit ce1576d into master Dec 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant