Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
multitouch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
multitouch
Commits
878291b4
Commit
878291b4
authored
Jun 09, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Did some debugging in trackers.
parent
0a2aed47
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
7 deletions
+17
-7
src/geometry.py
src/geometry.py
+3
-0
src/trackers/tap.py
src/trackers/tap.py
+2
-2
src/trackers/transform.py
src/trackers/transform.py
+12
-5
No files found.
src/geometry.py
View file @
878291b4
...
...
@@ -52,6 +52,9 @@ class Positionable(object):
ox
,
oy
=
other
return
((
ox
-
self
.
x
)
**
2
+
(
oy
-
self
.
y
)
**
2
)
**
.
5
def
translate
(
self
,
x
,
y
):
self
.
set_position
(
self
.
x
+
x
,
self
.
y
+
y
)
class
MovingPositionable
(
Positionable
):
"""
...
...
src/trackers/tap.py
View file @
878291b4
...
...
@@ -36,8 +36,8 @@ class TapTracker(GestureTracker):
configurable
=
[
'tap_distance'
,
'tap_time'
,
'double_tap_time'
,
'double_tap_distance'
,
'update_rate'
,
'propagate_up_event'
]
def
__init__
(
self
,
wi
ndow
=
None
):
super
(
TapTracker
,
self
).
__init__
(
wi
ndow
)
def
__init__
(
self
,
wi
dget
):
super
(
TapTracker
,
self
).
__init__
(
wi
dget
)
# Map of touch object id to tuple (timestamp, position) of point down
self
.
reg
=
{}
...
...
src/trackers/transform.py
View file @
878291b4
...
...
@@ -59,6 +59,9 @@ class DragGesture(Gesture, Positionable):
return
'<DragGesture at (%s, %s) translation=(%s, %s)>'
\
%
(
self
.
get_position
()
+
self
.
translation
.
get_position
())
def
get_translation
(
self
):
return
self
.
translation
class
TransformationTracker
(
GestureTracker
):
"""
...
...
@@ -67,7 +70,7 @@ class TransformationTracker(GestureTracker):
"""
supported_gestures
=
[
RotationGesture
,
PinchGesture
,
DragGesture
]
def
__init__
(
self
,
widget
=
None
):
def
__init__
(
self
,
widget
):
super
(
TransformationTracker
,
self
).
__init__
(
widget
)
# All touch points performing the transformation
...
...
@@ -116,13 +119,17 @@ class TransformationTracker(GestureTracker):
scale
=
dist
/
prev
self
.
trigger
(
PinchGesture
(
event
,
self
.
centroid
,
scale
))
# Movement using multiple touch points
self
.
trigger
(
DragGesture
(
event
,
self
.
centroid
,
self
.
centroid
.
translation
()))
else
:
# Movement using one touch point
self
.
trigger
(
DragGesture
(
event
,
event
.
point
,
event
.
point
.
translation
()))
# Update centroid before movement can be detected
self
.
update_centroid
()
# Movement
self
.
trigger
(
DragGesture
(
event
,
self
.
centroid
,
self
.
centroid
.
translation
()))
def
on_point_up
(
self
,
event
):
self
.
points
.
remove
(
event
.
point
)
self
.
update_centroid
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment