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
3c6f417f
Commit
3c6f417f
authored
Apr 26, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated some event formats and added 'basic' events.
parent
5ca9a829
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
23 deletions
+68
-23
src/events.py
src/events.py
+68
-23
No files found.
src/events.py
View file @
3c6f417f
class
Gesture
Event
(
object
):
def
__init__
(
self
,
gesture
):
self
.
gesture
=
gesture
class
Basic
Event
(
object
):
def
__init__
(
self
,
point
):
self
.
point
=
point
def
__str__
(
self
):
return
'<%s (%s, %s) sid=%d>'
%
\
(
self
.
__class__
.
__name__
,
self
.
point
.
x
,
self
.
point
.
y
,
self
.
point
.
sid
)
class
TapEvent
(
GestureEvent
):
def
__init__
(
self
,
x
,
y
,
double
=
False
):
super
(
TapEvent
,
self
).
__init__
(
'tap'
)
def
__getattr__
(
self
,
name
):
"""
Delegate attributes to touch point.
"""
if
hasattr
(
self
.
point
,
name
):
return
getattr
(
self
.
point
,
name
)
raise
AttributeError
class
DownEvent
(
BasicEvent
):
_name
=
'down'
class
UpEvent
(
BasicEvent
):
_name
=
'up'
class
MoveEvent
(
BasicEvent
):
_name
=
'move'
def
__str__
(
self
):
return
'<%s (%s, %s) to (%s, %s) sid=%d>'
%
\
(
self
.
__class__
.
__name__
,
self
.
point
.
px
,
self
.
point
.
py
,
self
.
point
.
x
,
self
.
point
.
y
,
self
.
point
.
sid
)
class
GestureEvent
(
object
):
def
__init__
(
self
,
x
,
y
):
self
.
x
=
x
self
.
y
=
y
self
.
double
=
double
@
property
def
xy
(
self
):
return
self
.
x
,
self
.
y
def
__str__
(
self
):
return
'<%s (%s, %s)%s>'
%
(
self
.
__class__
.
__name__
,
self
.
x
,
self
.
y
,
' double'
if
self
.
double
else
''
)
return
'<%s (%s, %s)>'
%
(
self
.
__class__
.
__name__
,
self
.
x
,
self
.
y
)
class
TapEvent
(
GestureEvent
):
_name
=
'tap'
class
SingleTapEvent
(
GestureEvent
):
_name
=
'single_tap'
class
DoubleTapEvent
(
GestureEvent
):
_name
=
'double_tap'
class
FlickEvent
(
GestureEvent
):
_name
=
'flick'
def
__init__
(
self
,
x
,
y
,
velocity
):
super
(
FlickEvent
,
self
).
__init__
(
'flick'
)
self
.
x
=
x
self
.
y
=
y
super
(
FlickEvent
,
self
).
__init__
(
x
,
y
)
self
.
velocity
=
velocity
def
__str__
(
self
):
...
...
@@ -28,10 +72,10 @@ class FlickEvent(GestureEvent):
class
RotateEvent
(
GestureEvent
):
_name
=
'rotate'
def
__init__
(
self
,
cx
,
cy
,
angle
,
n
):
super
(
RotateEvent
,
self
).
__init__
(
'rotate'
)
self
.
cx
=
cx
self
.
cy
=
cy
super
(
RotateEvent
,
self
).
__init__
(
cx
,
cy
)
self
.
angle
=
angle
self
.
n
=
n
...
...
@@ -41,10 +85,10 @@ class RotateEvent(GestureEvent):
class
PinchEvent
(
GestureEvent
):
_name
=
'pinch'
def
__init__
(
self
,
cx
,
cy
,
amount
,
n
):
super
(
RotateEvent
,
self
).
__init__
(
'pinch'
)
self
.
cx
=
cx
self
.
cy
=
cy
super
(
RotateEvent
,
self
).
__init__
(
cx
,
cy
)
self
.
amount
=
amount
self
.
n
=
n
...
...
@@ -54,14 +98,15 @@ class PinchEvent(GestureEvent):
class
PanEvent
(
GestureEvent
):
_name
=
'pan'
def
__init__
(
self
,
x
,
y
,
dx
,
dy
,
n
):
super
(
RotateEvent
,
self
).
__init__
(
'pan'
)
self
.
x
=
x
self
.
y
=
y
super
(
RotateEvent
,
self
).
__init__
(
x
,
y
)
self
.
dx
=
dx
self
.
dy
=
dy
self
.
n
=
n
def
__str__
(
self
):
return
'<%s (%s, %s) amount=%s n=%d>'
%
\
(
self
.
__class__
.
__name__
,
self
.
x
,
self
.
y
,
self
.
amount
,
self
.
n
)
return
'<%s (%s, %s) to (%s, %s) n=%d>'
%
\
(
self
.
__class__
.
__name__
,
self
.
x
,
self
.
y
,
self
.
dx
,
self
.
dy
,
self
.
amount
,
self
.
n
)
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