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
dc48af59
Commit
dc48af59
authored
Jun 04, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a new way of binding handlers to trackers.
parent
b7c9d41d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
17 deletions
+29
-17
TODO.txt
TODO.txt
+0
-1
src/tracker.py
src/tracker.py
+13
-0
tests/basic.py
tests/basic.py
+3
-3
tests/draw.py
tests/draw.py
+5
-5
tests/tap.py
tests/tap.py
+5
-5
tests/transform.py
tests/transform.py
+3
-3
No files found.
TODO.txt
View file @
dc48af59
Code:
Code:
- Connect to VTK.
- Connect to VTK.
- Rotation has a 'bump' at 0.
- Rotation has a 'bump' at 0.
- tracker.gesture(...) instead of tracker.bind('gesture', ...)
Thesis:
Thesis:
- Network protocol.
- Network protocol.
...
...
src/tracker.py
View file @
dc48af59
...
@@ -66,6 +66,19 @@ class GestureTracker(Logger):
...
@@ -66,6 +66,19 @@ class GestureTracker(Logger):
setattr
(
self
,
name
,
value
)
setattr
(
self
,
name
,
value
)
def
__getattr__
(
self
,
name
):
"""
Allow calls like:
tracker.gesture(...)
instead of:
tracker.bind('gesture', ...)
"""
if
name
not
in
self
.
__gesture_types__
:
raise
AttributeError
(
"'%s' has no attribute '%s'"
%
(
self
.
__class__
.
__name__
,
name
))
return
lambda
handler
:
self
.
bind
(
name
,
handler
)
class
Gesture
(
object
):
class
Gesture
(
object
):
"""
"""
...
...
tests/basic.py
View file @
dc48af59
...
@@ -13,9 +13,9 @@ win = FullscreenWindow(server=server)
...
@@ -13,9 +13,9 @@ win = FullscreenWindow(server=server)
# Add tracker and handlers
# Add tracker and handlers
tracker
=
BasicTracker
(
win
)
tracker
=
BasicTracker
(
win
)
tracker
.
bind
(
'down'
,
lambda
g
:
0
)
tracker
.
down
(
lambda
g
:
0
)
tracker
.
bind
(
'move'
,
lambda
g
:
0
)
tracker
.
move
(
lambda
g
:
0
)
tracker
.
bind
(
'up'
,
lambda
g
:
0
)
tracker
.
up
(
lambda
g
:
0
)
# Start listening to TUIO events
# Start listening to TUIO events
try
:
try
:
...
...
tests/draw.py
View file @
dc48af59
...
@@ -141,13 +141,13 @@ def pinch(gesture):
...
@@ -141,13 +141,13 @@ def pinch(gesture):
scale
=
min
(
scale
*
gesture
.
get_scale
(),
MAX_SCALE
)
scale
=
min
(
scale
*
gesture
.
get_scale
(),
MAX_SCALE
)
transform
=
TransformationTracker
(
win
)
transform
=
TransformationTracker
(
win
)
transform
.
bind
(
'rotate'
,
rotate
)
transform
.
rotate
(
rotate
)
transform
.
bind
(
'pinch'
,
pinch
)
transform
.
pinch
(
pinch
)
tap
=
TapTracker
(
win
)
tap
=
TapTracker
(
win
)
tap
.
bind
(
'tap'
,
lambda
g
:
taps
.
append
([
coord
(
*
g
.
xy
),
FINGER_RADIUS
]))
tap
.
tap
(
lambda
g
:
taps
.
append
([
coord
(
*
g
.
xy
),
FINGER_RADIUS
]))
tap
.
bind
(
'single_tap'
,
lambda
g
:
dtaps
.
append
(
list
(
coord
(
*
g
.
xy
))
+
[
1
]))
tap
.
single_tap
(
lambda
g
:
dtaps
.
append
(
list
(
coord
(
*
g
.
xy
))
+
[
1
]))
tap
.
bind
(
'double_tap'
,
lambda
g
:
dtaps
.
append
(
list
(
coord
(
*
g
.
xy
))
+
[
0
]))
tap
.
double_tap
(
lambda
g
:
dtaps
.
append
(
list
(
coord
(
*
g
.
xy
))
+
[
0
]))
try
:
try
:
...
...
tests/tap.py
View file @
dc48af59
...
@@ -18,12 +18,12 @@ win = FullscreenWindow(server=server)
...
@@ -18,12 +18,12 @@ win = FullscreenWindow(server=server)
# Add tracker and handlers
# Add tracker and handlers
tracker
=
TapTracker
(
win
)
tracker
=
TapTracker
(
win
)
def
handler
(
gesture
):
pass
def
handler
(
gesture
):
#print 'handler:', gesture
pass
tracker
.
bind
(
'tap'
,
handler
)
tracker
.
tap
(
handler
)
tracker
.
bind
(
'single_tap'
,
handler
)
tracker
.
single_tap
(
handler
)
tracker
.
bind
(
'double_tap'
,
handler
)
tracker
.
double_tap
(
handler
)
# Start listening to TUIO events
# Start listening to TUIO events
try
:
try
:
...
...
tests/transform.py
View file @
dc48af59
...
@@ -13,9 +13,9 @@ win = FullscreenWindow(server=server)
...
@@ -13,9 +13,9 @@ win = FullscreenWindow(server=server)
# Add tracker and handlers
# Add tracker and handlers
tracker
=
TransformationTracker
(
win
)
tracker
=
TransformationTracker
(
win
)
tracker
.
bind
(
'rotate'
,
lambda
g
:
0
)
tracker
.
rotate
(
lambda
g
:
0
)
tracker
.
bind
(
'pinch'
,
lambda
g
:
0
)
tracker
.
pinch
(
lambda
g
:
0
)
tracker
.
bind
(
'move'
,
lambda
g
:
0
)
tracker
.
move
(
lambda
g
:
0
)
# Start listening to TUIO events
# Start listening to TUIO events
try
:
try
:
...
...
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