Skip to content

Commit

Permalink
Added selection state cleanup on annotating disabling
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-danylchenko committed Aug 28, 2024
1 parent e6ef046 commit dae32c7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/text-annotator/src/SelectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ export const createSelectionHandler = (

let currentAnnotatingEnabled = true;

const setAnnotatingEnabled = (enabled: boolean) => currentAnnotatingEnabled = enabled;
const setAnnotatingEnabled = (enabled: boolean) => {
currentAnnotatingEnabled = enabled;

if (!enabled) {
currentTarget = undefined;
lastPointerDown = undefined;

onSelectionChange.clear();
}
};

const { store, selection } = state;

Expand Down

0 comments on commit dae32c7

Please sign in to comment.