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
55dbb2eb
Commit
55dbb2eb
authored
Jun 20, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added polygon color change on double tap.
parent
010cb2bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
tests/testapp.py
tests/testapp.py
+6
-2
tests/utils.py
tests/utils.py
+0
-1
No files found.
tests/testapp.py
View file @
55dbb2eb
...
@@ -38,7 +38,7 @@ class Rectangle(mt.RectangularArea):
...
@@ -38,7 +38,7 @@ class Rectangle(mt.RectangularArea):
class
Polygon
(
BoundingBoxArea
):
class
Polygon
(
BoundingBoxArea
):
def
__init__
(
self
,
x
,
y
,
points
,
margin
=
0
,
color
=
BLUE
,
border_color
=
RED
):
def
__init__
(
self
,
x
,
y
,
points
,
margin
=
0
,
color
=
BLUE
,
border_color
=
RED
):
super
(
Polygon
,
self
).
__init__
(
x
,
y
,
points
)
super
(
Polygon
,
self
).
__init__
(
x
,
y
,
points
)
self
.
fill_
color
=
color
self
.
color
=
color
self
.
border_color
=
border_color
self
.
border_color
=
border_color
self
.
margin
=
margin
self
.
margin
=
margin
...
@@ -46,6 +46,10 @@ class Polygon(BoundingBoxArea):
...
@@ -46,6 +46,10 @@ class Polygon(BoundingBoxArea):
self
.
on_pinch
(
self
.
handle_pinch
)
self
.
on_pinch
(
self
.
handle_pinch
)
self
.
on_rotate
(
self
.
handle_rotate
)
self
.
on_rotate
(
self
.
handle_rotate
)
self
.
on_flick
(
self
.
handle_flick
)
self
.
on_flick
(
self
.
handle_flick
)
self
.
on_double_tap
(
self
.
circulate_color
)
def
circulate_color
(
self
,
g
):
self
.
color
=
self
.
color
[
2
:]
+
self
.
color
[:
2
]
def
flick_drag
(
self
,
amt
):
def
flick_drag
(
self
,
amt
):
tx
,
ty
=
self
.
flick_direction
tx
,
ty
=
self
.
flick_direction
...
@@ -105,7 +109,7 @@ class Polygon(BoundingBoxArea):
...
@@ -105,7 +109,7 @@ class Polygon(BoundingBoxArea):
for
x
,
y
in
zip
(
*
self
.
points
):
for
x
,
y
in
zip
(
*
self
.
points
):
cr
.
line_to
(
x
,
y
)
cr
.
line_to
(
x
,
y
)
cr
.
set_source_rgb
(
*
self
.
fill_
color
)
cr
.
set_source_rgb
(
*
self
.
color
)
cr
.
fill
()
cr
.
fill
()
...
...
tests/utils.py
View file @
55dbb2eb
...
@@ -114,7 +114,6 @@ def inside_shape(p, verts):
...
@@ -114,7 +114,6 @@ def inside_shape(p, verts):
# Compute x intersection value
# Compute x intersection value
xisect
=
x0
+
(
x1
-
x0
)
*
(
y
-
y0
)
/
(
y1
-
y0
)
xisect
=
x0
+
(
x1
-
x0
)
*
(
y
-
y0
)
/
(
y1
-
y0
)
print
xisect
,
x
if
xisect
>=
x
:
if
xisect
>=
x
:
inside
=
not
inside
inside
=
not
inside
...
...
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