From ae07174ea5609987e06d738906659691d4e696b6 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Sun, 20 Dec 2020 21:33:02 +0100 Subject: [PATCH] Bugfix --- src/editor/Editor.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/editor/Editor.jsx b/src/editor/Editor.jsx index 1cc0cdf..ebc7fe9 100644 --- a/src/editor/Editor.jsx +++ b/src/editor/Editor.jsx @@ -36,12 +36,13 @@ const Editor = props => { props.annotation; // The 'currentAnnotation' differs from props.annotation because - // the user has been editing. Moving the selection bounds will - // trigger this effect, but we don't want to update the currentAnnotation + // the user has been editing. Moving the selection bounds will + // trigger the re-render effect, but we don't want to update the currentAnnotation // on move. Therefore, don't update if a) props.annotation equals // the currentAnnotation, or props.annotation and currentAnnotations are // a selection, just created by the user. - const preventUpdate = currentAnnotation?.isEqual(annotation); + const preventUpdate = setCurrentAnnotation.isSelection ? + annotation.isSelection : currentAnnotation.annotationId === annotation.annotationId; if (!preventUpdate) setCurrentAnnotation(annotation);