File tree 4 files changed +34
-6
lines changed
4 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -134,8 +134,7 @@ def on_touch_start(self, evt):
134
134
return
135
135
136
136
# get position
137
- touch = evt .touches [0 ]
138
- x , y = touch .x_pos , touch .y_pos
137
+ x , y = evt .x_pos , evt .y_pos
139
138
length = pero .distance (self ._center , (x , y ))
140
139
141
140
# start measure
@@ -170,8 +169,7 @@ def on_touch_move(self, evt):
170
169
return
171
170
172
171
# get position
173
- touch = evt .touches [0 ]
174
- x , y = touch .x_pos , touch .y_pos
172
+ x , y = evt .x_pos , evt .y_pos
175
173
176
174
# measure angle
177
175
if self ._is_measure :
Original file line number Diff line number Diff line change 2
2
# Copyright (c) Martin Strohalm. All rights reserved.
3
3
4
4
# set version
5
- version = (0 , 19 , 0 )
5
+ version = (0 , 20 , 0 )
6
6
7
7
# import main objects
8
8
from . enums import *
Original file line number Diff line number Diff line change @@ -63,6 +63,12 @@ class TouchEvt(ViewEvt):
63
63
64
64
Attributes:
65
65
66
+ x_pos: int or float
67
+ Last touch logical x-coordinate in device units.
68
+
69
+ y_pos: int or float
70
+ Last touch logical y-coordinate in device units.
71
+
66
72
touches: (pero.Touch,)
67
73
Collection of individual touches.
68
74
@@ -95,6 +101,30 @@ def __init__(self, **kwargs):
95
101
super ().__init__ (** kwargs )
96
102
97
103
104
+ @property
105
+ def x_pos (self ):
106
+ """Gets x-coordinate of the last touch in device units."""
107
+
108
+ # check touches
109
+ if not self .touches :
110
+ return None
111
+
112
+ # return last
113
+ return self .touches [- 1 ].x_pos
114
+
115
+
116
+ @property
117
+ def y_pos (self ):
118
+ """Gets y-coordinate of the last touch in device units."""
119
+
120
+ # check touches
121
+ if not self .touches :
122
+ return None
123
+
124
+ # return last
125
+ return self .touches [- 1 ].y_pos
126
+
127
+
98
128
@classmethod
99
129
def from_evt (cls , evt ):
100
130
"""
Original file line number Diff line number Diff line change 3
3
from setuptools import setup , find_packages
4
4
5
5
# get version
6
- version = "0.19 .0"
6
+ version = "0.20 .0"
7
7
8
8
# get description
9
9
with open ("README.md" , "r" , encoding = "utf8" ) as fh :
You can’t perform that action at this time.
0 commit comments