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
14 changes: 14 additions & 0 deletions src/layer/segmentation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import {
SKELETON_GO_ROOT,
SKELETON_GO_UNFINISHED,
SKELETON_REDO,
SKELETON_TOGGLE_HIDDEN,
SKELETON_UNDO,
} from "#src/skeleton/actions.js";
import type {
Expand Down Expand Up @@ -1088,6 +1089,8 @@ export class SegmentationUserLayer extends Base {
x === undefined ? undefined : parseUint64(x),
);

private savedHiddenObjectAlpha: number | undefined;

constructor(managedLayer: Borrowed<ManagedUserLayer>) {
super(managedLayer);
this.codeVisible.changed.add(this.specificationChanged.dispatch);
Expand Down Expand Up @@ -2071,6 +2074,17 @@ export class SegmentationUserLayer extends Base {
}
break;
}
case SKELETON_TOGGLE_HIDDEN: {
const { hiddenObjectAlpha } = this.displayState;
if (this.savedHiddenObjectAlpha !== undefined) {
hiddenObjectAlpha.value = this.savedHiddenObjectAlpha;
this.savedHiddenObjectAlpha = undefined;
} else {
this.savedHiddenObjectAlpha = hiddenObjectAlpha.value;
hiddenObjectAlpha.value = 0;
}
break;
}
case SKELETON_GO_ROOT:
case SKELETON_GO_BRANCH_START:
case SKELETON_GO_BRANCH_END:
Expand Down
3 changes: 3 additions & 0 deletions src/skeleton/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ export const SKELETON_ENTER_CREATE = "skeleton-enter-create";
export const SKELETON_PIN_NODE = "skeleton-pin-node";
export const SKELETON_DELETE_NODE = "skeleton-delete-node";
export const SKELETON_CLEAR_SELECTION = "skeleton-clear-node-selection";

// --- Display toggles ---
export const SKELETON_TOGGLE_HIDDEN = "skeleton-toggle-hidden";
2 changes: 2 additions & 0 deletions src/ui/default_input_event_bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
SKELETON_PIN_NODE,
SKELETON_REDO,
SKELETON_REROOT,
SKELETON_TOGGLE_HIDDEN,
SKELETON_TOGGLE_TRUE_END,
SKELETON_UNDO,
} from "#src/skeleton/actions.js";
Expand Down Expand Up @@ -64,6 +65,7 @@ export function getDefaultGlobalBindings() {

map.set("keyn", "add-layer");
map.set("keyh", "help");
map.set("keyg", SKELETON_TOGGLE_HIDDEN);

map.set("space", "toggle-layout");
map.set("shift+space", "toggle-layout-alternative");
Expand Down
3 changes: 2 additions & 1 deletion src/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import {
SKELETON_GO_ROOT,
SKELETON_GO_UNFINISHED,
SKELETON_REDO,
SKELETON_TOGGLE_HIDDEN,
SKELETON_UNDO,
} from "#src/skeleton/actions.js";
import { StatusMessage } from "#src/status.js";
Expand Down Expand Up @@ -1077,7 +1078,7 @@ export class Viewer extends RefCounted implements ViewerState {
* Called once by the constructor to register the action listeners.
*/
private registerActionListeners() {
for (const action of ["recolor", "clear-segments"]) {
for (const action of ["recolor", "clear-segments", SKELETON_TOGGLE_HIDDEN]) {
this.bindAction(action, () => {
this.layerManager.invokeAction(action);
});
Expand Down