Polygon Tool: Add + Delete Points#396
Polygon Tool: Add + Delete Points#396floryst merged 10 commits intoKitware:mainfrom PaulHax:polygon-add-delete-points
Conversation
✅ Deploy Preview for volview-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
After I drop a new Polygon handle, it is under the mouse. But the next click starts a new polygon instead of triggering a grab on the handle. WidgetManager only updates selection on mouse move. Is there a way to poke WidgetManger to run its |
|
Maybe unrelated, but I wonder if picking during animation will help here. I have some pending changes to the WidgetManager to support this. |
|
If the widget behavior could trigger an animation on left click and the handle under the mouse gets selected, that would do it. It might make sense to have just have "widgetManager.setSelectedWidget" so widget behaviors could trigger "dragging" state syncronously right after button down that placed a new widget? |
|
Would |
That would be perfect. Let me try. |
|
Regarding synchronously selecting/dragging a handle:
This was the right concept... and the right function was Still have a slight behavior bugaboo: Can't immidatly drag a handle after finishing a polygon without mouse movement. But this PR is ready for review. |
floryst
left a comment
There was a problem hiding this comment.
Will this be waiting for the LineGlyphRepresentation from your vtk.js PR?
Factor out watchState to ToolWidgetUtils
Calling model.widgetState.deactivate() in mouse up means we could not click and grab the handle again without first moving the mouse to re-activate the widget handle.
Would keep adding points if: 1. Clicked on a segment and drop handle. 2. Without moving mouse, click again. 3. Dropped another handle instead of grabbing current handle.
Double clicking anywhere on polygon would trigger finish placing logic.
|
Don't think we should wait for LineGlyphRepresentation PR to land in VTK.js. LineGlyphRepresentation files are idential now, we can switch over to VTK.js import latter. PR good to go... again. |
floryst
left a comment
There was a problem hiding this comment.
LGTM!
For the future, we will look into improving the WidgetManager's picking scenarios. Additionally, when we start supporting dragging annotations, adding points might become a right click context menu action.
|
Musings on WidgetManager picking, methinks we need to call this sometimes: Idea A: Let a widget explicitly trigger 'updateSelection' after it has done something (change camera, added/moved handle, etc) idea B: WidgetManager calls 'updateSelection' after animation or widget interaction end event fired by widget. Implict. Another note: took me a while to realize widgetModel.activeState is the currently hovered on handle. I was confused as it is manged/set by WidgetManager via activateHandle, even though widget behavor.js changes activeState as well. Maybe push WidgetManager does so much. Maybe extract the "when to Hardware Pick" logic into seperate code chunk which caches Hardware Picker results. WidgetManager observes CachedHardwarePicker. WidgetManager then just dispatches events to (focused?) widgets. Or something. |
Polygon Tool: Add + Delete Points
Left click polygon line to add a point. Right click a point to show delete point context menu.
TODO
Closes #388