feat: ApplyOffset for tap xy

This commit is contained in:
lilong.129
2025-02-19 10:55:56 +08:00
parent 8bccf709a7
commit 1b18976620
7 changed files with 33 additions and 14 deletions

View File

@@ -131,7 +131,17 @@ func (o *ActionOptions) GetScreenOptions() []ActionOption {
return o.ScreenOptions.Options()
}
func (o *ActionOptions) GetRandomOffset() float64 {
func (o *ActionOptions) ApplyOffset(absX, absY float64) (float64, float64) {
if len(o.Offset) == 2 {
absX += float64(o.Offset[0])
absY += float64(o.Offset[1])
}
absX += o.GenerateRandomOffset()
absY += o.GenerateRandomOffset()
return absX, absY
}
func (o *ActionOptions) GenerateRandomOffset() float64 {
if len(o.OffsetRandomRange) != 2 {
// invalid offset random range, should be [min, max]
return 0