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
This commit is contained in:
stew-ro 2020-08-28 12:13:21 -07:00 коммит произвёл GitHub
Родитель 4b85050bf0
Коммит 6a1aedfb89
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -574,7 +574,9 @@ export default class PredictPage extends React.Component<IPredictPageProps, IPre
const prevPage = () => { const prevPage = () => {
this.setState((prevState) => ({ this.setState((prevState) => ({
currPage: Math.max(1, prevState.currPage - 1), currPage: Math.max(1, prevState.currPage - 1),
})); }), () => {
this.imageMap.removeAllFeatures();
});
}; };
if (this.state.currPage > 1) { if (this.state.currPage > 1) {
@ -600,7 +602,9 @@ export default class PredictPage extends React.Component<IPredictPageProps, IPre
const nextPage = () => { const nextPage = () => {
this.setState((prevState) => ({ this.setState((prevState) => ({
currPage: Math.min(prevState.currPage + 1, numPages), currPage: Math.min(prevState.currPage + 1, numPages),
})); }), () => {
this.imageMap.removeAllFeatures();
});
}; };
if (this.state.currPage < numPages) { if (this.state.currPage < numPages) {
@ -954,6 +958,7 @@ export default class PredictPage extends React.Component<IPredictPageProps, IPre
} }
private drawPredictionResult = (): void => { private drawPredictionResult = (): void => {
this.imageMap.removeAllFeatures();
const features = []; const features = [];
const imageExtent = [0, 0, this.state.imageWidth, this.state.imageHeight]; const imageExtent = [0, 0, this.state.imageWidth, this.state.imageHeight];
const ocrForCurrentPage: any = this.getOcrFromAnalyzeResult(this.state.analyzeResult)[this.state.currPage - 1]; const ocrForCurrentPage: any = this.getOcrFromAnalyzeResult(this.state.analyzeResult)[this.state.currPage - 1];