Skip to content

fix: annotation shortcut not properly freed on deletion #567

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
10 changes: 6 additions & 4 deletions src/neuroglancer/annotation/user_layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ export class AnnotationUserLayer extends Base {
new LayerReference(this.manager.rootLayers.addRef(), isValidLinkedSegmentationLayer));
filterBySegmentation = new TrackableBoolean(false);
shortcutHandler = this.registerDisposer(new AnnotationShortcutHandler());
private keyShortcutModifier = 'shift+';
private keyShortcuts = ['q', 'w', 'e', 'r', 't', 'a', 's', 'd', 'f', 'g', 'z', 'x', 'c', 'v'];
private keyShortcuts = [
'shift+keyq', 'shift+keyw', 'shift+keye', 'shift+keyr', 'shift+keyt', 'shift+keya',
'shift+keys', 'shift+keyd', 'shift+keyf', 'shift+keyg', 'shift+keyz', 'shift+keyx',
'shift+keyc', 'shift+keyv'
];
private tagToShortcut: Map<number, string> = new Map<number, string>();
private _numTagsAllowed = this.keyShortcuts.length;

Expand Down Expand Up @@ -369,8 +372,7 @@ export class AnnotationUserLayer extends Base {

addAnnotationTagShortcut(tagId: number) {
const {localAnnotations, selectedAnnotation, shortcutHandler: shortcutHandlerViewer} = this;
const shortcutKey = this.keyShortcuts.splice(0, 1)[0];
const shortcutCode = this.keyShortcutModifier + 'key' + shortcutKey;
const shortcutCode = this.keyShortcuts.splice(0, 1)[0];
this.tagToShortcut.set(tagId, shortcutCode);
const addAnnotationTagToAnnotation = () => {
const reference = selectedAnnotation.reference;
Expand Down