File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,11 @@ def enable_gesture(self, enable_flag):
201
201
self ._gesture_mode = False
202
202
self ._gesture_enable = enable_flag
203
203
204
+ def rotated_gesture (self , original_gesture ):
205
+ directions = [1 , 4 , 2 , 3 ]
206
+ new_index = (directions .index (original_gesture ) + self ._rotation // 90 ) % 4
207
+ return directions [new_index ]
208
+
204
209
def gesture (self ): # pylint: disable-msg=too-many-branches
205
210
"""Returns gesture code if detected. =0 if no gesture detected
206
211
=1 if an UP, =2 if a DOWN, =3 if an LEFT, =4 if a RIGHT
@@ -284,12 +289,7 @@ def gesture(self): # pylint: disable-msg=too-many-branches
284
289
break
285
290
if gesture_received != 0 :
286
291
if self ._rotation != 0 :
287
- directions = [1 , 4 , 2 , 3 ]
288
- new_index = (
289
- directions .index (gesture_received ) + self ._rotation // 90
290
- ) % 4
291
- modified_gesture = directions [new_index ]
292
- return modified_gesture
292
+ return self .rotated_gesture (gesture_received )
293
293
return gesture_received
294
294
295
295
@property
You can’t perform that action at this time.
0 commit comments