return the first one matched exactly when index not specified

This commit is contained in:
buyuxiang
2023-09-04 22:11:24 +08:00
parent 3fa66f0bb2
commit cbec90403c

View File

@@ -134,6 +134,11 @@ func (t OCRTexts) FindText(text string, options ...ActionOption) (result OCRText
}
results = append(results, ocrText)
// return the first one matched exactly when index not specified
if ocrText.Text == text && actionOptions.Index == 0 {
return ocrText, nil
}
}
if len(results) == 0 {