Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multitouch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
multitouch
Commits
878291b4
Commit
878291b4
authored
12 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Did some debugging in trackers.
parent
0a2aed47
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/geometry.py
+3
-0
3 additions, 0 deletions
src/geometry.py
src/trackers/tap.py
+2
-2
2 additions, 2 deletions
src/trackers/tap.py
src/trackers/transform.py
+12
-5
12 additions, 5 deletions
src/trackers/transform.py
with
17 additions
and
7 deletions
src/geometry.py
+
3
−
0
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
):
"""
...
...
This diff is collapsed.
Click to expand it.
src/trackers/tap.py
+
2
−
2
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
=
{}
...
...
This diff is collapsed.
Click to expand it.
src/trackers/transform.py
+
12
−
5
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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment