-
Notifications
You must be signed in to change notification settings - Fork 373
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
More context menu 1: refactor #5392
Conversation
…with the 3 tasks of ContextMenuActions)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat framework, was fairly easy to follow which is a good sign (:
/// | ||
/// The default implementation delegates to [`Self::supports_multi_selection`] and | ||
/// [`Self::supports_item`]. | ||
fn supports_selection(&self, ctx: &ContextMenuContext<'_>) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kinda surprised there's only support and not a disable/enabled option. I suppose this could be later extended to return an enum that distinguises this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what you refer to by disabled/enabled? Bi-stable actions (like "Hide/Show"—which is now split into two separate actions btw)? Or actually displaying the action as disabled in the context menu (as opposed to no showing it at all)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like this hasn't come up yet, but I'd expect us to very soon have items that are displayed but disabled/greyed out because of some reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess. Well, it'll be easy to switch to an enum then :)
…5411) ### What As the title says ☝🏻 * Fixes #5299 Also adds a "no action available for this selection" notice that got lost in #5392. Makes it very easy to bump into: - #5410 https://github.com/rerun-io/rerun/assets/49431240/d3bafbf4-3755-4f6f-b236-bd1d022b172f #### Design decisions - The origin of the newly created space view is set to "/" - Alternative 1: set it to the clicked item. Strong reject: too arcane, different results for the same multi-selection depending on which item is actually clicked. - Alternative 2: set it to the common ancestor of all selected entities. Weak reject: less predictable, occasionally wrong (but works around some visualisable issue we have with some space views). - We show a list of suggested space view classes. - The list is the *intersection* of the suggested classes for each of the selected entities. - For each entity, the suggested classes are determined based on the *union* of suggested classes for the entity itself, *and for every entity of its subtree*. This enables meaningful suggestion when selecting a pure TreePrefix. - The newly created space view is selected. #### Known "phenomenons" - 2D space views are rarely suggested, because of the origin is set to "/" and that's outside of a pinhole transform. - TODO: issue number? - Text Document and Text Log are often suggested for time series scalar, because of the `Text` document. - Tensor is recommended but will (sometime?) display nothing, e.g. `structure_from_motion` -> `/camera/image` - If enabled, Dataframe is always the top-most suggested Space View, because of the lexicographic sorting. ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/5411/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/5411/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/5411/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/5411) - [Docs preview](https://rerun.io/preview/979f2768f87bd3e72b45c80ffd319b56661f138e/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/979f2768f87bd3e72b45c80ffd319b56661f138e/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
### What NOTE: review commit by commit (first commit is pure refactoring). Final PR in the series. This PR: - split `actions.rs` into many sub-files - fix capitalisation in some menu item - split the release check list in small checks Full series: - #5392 - #5397 - #5407 - #5411 - #5422 - #5433 - #5456 ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) * [x] I have tested the web demo (if applicable): * Using newly built examples: [app.rerun.io](https://app.rerun.io/pr/5456/index.html) * Using examples from latest `main` build: [app.rerun.io](https://app.rerun.io/pr/5456/index.html?manifest_url=https://app.rerun.io/version/main/examples_manifest.json) * Using full set of examples from `nightly` build: [app.rerun.io](https://app.rerun.io/pr/5456/index.html?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json) * [x] The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG * [x] If applicable, add a new check to the [release checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)! - [PR Build Summary](https://build.rerun.io/pr/5456) - [Docs preview](https://rerun.io/preview/a36360f586494f6648fdc4bbb9d806ab12911358/docs) <!--DOCS-PREVIEW--> - [Examples preview](https://rerun.io/preview/a36360f586494f6648fdc4bbb9d806ab12911358/examples) <!--EXAMPLES-PREVIEW--> - [Recent benchmark results](https://build.rerun.io/graphs/crates.html) - [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
What
More like a rewrite actually. This PR completely reorganise the way context menu actions are written and executed with two goals:
summarize_selection
mechanism was exposed to combinatorial explosion of possible item subset.impl
s, not dispatched in various functions such assummarize_selection
etc.All in all, this should ensure a O(1) effort to add new actions.
@ Reviewer: with the renames and rewrite, the diff a probably useless and this PR is best reviewed by directly looking at
context_menu/*.rs
.Checklist
main
build: app.rerun.ionightly
build: app.rerun.io