Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,22 @@ export function handlePickCellFromGlobalPosition(
if (segmentId === 0) {
return;
}
Store.dispatch(setActiveCellAction(segmentId, globalPos, additionalCoordinates));

const visibleSegmentationLayer = getVisibleSegmentationLayer(Store.getState());

const positionInLayerSpace =
visibleSegmentationLayer != null
? globalToLayerTransformedPosition(
globalPos,
visibleSegmentationLayer.name,
"segmentation",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was a little confused by the plain string "segmentation" here at first. @philippotto Do we maybe want to refactor this into an enum, so we can write something like LayerType.Segmentation or so? This would have made this upon first read easier to understand / not stumble upon.

=> But this refacoring shouldn't be done here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, this comment slipped through in my mail box. yes, sounds like a good idea. we should be careful about the naming though. I think, it's often called "category".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I opened a short issue fore this: #9035

Store.getState(),
)
: null;

Store.dispatch(
setActiveCellAction(segmentId, positionInLayerSpace || globalPos, additionalCoordinates),
);

if (visibleSegmentationLayer == null) {
return;
}
Expand Down
6 changes: 5 additions & 1 deletion frontend/javascripts/viewer/view/context_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,11 @@ function getNoNodeContextMenuOptions(props: NoNodeContextMenuProps): ItemType[]
key: "select-cell",
onClick: () => {
Store.dispatch(
setActiveCellAction(segmentIdAtPosition, globalPosition, additionalCoordinates),
setActiveCellAction(
segmentIdAtPosition,
positionInLayerSpace || globalPosition,
additionalCoordinates,
),
);
},
disabled:
Expand Down
3 changes: 3 additions & 0 deletions unreleased_changes/9017.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed
- Double-clicking a registered segment now stores its position in the segment's layer coordinate system, preserving correct behaviour when layer transforms are in use.