Skip to content

Commit 04ff593

Browse files
committed
Have Events print modifiers correctly in #toString().
1 parent 5a9dc3d commit 04ff593

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/tool/ToolEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ var ToolEvent = this.ToolEvent = Base.extend({
212212
return '{ type: ' + this.type
213213
+ ', point: ' + this.point
214214
+ ', count: ' + this.count
215-
+ ', modifiers: ' + this.modifiers
215+
+ ', modifiers: ' + this.getModifiers(true)
216216
+ ' }';
217217
}
218218
});

src/ui/Event.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ var Event = this.Event = Base.extend({
3535
this.preventDefault();
3636
},
3737

38-
getModifiers: function() {
39-
return Key.modifiers;
38+
getModifiers: function(asString) {
39+
return asString ? '{ ' + Base.each(Key.modifiers, function(value, key) {
40+
this.push(key + ': ' + value);
41+
}, []).join(', ') + ' }' : Key.modifiers;
4042
}
4143
});

src/ui/KeyEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var KeyEvent = this.KeyEvent = Event.extend(new function() {
2727
return '{ type: ' + this.type
2828
+ ', key: ' + this.key
2929
+ ', character: ' + this.character
30-
+ ', modifiers: ' + this.modifiers
30+
+ ', modifiers: ' + this.getModifiers(true)
3131
+ ' }';
3232
}
3333
};

0 commit comments

Comments
 (0)