Skip to content
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

add hotkey for split preview refresh #14

Draft
wants to merge 3 commits into
base: neuvue
Choose a base branch
from
Draft
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
13 changes: 13 additions & 0 deletions src/neuroglancer/segmentation_user_layer_with_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ function helper<TBase extends BaseConstructor>(Base: TBase) {
this.reloadAllManifests();
break;
}
case 'refresh-split-preview': {
this.refreshSplitPreview();
break;
}
case 'switch-multicut-group': {
if (this.tool.value === undefined ||
(!(this.tool.value instanceof PlaceGraphOperationMarkerTool))) {
Expand Down Expand Up @@ -574,6 +578,15 @@ function helper<TBase extends BaseConstructor>(Base: TBase) {
}
}

refreshSplitPreview() {
StatusMessage.showTemporaryMessage(`Refreshing split preview...`);
console.log(this.graphOperationLayerState)
// Remove previous preview

// let Preview = new SplitPreview(this, this.graphOperationLayerState.value!);
// Preview.button.click();
}

private lastDeselectionMessage: StatusMessage|undefined;
private lastDeselectionMessageExists = false;
rootSegmentChange(rootSegments: Uint64[]|null, added: boolean) {
Expand Down
1 change: 1 addition & 0 deletions src/neuroglancer/ui/default_input_event_bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function getDefaultGlobalBindings() {
map.set('keyp', 'refresh-all-meshes');
map.set('keyi', 'increase-segmentation-opacity');
map.set('keyx', 'dismiss-all-status-messages');
map.set('keyq', 'refresh-split-preview');
defaultGlobalBindings = map;
}
return defaultGlobalBindings;
Expand Down
3 changes: 2 additions & 1 deletion src/neuroglancer/ui/graph_multicut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ export class GraphOperationLayerView extends Tab {
/**
* Wrapper class for split preview UI logic
*/
class SplitPreview extends RefCounted {
export class SplitPreview extends RefCounted {
button: HTMLButtonElement;
private inPreviewMode = false;
private splitPreviewRenderLayers: SupervoxelRenderLayer[] = [];
Expand Down Expand Up @@ -809,6 +809,7 @@ class SplitPreview extends RefCounted {

public disablePreview =
() => {
console.log(this)
this.inPreviewMode = false;
this.revertPreviewButton();
// Remove preview render layers
Expand Down
3 changes: 2 additions & 1 deletion src/neuroglancer/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,8 @@ export class Viewer extends RefCounted implements ViewerState {
for (const action
of ['recolor', 'clear-segments', 'merge-selected', 'cut-selected',
'shatter-segment-equivalences', 'switch-multicut-group',
'decrease-segmentation-opacity', 'increase-segmentation-opacity', 'refresh-all-meshes']) {
'decrease-segmentation-opacity', 'increase-segmentation-opacity',
'refresh-all-meshes', 'refresh-split-preview']) {
this.bindAction(action, () => {
this.layerManager.invokeAction(action);
});
Expand Down