feat: add pre hook and post hook for Drag action

This commit is contained in:
lilong.129
2025-05-09 23:10:59 +08:00
parent f7ec4a06b4
commit 1dfc473d33
6 changed files with 21 additions and 13 deletions

View File

@@ -375,12 +375,13 @@ func (ad *ADBDriver) Drag(fromX, fromY, toX, toY float64, opts ...option.ActionO
log.Info().Float64("fromX", fromX).Float64("fromY", fromY).
Float64("toX", toX).Float64("toY", toY).Msg("ADBDriver.Drag")
fromX, fromY, toX, toY, err = handlerDrag(ad, fromX, fromY, toX, toY, opts...)
actionOptions := option.NewActionOptions(opts...)
fromX, fromY, toX, toY, err = preHandler_Drag(ad, actionOptions, fromX, fromY, toX, toY)
if err != nil {
return err
}
defer postHandler(ad, actionOptions)
actionOptions := option.NewActionOptions(opts...)
duration := 200.0
if actionOptions.Duration > 0 {
duration = actionOptions.Duration * 1000