mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Have views redrawn in keyboard handlers if content has changed.
This commit is contained in:
parent
6f816e1151
commit
c8a1bf4fce
1 changed files with 4 additions and 1 deletions
|
@ -69,7 +69,8 @@ var Key = this.Key = new function() {
|
|||
var character = String.fromCharCode(charCode),
|
||||
key = keys[keyCode] || character.toLowerCase(),
|
||||
handler = down ? 'onKeyDown' : 'onKeyUp',
|
||||
scope = View.focused && View.focused._scope,
|
||||
view = View.focused,
|
||||
scope = view && view._scope,
|
||||
tool = scope && scope.tool;
|
||||
keyMap[key] = down;
|
||||
if (tool && tool[handler]) {
|
||||
|
@ -80,6 +81,8 @@ var Key = this.Key = new function() {
|
|||
var keyEvent = new KeyEvent(down, key, character, event);
|
||||
if (tool[handler](keyEvent) === false)
|
||||
keyEvent.preventDefault();
|
||||
if (view)
|
||||
view.draw(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue