Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
shrapnel
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
shrapnel
Commits
c95f9294
Commit
c95f9294
authored
Jul 03, 2012
by
Sam Rushing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle some edge cases with touch events
parent
8b0be44e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
coro/http/demo/websocket/field/field.py
coro/http/demo/websocket/field/field.py
+7
-4
No files found.
coro/http/demo/websocket/field/field.py
View file @
c95f9294
...
...
@@ -110,6 +110,7 @@ class field_conn (websocket):
self
.
on_mouse_move
(
int
(
event
[
1
]),
int
(
event
[
2
]))
elif
event
[
0
]
==
'TS'
:
tl
=
self
.
unpack_touch_list
(
event
[
1
:])
self
.
last_touch_move
=
tl
[
0
][
0
],
tl
[
0
][
1
]
self
.
on_mouse_down
(
tl
[
0
][
0
],
tl
[
0
][
1
])
elif
event
[
0
]
==
'TM'
:
tl
=
self
.
unpack_touch_list
(
event
[
1
:])
...
...
@@ -118,13 +119,14 @@ class field_conn (websocket):
elif
event
[
0
]
==
'TE'
:
# emulate mouse up by with saved last touch_move
x0
,
y0
=
self
.
last_touch_move
if
x0
is
not
None
:
self
.
on_mouse_up
(
x0
,
y0
)
self
.
last_touch_move
=
None
,
None
else
:
W
(
'unknown event: %r
\
n
'
%
(
event
,))
return
False
def
unpack_touch_list
(
self
,
tl
):
W
(
'touch_list=%r
\
n
'
%
(
tl
,))
return
[
[
int
(
y
)
for
y
in
x
.
split
(
'.'
)]
for
x
in
tl
]
def
on_mouse_down
(
self
,
x
,
y
):
...
...
@@ -142,6 +144,7 @@ class field_conn (websocket):
#b = box (random.choice (colors), (x0+px, y0+py, x1+px, y1+py))
#self.field.Q.insert (b)
# 2) or move the window
if
x0
is
not
None
:
self
.
move_window
(
x0
-
x1
,
y0
-
y1
)
self
.
draw_window
()
...
...
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