feat: get size for OCRText

This commit is contained in:
lilong.129
2024-12-02 16:45:34 +08:00
parent ad796590b5
commit 590e6110a1
3 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -1 +1 @@
v5.0.0+2411232210 v5.0.0+2412021645
+7
View File
@@ -71,6 +71,13 @@ type OCRText struct {
Rect image.Rectangle Rect image.Rectangle
} }
func (t OCRText) Size() Size {
return Size{
Width: t.Rect.Dx(),
Height: t.Rect.Dy(),
}
}
func (t OCRText) Center() PointF { func (t OCRText) Center() PointF {
return getRectangleCenterPoint(t.Rect) return getRectangleCenterPoint(t.Rect)
} }
+1 -1
View File
@@ -68,7 +68,7 @@ func (dExt *DriverExt) LoopUntil(findAction, findCondition, foundAction Action,
for i := 0; i < maxRetryTimes; i++ { for i := 0; i < maxRetryTimes; i++ {
// wait interval between each findAction // wait interval between each findAction
time.Sleep(time.Duration(1000*interval) * time.Millisecond) time.Sleep(time.Duration(interval) * time.Second)
if err := findCondition(dExt); err == nil { if err := findCondition(dExt); err == nil {
// do action after found // do action after found