change: convertToAbsolutePoint, convertToAbsoluteCoordinates

This commit is contained in:
lilong.129
2025-03-04 20:02:59 +08:00
parent e35aa782c2
commit 65564b958f
8 changed files with 71 additions and 94 deletions

View File

@@ -19,7 +19,6 @@ type ActionOptions struct {
Direction interface{} `json:"direction,omitempty" yaml:"direction,omitempty"` // used by swipe to tap text or app
Timeout int `json:"timeout,omitempty" yaml:"timeout,omitempty"` // TODO: wait timeout in seconds for mobile action
Frequency int `json:"frequency,omitempty" yaml:"frequency,omitempty"`
Relative bool `json:"relative,omitempty" yaml:"relative,omitempty"` // use relative coordinate
ScreenOptions
@@ -56,9 +55,6 @@ func (o *ActionOptions) Options() []ActionOption {
if o.Steps != 0 {
options = append(options, WithSteps(o.Steps))
}
if o.Relative {
options = append(options, WithRelative(true))
}
switch v := o.Direction.(type) {
case string:
@@ -260,13 +256,6 @@ func WithDirection(direction string) ActionOption {
}
}
// WithRelative set relative coordinate, (0, 0) is the top-left corner of the screen
func WithRelative(relative bool) ActionOption {
return func(o *ActionOptions) {
o.Relative = relative
}
}
// WithCustomDirection inputs sx, sy, ex, ey
func WithCustomDirection(sx, sy, ex, ey float64) ActionOption {
return func(o *ActionOptions) {