Have Events print modifiers correctly in #toString().

This commit is contained in:
Jürg Lehni 2011-05-08 15:33:00 +01:00
parent 5a9dc3dece
commit 04ff593adc
3 changed files with 6 additions and 4 deletions

View file

@ -212,7 +212,7 @@ var ToolEvent = this.ToolEvent = Base.extend({
return '{ type: ' + this.type
+ ', point: ' + this.point
+ ', count: ' + this.count
+ ', modifiers: ' + this.modifiers
+ ', modifiers: ' + this.getModifiers(true)
+ ' }';
}
});

View file

@ -35,7 +35,9 @@ var Event = this.Event = Base.extend({
this.preventDefault();
},
getModifiers: function() {
return Key.modifiers;
getModifiers: function(asString) {
return asString ? '{ ' + Base.each(Key.modifiers, function(value, key) {
this.push(key + ': ' + value);
}, []).join(', ') + ' }' : Key.modifiers;
}
});

View file

@ -27,7 +27,7 @@ var KeyEvent = this.KeyEvent = Event.extend(new function() {
return '{ type: ' + this.type
+ ', key: ' + this.key
+ ', character: ' + this.character
+ ', modifiers: ' + this.modifiers
+ ', modifiers: ' + this.getModifiers(true)
+ ' }';
}
};