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
12b9390b
Commit
12b9390b
authored
Jun 16, 2012
by
UVA Multi-touch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hacked in a sort of point_leave event.
parent
3c8c49a4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
10 deletions
+31
-10
src/area.py
src/area.py
+8
-5
src/areas.py
src/areas.py
+20
-3
tests/cairotest.py
tests/cairotest.py
+3
-2
No files found.
src/area.py
View file @
12b9390b
...
@@ -209,17 +209,20 @@ class Area(Positionable, Logger):
...
@@ -209,17 +209,20 @@ class Area(Positionable, Logger):
child
.
delegate_event
(
event
)
child
.
delegate_event
(
event
)
return
return
for
tracker
in
self
.
trackers
:
self
.
handle_event
(
event
)
tracker
.
handle_event
(
event
)
if
event
.
is_immediate_propagation_stopped
():
return
if
self
.
parent
and
not
event
.
is_propagation_stopped
():
if
self
.
parent
and
not
event
.
is_propagation_stopped
():
event
.
add_offset
(
-
self
.
x
,
-
self
.
y
)
event
.
add_offset
(
-
self
.
x
,
-
self
.
y
)
#print 'propagated to %s: %s' % (self.parent, event)
#print 'propagated to %s: %s' % (self.parent, event)
self
.
parent
.
propagate_event
(
event
)
self
.
parent
.
propagate_event
(
event
)
def
handle_event
(
self
,
event
):
for
tracker
in
self
.
trackers
:
tracker
.
handle_event
(
event
)
if
event
.
is_immediate_propagation_stopped
():
return
def
handle_gesture
(
self
,
gesture
):
def
handle_gesture
(
self
,
gesture
):
"""
"""
Handle a gesture that is triggered by a gesture tracker. First, all
Handle a gesture that is triggered by a gesture tracker. First, all
...
...
src/areas.py
View file @
12b9390b
from
area
import
Area
from
area
import
Area
from
screen
import
screen_size
from
screen
import
screen_size
from
events
import
PointMoveEvent
,
PointUpEvent
__all__
=
[
'RectangularArea'
,
'CircularArea'
,
'FullscreenArea'
]
__all__
=
[
'RectangularArea'
,
'CircularArea'
,
'FullscreenArea'
]
...
@@ -25,10 +26,26 @@ class RectangularArea(Area):
...
@@ -25,10 +26,26 @@ class RectangularArea(Area):
def
get_size
(
self
):
def
get_size
(
self
):
return
self
.
width
,
self
.
height
return
self
.
width
,
self
.
height
def
contains
(
self
,
x
,
y
):
return
self
.
x
<=
x
<=
self
.
x
+
self
.
width
\
and
self
.
y
<=
y
<=
self
.
y
+
self
.
height
def
contains_event
(
self
,
event
):
def
contains_event
(
self
,
event
):
ex
,
ey
=
event
.
get_position
()
if
self
.
contains
(
*
event
.
get_position
()):
return
self
.
x
<=
ex
<=
self
.
x
+
self
.
width
\
return
True
and
self
.
y
<=
ey
<=
self
.
y
+
self
.
height
if
isinstance
(
event
,
PointMoveEvent
):
px
,
py
=
event
.
point
.
get_previous_position
()
if
self
.
parent
:
x
,
y
=
self
.
parent
.
get_screen_offset
()
else
:
x
=
y
=
0
if
self
.
contains
(
px
-
x
,
py
-
y
):
self
.
handle_event
(
PointUpEvent
(
event
.
point
))
return
False
class
CircularArea
(
Area
):
class
CircularArea
(
Area
):
...
...
tests/cairotest.py
View file @
12b9390b
...
@@ -21,7 +21,7 @@ class Rectangle(mt.RectangularArea):
...
@@ -21,7 +21,7 @@ class Rectangle(mt.RectangularArea):
self
.
on_drag
(
self
.
move
)
self
.
on_drag
(
self
.
move
)
self
.
on_pinch
(
self
.
resize
)
self
.
on_pinch
(
self
.
resize
)
self
.
on_rotate
(
self
.
rotate
)
#
self.on_rotate(self.rotate)
def
move
(
self
,
g
):
def
move
(
self
,
g
):
print
'move:'
,
g
print
'move:'
,
g
...
@@ -38,6 +38,8 @@ class Rectangle(mt.RectangularArea):
...
@@ -38,6 +38,8 @@ class Rectangle(mt.RectangularArea):
self
.
tscale
(
scale
)
self
.
tscale
(
scale
)
self
.
ttrans
(
-
x
,
-
y
)
self
.
ttrans
(
-
x
,
-
y
)
self
.
translate
(
x
-
x
*
scale
,
y
-
y
*
scale
)
self
.
width
*=
scale
self
.
width
*=
scale
self
.
height
*=
scale
self
.
height
*=
scale
...
@@ -57,7 +59,6 @@ class Rectangle(mt.RectangularArea):
...
@@ -57,7 +59,6 @@ class Rectangle(mt.RectangularArea):
t
=
cairo
.
Matrix
()
t
=
cairo
.
Matrix
()
t
.
translate
(
tx
,
ty
)
t
.
translate
(
tx
,
ty
)
self
.
t
=
t
*
self
.
t
self
.
t
=
t
*
self
.
t
#self.t = self.t * t
def
tscale
(
self
,
s
):
def
tscale
(
self
,
s
):
t
=
cairo
.
Matrix
()
t
=
cairo
.
Matrix
()
...
...
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