Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 0e13070

Browse files
committed
feat: turn off ocr tool when the selection is too small
1 parent 72b58ed commit 0e13070

File tree

1 file changed

+13
-9
lines changed
  • src/pages/Content/components/OCRTool

1 file changed

+13
-9
lines changed

src/pages/Content/components/OCRTool/index.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,19 @@ const OCRTool: React.FC<{
7272
const vw = window.top.innerWidth || window.innerWidth || 0
7373
const vh = window.top.innerHeight || window.innerHeight || 0
7474

75-
props.onFinish({
76-
x: axisX,
77-
y: axisY,
78-
width: w,
79-
height: h,
80-
clientWidth: vw,
81-
clientHeight: vh,
82-
clientPixelRatio: window.devicePixelRatio,
83-
})
75+
if (w < 5 || h < 5) {
76+
props.onFinish()
77+
} else {
78+
props.onFinish({
79+
x: axisX,
80+
y: axisY,
81+
width: w,
82+
height: h,
83+
clientWidth: vw,
84+
clientHeight: vh,
85+
clientPixelRatio: window.devicePixelRatio,
86+
})
87+
}
8488
}
8589
setOverlayActive(false)
8690
}

0 commit comments

Comments
 (0)