-
Notifications
You must be signed in to change notification settings - Fork 29
Voxel data pipette tool #8989
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
base: master
Are you sure you want to change the base?
Voxel data pipette tool #8989
Changes from all commits
958d146
7623cc5
47c9055
ecd45e7
78ea463
9c94cb0
0368512
7c2f373
a15000b
0117b86
b64d4d7
788787f
09bad02
eb98490
949940c
f9506a8
409784e
bbc4ecb
d1e7a4c
ae78342
9ae429e
c7bc32e
63d012e
7e37e28
11706bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,6 +208,7 @@ export class MoveToolController { | |
| _ctrlOrMetaKey: boolean, | ||
| altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| const { useLegacyBindings } = userConfiguration; | ||
| // In legacy mode, don't display a hint for | ||
|
|
@@ -377,6 +378,7 @@ export class SkeletonToolController { | |
| ctrlOrMetaKey: boolean, | ||
| altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| const { continuousNodeCreation } = Store.getState().userConfiguration; | ||
| const { useLegacyBindings } = userConfiguration; | ||
|
|
@@ -514,6 +516,7 @@ export class DrawToolController { | |
| _ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| let rightClick; | ||
| const { useLegacyBindings } = userConfiguration; | ||
|
|
@@ -574,6 +577,7 @@ export class EraseToolController { | |
| _ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| return { | ||
| leftDrag: `Erase (${activeTool === AnnotationTool.ERASE_BRUSH ? "Brush" : "Trace"})`, | ||
|
|
@@ -583,30 +587,59 @@ export class EraseToolController { | |
|
|
||
| static onToolDeselected() {} | ||
| } | ||
| export class PickCellToolController { | ||
| export class VoxelPipetteToolController { | ||
| static getPlaneMouseControls(_planeId: OrthoView): any { | ||
| return { | ||
| leftClick: (pos: Point2, _plane: OrthoView, _event: MouseEvent) => { | ||
| VolumeHandlers.handlePickCell(pos); | ||
| mouseMove: ( | ||
| _delta: Point2, | ||
| position: Point2, | ||
| plane: OrthoView | null | undefined, | ||
| event: MouseEvent, | ||
| ) => { | ||
| MoveHandlers.moveWhenAltIsPressed(_delta, position, plane, event); | ||
| }, | ||
| leftClick: (position: Point2, plane: OrthoView, event: MouseEvent) => { | ||
| if (event.shiftKey) { | ||
| VolumeHandlers.handlePickCell(position); | ||
| return; | ||
| } | ||
|
|
||
| const state = Store.getState(); | ||
| const lastMeasuredGlobalPosition = | ||
| state.uiInformation.measurementToolInfo.lastMeasuredPosition; | ||
|
|
||
| if (lastMeasuredGlobalPosition == null) { | ||
| const globalPosition = calculateGlobalPos(state, position, plane).floating; | ||
| Store.dispatch(setLastMeasuredPositionAction(globalPosition)); | ||
| } else { | ||
| Store.dispatch(hideMeasurementTooltipAction()); | ||
| } | ||
| Store.dispatch(setIsMeasuringAction(true)); | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| static onToolDeselected() { | ||
| Store.dispatch(hideMeasurementTooltipAction()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also add |
||
| } | ||
|
|
||
| static getActionDescriptors( | ||
| _activeTool: AnnotationTool, | ||
| _userConfiguration: UserConfiguration, | ||
| _shiftKey: boolean, | ||
| shiftKey: boolean, | ||
| _ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| return { | ||
| leftClick: "Pick Segment", | ||
| leftClick: | ||
| _activeToolWithoutModifiers === AnnotationTool.VOXEL_PIPETTE && !shiftKey | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without checking the code too deeply: |
||
| ? "Pin Tooltip" | ||
| : "Activate Segment ID", | ||
| rightClick: "Context Menu", | ||
| }; | ||
| } | ||
|
|
||
| static onToolDeselected() {} | ||
| } | ||
| export class FillCellToolController { | ||
| static getPlaneMouseControls(_planeId: OrthoView): any { | ||
|
|
@@ -630,6 +663,7 @@ export class FillCellToolController { | |
| _ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| return { | ||
| leftClick: "Fill Segment", | ||
|
|
@@ -709,6 +743,7 @@ export class BoundingBoxToolController { | |
| ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| return { | ||
| leftDrag: ctrlOrMetaKey ? "Move Bounding Boxes" : "Create/Resize Bounding Boxes", | ||
|
|
@@ -838,6 +873,7 @@ export class QuickSelectToolController { | |
| _ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| return { | ||
| leftDrag: shiftKey ? "Resize Rectangle symmetrically" : "Draw Rectangle around Segment", | ||
|
|
@@ -962,6 +998,7 @@ export class LineMeasurementToolController { | |
| _ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| return { | ||
| leftClick: "Left Click to measure distance", | ||
|
|
@@ -1041,6 +1078,7 @@ export class AreaMeasurementToolController { | |
| _ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| _isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| return { | ||
| leftDrag: "Drag to measure area", | ||
|
|
@@ -1114,6 +1152,7 @@ export class ProofreadToolController { | |
| ctrlOrMetaKey: boolean, | ||
| _altKey: boolean, | ||
| isTDViewportActive: boolean, | ||
| _activeToolWithoutModifiers: AnnotationTool, | ||
| ): ActionDescriptor { | ||
| const { isMultiSplitActive } = userConfiguration; | ||
|
|
||
|
|
@@ -1172,7 +1211,7 @@ const toolToToolController = { | |
| [AnnotationTool.ERASE_TRACE.id]: EraseToolController, | ||
| [AnnotationTool.ERASE_BRUSH.id]: EraseToolController, | ||
| [AnnotationTool.FILL_CELL.id]: FillCellToolController, | ||
| [AnnotationTool.PICK_CELL.id]: PickCellToolController, | ||
| [AnnotationTool.VOXEL_PIPETTE.id]: VoxelPipetteToolController, | ||
| [AnnotationTool.LINE_MEASUREMENT.id]: LineMeasurementToolController, | ||
| [AnnotationTool.AREA_MEASUREMENT.id]: AreaMeasurementToolController, | ||
| }; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Left click toggle leaves measuring=true after hiding.
When unpinning (hide), set measuring=false; otherwise the UI stays in “measuring” state.
if (lastMeasuredGlobalPosition == null) { const globalPosition = calculateGlobalPos(state, position, plane).floating; Store.dispatch(setLastMeasuredPositionAction(globalPosition)); } else { Store.dispatch(hideMeasurementTooltipAction()); + Store.dispatch(setIsMeasuringAction(false)); + return; } - Store.dispatch(setIsMeasuringAction(true)); + Store.dispatch(setIsMeasuringAction(true));📝 Committable suggestion
🤖 Prompt for AI Agents
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'd say the AI is correct here by solely reading the changes
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.
@MichaelBuessemeyer Thanks for confirming! You're absolutely right—the current implementation leaves
isMeasuring=trueeven after hiding the tooltip, which is incorrect.The fix is straightforward: when unpinning (the
elsebranch wherelastMeasuredGlobalPositionalready exists), we should dispatchsetIsMeasuringAction(false)to properly clear the measuring state. The suggested code change correctly handles both cases:The early
returnin the else branch is also good practice to make the control flow explicit and avoid the subsequentsetIsMeasuringAction(true)call.Feel free to apply the suggested fix! 🐰