Skip to content

Commit da40d2c

Browse files
Added selection state cleanup on annotating disabling
1 parent e6ef046 commit da40d2c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/text-annotator/src/SelectionHandler.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ export const createSelectionHandler = (
2727

2828
let currentAnnotatingEnabled = true;
2929

30-
const setAnnotatingEnabled = (enabled: boolean) => currentAnnotatingEnabled = enabled;
30+
const setAnnotatingEnabled = (enabled: boolean) => {
31+
currentAnnotatingEnabled = enabled;
32+
onSelectionChange.clear();
33+
34+
if (!enabled) {
35+
currentTarget = undefined;
36+
lastPointerDown = undefined;
37+
}
38+
};
3139

3240
const { store, selection } = state;
3341

0 commit comments

Comments
 (0)