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