Skip to content

Commit 659da66

Browse files
authored
feat: make it easier to leave adding annotation mode on sample details (#5)
1 parent fead477 commit 659da66

File tree

4 files changed

+8
-148
lines changed

4 files changed

+8
-148
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010

1111
### Changed
12+
- Pressing Escape while adding an annotation now cancels add-annotation mode.
1213

1314
### Deprecated
1415

lightly_studio_view/src/lib/components/SampleDetails/SampleDetails.svelte

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,13 @@
137137
switch (event.key) {
138138
// Check for escape key
139139
case get(settingsStore).key_go_back:
140-
handleEscape();
140+
if ($isEditingMode) {
141+
if (addAnnotationEnabled) {
142+
addAnnotationEnabled = false;
143+
}
144+
} else {
145+
handleEscape();
146+
}
141147
break;
142148
// Add spacebar handling for selection toggle
143149
case ' ': // Space key

lightly_studio_view/src/lib/hooks/useKeyboardShortcuts.ts

Lines changed: 0 additions & 141 deletions
This file was deleted.

lightly_studio_view/src/routes/datasets/[dataset_id]/+layout.svelte

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import Segment from '$lib/components/Segment/Segment.svelte';
2323
import { useFeatureFlags } from '$lib/hooks/useFeatureFlags/useFeatureFlags';
2424
import { useHideAnnotations } from '$lib/hooks/useHideAnnotations';
25-
import { defaultShortcuts, useKeyboardShortcuts } from '$lib/hooks/useKeyboardShortcuts';
2625
import { useAnnotationLabels } from '$lib/hooks/useAnnotationLabels/useAnnotationLabels';
2726
import { useDimensions } from '$lib/hooks/useDimensions/useDimensions';
2827
import {
@@ -71,11 +70,6 @@
7170
}
7271
});
7372
74-
// Set up keyboard shortcuts using the hook
75-
useKeyboardShortcuts({
76-
goBack: defaultShortcuts.goBack
77-
});
78-
7973
const isSamples = $derived(isSamplesRoute(page.route.id));
8074
const isAnnotations = $derived(isAnnotationsRoute(page.route.id));
8175
const isSampleDetails = $derived(isSampleDetailsRoute(page.route.id));

0 commit comments

Comments
 (0)