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
Show 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
):
class
Basic
Event
(
object
):
def
__init__
(
self
,
gesture
):
def
__init__
(
self
,
point
):
self
.
gesture
=
gesture
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
__getattr__
(
self
,
name
):
def
__init__
(
self
,
x
,
y
,
double
=
False
):
"""
super
(
TapEvent
,
self
).
__init__
(
'tap'
)
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
.
x
=
x
self
.
y
=
y
self
.
y
=
y
self
.
double
=
double
@
property
def
xy
(
self
):
return
self
.
x
,
self
.
y
def
__str__
(
self
):
def
__str__
(
self
):
return
'<%s (%s, %s)%s>'
%
(
self
.
__class__
.
__name__
,
self
.
x
,
self
.
y
,
return
'<%s (%s, %s)>'
%
(
self
.
__class__
.
__name__
,
self
.
x
,
self
.
y
)
' double'
if
self
.
double
else
''
)
class
TapEvent
(
GestureEvent
):
_name
=
'tap'
class
SingleTapEvent
(
GestureEvent
):
_name
=
'single_tap'
class
DoubleTapEvent
(
GestureEvent
):
_name
=
'double_tap'
class
FlickEvent
(
GestureEvent
):
class
FlickEvent
(
GestureEvent
):
_name
=
'flick'
def
__init__
(
self
,
x
,
y
,
velocity
):
def
__init__
(
self
,
x
,
y
,
velocity
):
super
(
FlickEvent
,
self
).
__init__
(
'flick'
)
super
(
FlickEvent
,
self
).
__init__
(
x
,
y
)
self
.
x
=
x
self
.
y
=
y
self
.
velocity
=
velocity
self
.
velocity
=
velocity
def
__str__
(
self
):
def
__str__
(
self
):
...
@@ -28,10 +72,10 @@ class FlickEvent(GestureEvent):
...
@@ -28,10 +72,10 @@ class FlickEvent(GestureEvent):
class
RotateEvent
(
GestureEvent
):
class
RotateEvent
(
GestureEvent
):
_name
=
'rotate'
def
__init__
(
self
,
cx
,
cy
,
angle
,
n
):
def
__init__
(
self
,
cx
,
cy
,
angle
,
n
):
super
(
RotateEvent
,
self
).
__init__
(
'rotate'
)
super
(
RotateEvent
,
self
).
__init__
(
cx
,
cy
)
self
.
cx
=
cx
self
.
cy
=
cy
self
.
angle
=
angle
self
.
angle
=
angle
self
.
n
=
n
self
.
n
=
n
...
@@ -41,10 +85,10 @@ class RotateEvent(GestureEvent):
...
@@ -41,10 +85,10 @@ class RotateEvent(GestureEvent):
class
PinchEvent
(
GestureEvent
):
class
PinchEvent
(
GestureEvent
):
_name
=
'pinch'
def
__init__
(
self
,
cx
,
cy
,
amount
,
n
):
def
__init__
(
self
,
cx
,
cy
,
amount
,
n
):
super
(
RotateEvent
,
self
).
__init__
(
'pinch'
)
super
(
RotateEvent
,
self
).
__init__
(
cx
,
cy
)
self
.
cx
=
cx
self
.
cy
=
cy
self
.
amount
=
amount
self
.
amount
=
amount
self
.
n
=
n
self
.
n
=
n
...
@@ -54,14 +98,15 @@ class PinchEvent(GestureEvent):
...
@@ -54,14 +98,15 @@ class PinchEvent(GestureEvent):
class
PanEvent
(
GestureEvent
):
class
PanEvent
(
GestureEvent
):
_name
=
'pan'
def
__init__
(
self
,
x
,
y
,
dx
,
dy
,
n
):
def
__init__
(
self
,
x
,
y
,
dx
,
dy
,
n
):
super
(
RotateEvent
,
self
).
__init__
(
'pan'
)
super
(
RotateEvent
,
self
).
__init__
(
x
,
y
)
self
.
x
=
x
self
.
y
=
y
self
.
dx
=
dx
self
.
dx
=
dx
self
.
dy
=
dy
self
.
dy
=
dy
self
.
n
=
n
self
.
n
=
n
def
__str__
(
self
):
def
__str__
(
self
):
return
'<%s (%s, %s) amount=%s n=%d>'
%
\
return
'<%s (%s, %s) to (%s, %s) n=%d>'
%
\
(
self
.
__class__
.
__name__
,
self
.
x
,
self
.
y
,
self
.
amount
,
self
.
n
)
(
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