Skip to content

Commit 993dceb

Browse files
committed
Save and restore selection state when activating the merge tool.
1 parent 29d5daf commit 993dceb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/datasource/graphene/frontend.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3050,17 +3050,19 @@ class MergeSegmentsTool extends LayerTool<SegmentationUserLayer> {
30503050
);
30513051
// Switch selected layer to the layer associated with the tool
30523052
// to enable to place line tool. Swap back when deactivating.
3053-
const { selectedLayer } = this.layer.manager.root;
3053+
const { selectedLayer, selectionState } = this.layer.manager.root;
30543054
const previousSelectedLayer = selectedLayer.layer;
30553055
const previousSelectedLayerVisible = selectedLayer.visible;
30563056
const previousTool = tool.value;
30573057
selectedLayer.layer = this.layer.managedLayer;
30583058
selectedLayer.visible = true;
30593059
tool.value = lineTool;
3060+
const prevousSelectionState = selectionState.toJSON();
30603061
activation.registerDisposer(() => {
30613062
selectedLayer.layer = previousSelectedLayer;
30623063
selectedLayer.visible = previousSelectedLayerVisible;
30633064
tool.value = previousTool;
3065+
selectionState.restoreState(prevousSelectionState);
30643066
});
30653067
const { merges, autoSubmit } = mergeState;
30663068
const { body, header } =

0 commit comments

Comments
 (0)