From 58256b6d1e026e483b532454285148d1040d8c9e Mon Sep 17 00:00:00 2001 From: Skier23 Date: Tue, 23 Jan 2024 21:10:06 -0500 Subject: [PATCH 1/6] Add next and previous hotkeys --- web/libs/editor/src/core/settings/keymap.json | 18 +++++++--- web/libs/editor/src/stores/AppStore.js | 34 +++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/web/libs/editor/src/core/settings/keymap.json b/web/libs/editor/src/core/settings/keymap.json index d5a5af261525..23923a07a617 100644 --- a/web/libs/editor/src/core/settings/keymap.json +++ b/web/libs/editor/src/core/settings/keymap.json @@ -7,19 +7,19 @@ "audio:playpause": { }, - "ts:grow-left":{ + "ts:grow-left": { "key": "left", "description": "Increase region to the left" }, - "ts:grow-right":{ + "ts:grow-right": { "key": "right", "description": "Increase region to the right" }, - "ts:shrink-left":{ + "ts:shrink-left": { "key": "alt+left", "description": "Decrease region on the left" }, - "ts:shrink-right":{ + "ts:shrink-right": { "key": "alt+right", "description": "Decrease region on the right" }, @@ -45,6 +45,16 @@ "mac": "alt+enter", "description": "Skip task" }, + "annotation:next": { + "key": "ctrl+right", + "mac": "command+right", + "description": "Next annotation" + }, + "annotation:previous": { + "key": "ctrl+left", + "mac": "command+left", + "description": "Previous annotation" + }, "annotation:undo": { "key": "ctrl+z", "mac": "command+z", diff --git a/web/libs/editor/src/stores/AppStore.js b/web/libs/editor/src/stores/AppStore.js index 4f4f48c86bf2..948e520fef41 100644 --- a/web/libs/editor/src/stores/AppStore.js +++ b/web/libs/editor/src/stores/AppStore.js @@ -363,6 +363,40 @@ export default types }); } + /** + * Hotkey for next annotation + */ + if (self.hasInterface('submit', 'update', 'review')) { + hotkeys.addNamed('annotation:next', () => { + const annotationStore = self.annotationStore; + + if (annotationStore.viewingAll) return; + + const entity = annotationStore.selected; + + entity?.submissionInProgress(); + + self.nextTask() + }); + } + + /** + * Hotkey for previous annotation + */ + if (self.hasInterface('submit', 'update', 'review')) { + hotkeys.addNamed('annotation:previous', () => { + const annotationStore = self.annotationStore; + + if (annotationStore.viewingAll) return; + + const entity = annotationStore.selected; + + entity?.submissionInProgress(); + + self.prevTask() + }); + } + /** * Hotkey for delete */ From 35500c36543027c86f889076a75bf404aea18ff1 Mon Sep 17 00:00:00 2001 From: Skier23 Date: Wed, 24 Jan 2024 12:14:14 -0500 Subject: [PATCH 2/6] feat: issue-2311: Add Next and Previous hotkeys for annotations --- web/libs/editor/src/stores/AppStore.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/web/libs/editor/src/stores/AppStore.js b/web/libs/editor/src/stores/AppStore.js index 948e520fef41..36634976318f 100644 --- a/web/libs/editor/src/stores/AppStore.js +++ b/web/libs/editor/src/stores/AppStore.js @@ -372,14 +372,9 @@ export default types if (annotationStore.viewingAll) return; - const entity = annotationStore.selected; - - entity?.submissionInProgress(); - self.nextTask() }); } - /** * Hotkey for previous annotation */ @@ -389,14 +384,9 @@ export default types if (annotationStore.viewingAll) return; - const entity = annotationStore.selected; - - entity?.submissionInProgress(); - self.prevTask() }); } - /** * Hotkey for delete */ From 42f42e797dc4e204b8e7dee058177b83d7602ab3 Mon Sep 17 00:00:00 2001 From: Skier23 Date: Wed, 24 Jan 2024 14:16:06 -0500 Subject: [PATCH 3/6] feat: issue-2311: Make focus next and focus previous actually go to the next/previous items --- .../src/components/MainView/DataView/DataView.js | 6 ++++-- .../src/components/MainView/DataViewOld/Table.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/web/libs/datamanager/src/components/MainView/DataView/DataView.js b/web/libs/datamanager/src/components/MainView/DataView/DataView.js index 544abce283b4..3209f7664cca 100644 --- a/web/libs/datamanager/src/components/MainView/DataView/DataView.js +++ b/web/libs/datamanager/src/components/MainView/DataView/DataView.js @@ -313,7 +313,8 @@ export const DataView = injector( const task = dataStore.focusPrev(); - if (isFF(FF_DEV_4008)) getRoot(view).startLabeling(task); + // additional way to accomplish the same goal + getRoot(view).startLabeling(task); }); useShortcut("dm.focus-next", () => { @@ -321,7 +322,8 @@ export const DataView = injector( const task = dataStore.focusNext(); - if (isFF(FF_DEV_4008)) getRoot(view).startLabeling(task); + // additional way to accomplish the same goal + getRoot(view).startLabeling(task); }); useShortcut("dm.close-labeling", () => { diff --git a/web/libs/datamanager/src/components/MainView/DataViewOld/Table.js b/web/libs/datamanager/src/components/MainView/DataViewOld/Table.js index 5f696544bae5..fba87a3fc7a6 100644 --- a/web/libs/datamanager/src/components/MainView/DataViewOld/Table.js +++ b/web/libs/datamanager/src/components/MainView/DataViewOld/Table.js @@ -314,7 +314,8 @@ export const DataView = injector( const task = dataStore.focusPrev(); - if (isFF(FF_DEV_4008)) getRoot(view).startLabeling(task); + // additional way to accomplish the same goal + getRoot(view).startLabeling(task); }); useShortcut("dm.focus-next", () => { @@ -322,7 +323,8 @@ export const DataView = injector( const task = dataStore.focusNext(); - if (isFF(FF_DEV_4008)) getRoot(view).startLabeling(task); + // additional way to accomplish the same goal + getRoot(view).startLabeling(task); }); useShortcut("dm.close-labeling", () => { From 14e890b97cc3f73ba42fb30629820d2715021323 Mon Sep 17 00:00:00 2001 From: Skier23 Date: Wed, 24 Jan 2024 15:28:19 -0500 Subject: [PATCH 4/6] find highlighted id reverting bug --- web/libs/datamanager/src/mixins/DataStore/DataStore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/libs/datamanager/src/mixins/DataStore/DataStore.js b/web/libs/datamanager/src/mixins/DataStore/DataStore.js index 58b11d86c65b..4925f9d387f2 100644 --- a/web/libs/datamanager/src/mixins/DataStore/DataStore.js +++ b/web/libs/datamanager/src/mixins/DataStore/DataStore.js @@ -253,8 +253,9 @@ export const DataStore = ( associatedList, }); + // There's a bug in the listIncludes logic here. It nullifies the highlighed id when it shouldnt if (isDefined(highlightedID) && !listIncludes(self.list, highlightedID)) { - self.highlighted = null; + //self.highlighted = null; } self.postProcessData?.(data); From 8e41fbc7053a756f59783f3aea94adaf55a7960c Mon Sep 17 00:00:00 2001 From: skier233 Date: Sun, 14 Jul 2024 13:23:40 -0400 Subject: [PATCH 5/6] address pr comments --- web/libs/editor/src/stores/AppStore.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/web/libs/editor/src/stores/AppStore.js b/web/libs/editor/src/stores/AppStore.js index b93d0c9782cc..2cc6cbe45ee3 100644 --- a/web/libs/editor/src/stores/AppStore.js +++ b/web/libs/editor/src/stores/AppStore.js @@ -372,10 +372,10 @@ export default types } /** - * Hotkey for next annotation + * Hotkey for next task */ if (self.hasInterface('submit', 'update', 'review')) { - hotkeys.addNamed('annotation:next', () => { + hotkeys.addNamed('task:next', () => { const annotationStore = self.annotationStore; if (annotationStore.viewingAll) return; @@ -384,10 +384,10 @@ export default types }); } /** - * Hotkey for previous annotation + * Hotkey for previous task */ if (self.hasInterface('submit', 'update', 'review')) { - hotkeys.addNamed('annotation:previous', () => { + hotkeys.addNamed('task:previous', () => { const annotationStore = self.annotationStore; if (annotationStore.viewingAll) return; From 0460acee73acfac10aa84beb94d0041a296a6ae3 Mon Sep 17 00:00:00 2001 From: skier233 Date: Mon, 29 Jul 2024 18:23:12 -0400 Subject: [PATCH 6/6] improvements to next and previous in dataview --- web/libs/datamanager/src/sdk/keymap.ts | 4 ++-- web/libs/editor/src/stores/AppStore.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/libs/datamanager/src/sdk/keymap.ts b/web/libs/datamanager/src/sdk/keymap.ts index d4daebf54018..c2dfb5f6e07e 100644 --- a/web/libs/datamanager/src/sdk/keymap.ts +++ b/web/libs/datamanager/src/sdk/keymap.ts @@ -1,11 +1,11 @@ export const keymap = { "dm.focus-previous": { title: "Focus previous task", - shortcut: "shift+up", + shortcut: "ctrl+left", }, "dm.focus-next": { title: "Focus previous task", - shortcut: "shift+down", + shortcut: "ctrl+right", }, "dm.close-labeling": { title: "Focus previous task", diff --git a/web/libs/editor/src/stores/AppStore.js b/web/libs/editor/src/stores/AppStore.js index 2cc6cbe45ee3..45b25be23ce9 100644 --- a/web/libs/editor/src/stores/AppStore.js +++ b/web/libs/editor/src/stores/AppStore.js @@ -374,7 +374,7 @@ export default types /** * Hotkey for next task */ - if (self.hasInterface('submit', 'update', 'review')) { + if (self.hasInterface("skip", "review")) { hotkeys.addNamed('task:next', () => { const annotationStore = self.annotationStore; @@ -386,7 +386,7 @@ export default types /** * Hotkey for previous task */ - if (self.hasInterface('submit', 'update', 'review')) { + if (self.hasInterface("skip", "review")) { hotkeys.addNamed('task:previous', () => { const annotationStore = self.annotationStore;