Code review comment for lp:~elopio/autopilot/fix1257055-slow_drag

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

Hi,

What's confusing me is that the new parameter 'rate' isn't used in this code:

193 + current_x, current_y = x1, y1
194 + while current_x != x2 or current_y != y2:
195 + dx = abs(x2 - current_x)
196 + dy = abs(y2 - current_y)
197 +
198 + intx = float(dx) / max(dx, dy)
199 + inty = float(dy) / max(dx, dy)
200 +
201 + step_x = min(rate * intx, dx)
202 + step_y = min(rate * inty, dy)
203 +
204 + if x2 < current_x:
205 + step_x *= -1
206 + if y2 < current_y:
207 + step_y *= -1
208 +
209 + current_x += step_x
210 + current_y += step_y
211 + self._device.finger_move(current_x, current_y)
212 +
213 + sleep(time_between_events)

So I don't see the point in adding the parameter if we're not going to use it.

review: Needs Information

« Back to merge proposal