Have views redrawn in keyboard handlers if content has changed.

This commit is contained in:
Jürg Lehni 2011-06-19 23:17:55 +01:00
parent 6f816e1151
commit c8a1bf4fce

View file

@ -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);
}
}