Skip to content

Commit 4ea6808

Browse files
add new action to focus trees
1 parent 1fdf5ff commit 4ea6808

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

frontend/javascripts/viewer/model/actions/skeletontracing_actions.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ type SetTreeVisibilityAction = ReturnType<typeof setTreeVisibilityAction>;
2727
type SetExpandedTreeGroupsByKeysAction = ReturnType<typeof setExpandedTreeGroupsByKeysAction>;
2828
type SetExpandedTreeGroupsByIdsAction = ReturnType<typeof setExpandedTreeGroupsByIdsAction>;
2929
type ExpandParentGroupsOfTreeAction = ReturnType<typeof expandParentGroupsOfTreeAction>;
30+
type FocusTreeAction = ReturnType<typeof focusTreeAction>;
3031
type ToggleAllTreesAction = ReturnType<typeof toggleAllTreesAction>;
3132
type ToggleInactiveTreesAction = ReturnType<typeof toggleInactiveTreesAction>;
3233
type ToggleTreeGroupAction = ReturnType<typeof toggleTreeGroupAction>;
@@ -119,6 +120,7 @@ export type SkeletonTracingAction =
119120
| SetExpandedTreeGroupsByKeysAction
120121
| SetExpandedTreeGroupsByIdsAction
121122
| ExpandParentGroupsOfTreeAction
123+
| FocusTreeAction
122124
| ToggleInactiveTreesAction
123125
| ToggleTreeGroupAction
124126
| NoAction
@@ -401,6 +403,13 @@ export const expandParentGroupsOfTreeAction = (tree: Tree) =>
401403
tree,
402404
}) as const;
403405

406+
export const focusTreeAction = (tree: Tree) => {
407+
return {
408+
type: "FOCUS_TREE",
409+
tree,
410+
} as const;
411+
};
412+
404413
export const setTreeVisibilityAction = (treeId: number | null | undefined, isVisible: boolean) =>
405414
({
406415
type: "SET_TREE_VISIBILITY",

frontend/javascripts/viewer/model/reducers/skeletontracing_reducer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ function SkeletonTracingReducer(
558558
}
559559

560560
case "EXPAND_PARENT_GROUPS_OF_TREE": {
561-
console.log("Expanding parent groups of tree in reducer");
562561
const { tree } = action;
563562
if (tree.groupId == null || skeletonTracing == null) {
564563
return state;

frontend/javascripts/viewer/view/context_menu.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ import {
110110
deleteBranchpointByIdAction,
111111
deleteEdgeAction,
112112
expandParentGroupsOfTreeAction,
113+
focusTreeAction,
113114
mergeTreesAction,
114115
setActiveNodeAction,
115116
setTreeVisibilityAction,
@@ -624,6 +625,7 @@ function getNodeContextMenuOptions({
624625
key: "focus-tree",
625626
onClick: () => {
626627
Store.dispatch(expandParentGroupsOfTreeAction(clickedTree));
628+
Store.dispatch(focusTreeAction(clickedTree));
627629
},
628630
label: "Focus Tree in Skeleton Tab",
629631
}

frontend/javascripts/viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,7 @@ function TreeHierarchyView(props: Props) {
297297
// This is necessary outside of the useEffect hooks because a longer delay is needed to ensure the active tree has been rendered.
298298
setTimeout(scrollToActiveTree, 900);
299299

300-
useReduxActionListener("EXPAND_PARENT_GROUPS_OF_TREE", () => {
301-
console.log("EXPAND_PARENT_GROUPS_OF_TREE action received, scrolling to active tree");
302-
scrollToActiveTree();
303-
});
300+
useReduxActionListener("FOCUS_TREE", scrollToActiveTree);
304301

305302
return (
306303
<>

0 commit comments

Comments
 (0)