@@ -120,19 +120,33 @@ def wait(milliseconds)
120
120
#
121
121
# @option opts [int] :start_x Where to start swiping, on the x axis. Default 0.
122
122
# @option opts [int] :start_y Where to start swiping, on the y axis. Default 0.
123
- # @option opts [int] :end_x Where to end swiping , on the x axis. Default 0.
124
- # @option opts [int] :end_y Where to end swiping , on the y axis. Default 0.
123
+ # @option opts [int] :delta_x The distance from start to move , on the x axis. Default 0.
124
+ # @option opts [int] :delta_y The distance from start to move , on the y axis. Default 0.
125
125
# @option opts [int] :duration How long the actual swipe takes to complete in milliseconds. Default 200.
126
+ # @deprecated Please do not use end_x, end_y anymore
126
127
def swipe ( opts )
127
128
start_x = opts . fetch :start_x , 0
128
129
start_y = opts . fetch :start_y , 0
129
- end_x = opts . fetch :end_x , 0
130
- end_y = opts . fetch :end_y , 0
130
+ delta_x = opts . fetch :delta_x , nil
131
+ delta_y = opts . fetch :delta_y , nil
132
+ end_x = opts . fetch :end_x , nil
133
+ end_y = opts . fetch :end_y , nil
134
+
135
+ if end_x || end_y
136
+ warn '[DEPRECATION] `end_x` and `end_y` are deprecated. Please use `delta_x` and `delta_y` instead.'
137
+ end
138
+
139
+ delta_x ||= end_x
140
+ delta_y ||= end_y
141
+
142
+ delta_x ||= 0
143
+ delta_y ||= 0
144
+
131
145
duration = opts . fetch :duration , 200
132
146
133
147
press x : start_x , y : start_y
134
148
wait ( duration ) if duration
135
- move_to x : end_x , y : end_y
149
+ move_to x : delta_x , y : delta_y
136
150
release
137
151
self
138
152
end
0 commit comments