From 6a1aedfb89b0499a0f4782e16ccbd8a06887841d Mon Sep 17 00:00:00 2001 From: stew-ro <60453211+stew-ro@users.noreply.github.com> Date: Fri, 28 Aug 2020 12:13:21 -0700 Subject: [PATCH] fix: remove existing bounding boxes from document on analyze (#523) * fix: remove existing bounding boxes from document on analyze * fix: remove boundingboxes on analyze page change --- src/react/components/pages/predict/predictPage.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/react/components/pages/predict/predictPage.tsx b/src/react/components/pages/predict/predictPage.tsx index 8e2cc3fa..556789da 100644 --- a/src/react/components/pages/predict/predictPage.tsx +++ b/src/react/components/pages/predict/predictPage.tsx @@ -574,7 +574,9 @@ export default class PredictPage extends React.Component { this.setState((prevState) => ({ currPage: Math.max(1, prevState.currPage - 1), - })); + }), () => { + this.imageMap.removeAllFeatures(); + }); }; if (this.state.currPage > 1) { @@ -600,7 +602,9 @@ export default class PredictPage extends React.Component { this.setState((prevState) => ({ currPage: Math.min(prevState.currPage + 1, numPages), - })); + }), () => { + this.imageMap.removeAllFeatures(); + }); }; if (this.state.currPage < numPages) { @@ -954,6 +958,7 @@ export default class PredictPage extends React.Component { + this.imageMap.removeAllFeatures(); const features = []; const imageExtent = [0, 0, this.state.imageWidth, this.state.imageHeight]; const ocrForCurrentPage: any = this.getOcrFromAnalyzeResult(this.state.analyzeResult)[this.state.currPage - 1];