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
9c260769
Commit
9c260769
authored
Jun 20, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Flick should be fixed now (TEST ON TABLE\!).
parent
55dbb2eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
12 deletions
+15
-12
src/trackers/transform.py
src/trackers/transform.py
+9
-6
tests/testapp.py
tests/testapp.py
+6
-6
No files found.
src/trackers/transform.py
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
()
...
...
tests/testapp.py
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
:
...
...
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