Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
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
Boxiang Sun
pyodide
Commits
2128618f
Commit
2128618f
authored
May 22, 2018
by
Michael Droettboom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #34: Fix matplotlib keyboard events
parent
4ac81c02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
src/wasm_backend.py
src/wasm_backend.py
+7
-4
No files found.
src/wasm_backend.py
View file @
2128618f
...
...
@@ -150,6 +150,7 @@ class FigureCanvasWasm(backend_agg.FigureCanvasAgg):
'width: {}px; height: {}px'
.
format
(
width
/
self
.
_ratio
,
height
/
self
.
_ratio
)
)
rubberband
.
setAttribute
(
'tabindex'
,
'0'
)
rubberband
.
addEventListener
(
'click'
,
self
.
onclick
)
rubberband
.
addEventListener
(
'mousemove'
,
self
.
onmousemove
)
rubberband
.
addEventListener
(
'mouseup'
,
self
.
onmouseup
)
...
...
@@ -227,9 +228,11 @@ class FigureCanvasWasm(backend_agg.FigureCanvasAgg):
def
onmouseenter
(
self
,
event
):
window
.
addEventListener
(
'contextmenu'
,
ignore
)
self
.
get_element
(
'rubberband'
).
focus
()
self
.
enter_notify_event
(
guiEvent
=
event
)
def
onmouseleave
(
self
,
event
):
self
.
get_element
(
'rubberband'
).
blur
()
self
.
leave_notify_event
(
guiEvent
=
event
)
def
onscroll
(
self
,
event
):
...
...
@@ -247,11 +250,11 @@ class FigureCanvasWasm(backend_agg.FigureCanvasAgg):
self
.
get_element
(
'rubberband'
).
style
.
cursor
=
self
.
_cursor_map
.
get
(
cursor
,
0
)
def
_convert_key_event
(
self
,
event
):
code
=
event
.
which
.
toString
(
)
code
=
int
(
event
.
which
)
value
=
chr
(
code
)
shift
=
event
.
shiftKey
and
event
.
which
!=
16
ctrl
=
event
.
ctrlKey
and
event
.
which
!=
17
alt
=
event
.
altKey
and
event
.
which
!=
18
shift
=
event
.
shiftKey
and
code
!=
16
ctrl
=
event
.
ctrlKey
and
code
!=
17
alt
=
event
.
altKey
and
code
!=
18
# letter keys
if
65
<=
code
<=
90
:
if
not
shift
:
...
...
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