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
29dd92a4
Commit
29dd92a4
authored
Jun 20, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polygons can now be transformes at the same time by a single gesture on the root window.
parent
2b5a1a55
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
1 deletion
+25
-1
tests/testapp.py
tests/testapp.py
+25
-1
No files found.
tests/testapp.py
View file @
29dd92a4
...
@@ -55,7 +55,6 @@ class Polygon(BoundingBoxArea):
...
@@ -55,7 +55,6 @@ class Polygon(BoundingBoxArea):
def
handle_flick
(
self
,
g
):
def
handle_flick
(
self
,
g
):
trans
=
g
.
get_translation
()
trans
=
g
.
get_translation
()
print
trans
.
distance_to
((
0
,
0
))
if
trans
.
distance_to
((
0
,
0
))
>
10
:
if
trans
.
distance_to
((
0
,
0
))
>
10
:
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
))
...
@@ -290,6 +289,31 @@ def on_show(window):
...
@@ -290,6 +289,31 @@ def on_show(window):
overlay
.
on_finger_up
(
handle_up
)
overlay
.
on_finger_up
(
handle_up
)
root
.
add_area
(
overlay
)
root
.
add_area
(
overlay
)
# Root area rotation leads to rotation of all polygons around the centroid
def
move_to_polygons
(
g
):
gx
,
gy
=
g
.
get_position
()
for
obj
in
draw_objects
:
x
,
y
=
obj
.
get_position
()
g
.
set_position
(
gx
-
x
,
gy
-
y
)
yield
obj
,
g
def
rotate_root
(
g
):
for
obj
,
gesture
in
move_to_polygons
(
g
):
obj
.
handle_rotate
(
gesture
)
def
scale_root
(
g
):
for
obj
,
gesture
in
move_to_polygons
(
g
):
obj
.
handle_pinch
(
gesture
)
def
drag_root
(
g
):
for
obj
,
gesture
in
move_to_polygons
(
g
):
obj
.
handle_drag
(
gesture
)
root
.
on_rotate
(
rotate_root
)
root
.
on_pinch
(
scale_root
)
root
.
on_drag
(
drag_root
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
from
parse_arguments
import
create_parser
,
parse_args
from
parse_arguments
import
create_parser
,
parse_args
...
...
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