-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add mesh actions to 3d viewport context menu #6813
Conversation
infoRows.push( | ||
<InfoMenuItem key="copy-cell"> | ||
<div className="cell-context-icon" /> | ||
Segment Name: {segmentName} |
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 am unsure how to indicate that this menu field displays the segment's name. First, I wrote Segment Name:
as a prefix. But this seems to be too long IMO. Therefore I replayed it with a name tag icon. Does this make sense? Do you have a better suggestion?
frontend/javascripts/oxalis/view/right-border-tabs/segments_tab/segment_list_item.tsx
Outdated
Show resolved
Hide resolved
I'll do the docs update and the changelog entry on Thursday (I think). But it should be ready for the 1st code review :) |
@philippotto If you think daniel has more time / is better suited for the review, please just assign him 🙏 |
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.
Code looks already quite good 👍 When the CI is green, I can test it on a dev instance :)
@@ -1090,15 +1188,29 @@ function ContextMenuInner(propsWithInputRef: Props) { | |||
); | |||
} | |||
|
|||
if (segmentIdAtPosition > 0) { | |||
if (segmentIdAtPosition > 0 || maybeClickedMeshId != null) { |
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.
Could it be that both are defined? Or is one case only for the data viewports and the second case only for the 3D viewport? If both were possible, the user wouldn't know which ID is shown, right?
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 is not possible that both are defined. The segmentId is calculated based upon the calculated global position of where the context menu is opened. The function used for that is _calculateMaybeGlobalPos. Thus in case of the 3d viewport, the segmentId will never be defined.
And the maybeClickedMeshI
can only be defined when the context menu is opened in the 3d viewport. Thus if on variable is defined / > 0
the other cannot. They exclude each other 🎉 .
I am personally not perfectly happy with my solution here, but other alternatives would me more code duplication. Thus I added a comment shortly explaining that only one of them can be defined.
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 is not possible that both are defined. The segmentId is calculated based upon the calculated global position of where the context menu is opened. The function used for that is _calculateMaybeGlobalPos. Thus in case of the 3d viewport, the segmentId will never be defined.
And the maybeClickedMeshI can only be defined when the context menu is opened in the 3d viewport. Thus if on variable is defined / > 0 the other cannot. They exclude each other tada .
Great 👍 Thanks for the explanation!
I am personally not perfectly happy with my solution here, but other alternatives would me more code duplication. Thus I added a comment shortly explaining that only one of them can be defined.
Yeah, I think, it's a good trade-off.
…-mesh-actions-to-3d-context-menu
Just gave it a whirl and it worked quite well 👍 Great work!
Do you know these circumstances? For me, it always worked on the first try 🤔
Two ideas:
One thing which caught my eye is this:
|
Yeah, it is actually hard to reproduce. For me, it always worked when I created an ad-hoc mesh in the zy viewport and then immediately hovered over a mesh in the 3d viewport without clicking anywhere and then opening the context menu. Then it says "no data" 🤷♂️.
This definitely shouldn't be the case. I'll investigate this :) |
…-mesh-actions-to-3d-context-menu
…ableminds/webknossos into add-mesh-actions-to-3d-context-menu
…ableminds/webknossos into add-mesh-actions-to-3d-context-menu
I fixed the bug and mentioned the new mesh-related context menu items in the docs |
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.
Awesome, works great 👍
…tarea * 'master' of github.com:scalableminds/webknossos: Add mesh actions to 3d viewport context menu (#6813)
* textarea: Add mesh actions to 3d viewport context menu (#6813)
This pr adds some mesh-related items to the context menu in the 3d viewport.
Note that finding/opening the mesh/segment of the mesh in the segments tab is not included, as this requires #5792 to be implemented. IMO this pr shouldn't wait for these changes as the current items are already valuable enough to be merged .
Note, that this pr is affected by bug #6814. (The context menu needs to be opened twice under certain circumstances)
URL of deployed dev instance (used for testing):
Steps to test:
Issues:
(Please delete unneeded items, merge only when none are left open)
- [ ] Updated (unreleased) migration guide if applicable- [ ] Adapted wk-connect if datastore API changes- [ ] Adapted wk-libs python client if relevant API parts change- [ ] Needs datastore update after deployment