Skip to content

Commit

Permalink
Merge pull request #155 from oleksandr-danylchenko/fix-previous-selec…
Browse files Browse the repository at this point in the history
…tion-cleanup

Added missing previous selection discard upon the new selection change
  • Loading branch information
rsimon authored Oct 14, 2024
2 parents 9ce6e88 + d1dddc9 commit 775f612
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/text-annotator/src/SelectionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ export const SelectionHandler = (
*/
if (store.getAnnotation(currentTarget.annotation)) {
store.updateTarget(currentTarget, Origin.LOCAL);
} else {
// Proper lifecycle management: clear the previous selection first...
selection.clear();
}
});

Expand Down Expand Up @@ -206,7 +209,7 @@ export const SelectionHandler = (
if (selected.length !== 1 || selected[0].id !== hovered.id) {
selection.userSelect(hovered.id, evt);
}
} else if (!selection.isEmpty()) {
} else {
selection.clear();
}
};
Expand Down

0 comments on commit 775f612

Please sign in to comment.