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
9c260769
Commit
9c260769
authored
12 years ago
by
Taddeüs Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Flick should be fixed now (TEST ON TABLE\!).
parent
55dbb2eb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/trackers/transform.py
+9
-6
9 additions, 6 deletions
src/trackers/transform.py
tests/testapp.py
+6
-6
6 additions, 6 deletions
tests/testapp.py
with
15 additions
and
12 deletions
src/trackers/transform.py
+
9
−
6
View file @
9c260769
...
@@ -111,8 +111,9 @@ class TransformationTracker(GestureTracker):
...
@@ -111,8 +111,9 @@ class TransformationTracker(GestureTracker):
def
update_centroid
(
self
):
def
update_centroid
(
self
):
if
not
self
.
points
:
if
not
self
.
points
:
prev
=
self
.
centroid
self
.
centroid
=
None
self
.
centroid
=
None
return
return
prev
# Calculate average touch point coordinates
# Calculate average touch point coordinates
l
=
len
(
self
.
points
)
l
=
len
(
self
.
points
)
...
@@ -124,6 +125,7 @@ class TransformationTracker(GestureTracker):
...
@@ -124,6 +125,7 @@ class TransformationTracker(GestureTracker):
# Update centroid positionable
# Update centroid positionable
if
self
.
centroid
:
if
self
.
centroid
:
self
.
centroid
.
set_position
(
x
,
y
)
self
.
centroid
.
set_position
(
x
,
y
)
return
self
.
centroid
.
prev
else
:
else
:
self
.
centroid
=
MovingPositionable
(
x
,
y
)
self
.
centroid
=
MovingPositionable
(
x
,
y
)
...
@@ -176,13 +178,14 @@ class TransformationTracker(GestureTracker):
...
@@ -176,13 +178,14 @@ class TransformationTracker(GestureTracker):
self
.
centroid
.
translation
(),
l
))
self
.
centroid
.
translation
(),
l
))
def
on_point_up
(
self
,
event
):
def
on_point_up
(
self
,
event
):
if
event
.
point
in
self
.
points
:
point
=
event
.
get_touch_object
()
self
.
points
.
remove
(
event
.
point
)
if
point
in
self
.
points
:
self
.
points
.
remove
(
point
)
prev
=
self
.
update_centroid
()
if
not
self
.
points
:
if
not
self
.
points
:
self
.
trigger
(
FlickGesture
(
event
,
self
.
centroid
,
self
.
trigger
(
FlickGesture
(
event
,
point
,
point
-
prev
))
self
.
centroid
.
translation
()))
self
.
update_centroid
()
if
not
self
.
propagate_events
:
if
not
self
.
propagate_events
:
event
.
stop_propagation
()
event
.
stop_propagation
()
...
...
This diff is collapsed.
Click to expand it.
tests/testapp.py
+
6
−
6
View file @
9c260769
...
@@ -63,9 +63,14 @@ class Polygon(BoundingBoxArea):
...
@@ -63,9 +63,14 @@ class Polygon(BoundingBoxArea):
self
.
flick_direction
=
trans
self
.
flick_direction
=
trans
flicks
.
add
(
Flick
(
self
.
flick_drag
,
0.7
,
0.4
))
flicks
.
add
(
Flick
(
self
.
flick_drag
,
0.7
,
0.4
))
def
margin_contains
(
self
,
x
,
y
):
m
=
self
.
margin
return
self
.
x
-
m
<=
x
<
self
.
x
+
self
.
width
+
m
\
and
self
.
y
-
m
<=
y
<
self
.
y
+
self
.
height
+
m
def
contains
(
self
,
x
,
y
):
def
contains
(
self
,
x
,
y
):
if
draw_bounding_boxes
:
if
draw_bounding_boxes
:
return
mt
.
RectangularArea
.
contains
(
self
,
x
,
y
)
return
self
.
margin_
contains
(
self
,
x
,
y
)
return
BoundingBoxArea
.
contains
(
self
,
x
,
y
)
return
BoundingBoxArea
.
contains
(
self
,
x
,
y
)
...
@@ -86,11 +91,6 @@ class Polygon(BoundingBoxArea):
...
@@ -86,11 +91,6 @@ class Polygon(BoundingBoxArea):
self
.
update_bounds
()
self
.
update_bounds
()
refresh
()
refresh
()
#def contains(self, x, y):
# m = self.margin
# return self.x - m <= x < self.x + self.width + m \
# and self.y - m <= y < self.y + self.height + m
def
draw
(
self
,
cr
):
def
draw
(
self
,
cr
):
# Draw bounding box
# Draw bounding box
if
draw_bounding_boxes
:
if
draw_bounding_boxes
:
...
...
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