Skip to content

Commit

Permalink
fix: remove existing bounding boxes from document on analyze (#523)
Browse files Browse the repository at this point in the history
* fix: remove existing bounding boxes from document on analyze

* fix: remove boundingboxes on analyze page change
  • Loading branch information
stew-ro authored Aug 28, 2020
1 parent 4b85050 commit 6a1aedf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/react/components/pages/predict/predictPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@ export default class PredictPage extends React.Component<IPredictPageProps, IPre
const prevPage = () => {
this.setState((prevState) => ({
currPage: Math.max(1, prevState.currPage - 1),
}));
}), () => {
this.imageMap.removeAllFeatures();
});
};

if (this.state.currPage > 1) {
Expand All @@ -600,7 +602,9 @@ export default class PredictPage extends React.Component<IPredictPageProps, IPre
const nextPage = () => {
this.setState((prevState) => ({
currPage: Math.min(prevState.currPage + 1, numPages),
}));
}), () => {
this.imageMap.removeAllFeatures();
});
};

if (this.state.currPage < numPages) {
Expand Down Expand Up @@ -954,6 +958,7 @@ export default class PredictPage extends React.Component<IPredictPageProps, IPre
}

private drawPredictionResult = (): void => {
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];
Expand Down

0 comments on commit 6a1aedf

Please sign in to comment.