From b5e640bd34cf234d0782db9c9bc86baac1ec243e Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Thu, 16 Apr 2020 21:14:18 +0200 Subject: [PATCH] Fixed partial render problem when switching between annotations --- src/TextAnnotator.jsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/TextAnnotator.jsx b/src/TextAnnotator.jsx index dad481e..6672bbf 100644 --- a/src/TextAnnotator.jsx +++ b/src/TextAnnotator.jsx @@ -61,9 +61,12 @@ export default class TextAnnotator extends Component { const { selection, clientRect } = evt; if (selection) { this.setState({ - selectionBounds: clientRect, - selectedAnnotation: selection - }); + selectedAnnotation: null, + selectionBounds: null + }, () => this.setState({ + selectedAnnotation: selection, + selectionBounds: clientRect + })) } else { this.clearState(); }