mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-08 05:42:07 -05:00
Have Events print modifiers correctly in #toString().
This commit is contained in:
parent
5a9dc3dece
commit
04ff593adc
3 changed files with 6 additions and 4 deletions
|
@ -212,7 +212,7 @@ var ToolEvent = this.ToolEvent = Base.extend({
|
||||||
return '{ type: ' + this.type
|
return '{ type: ' + this.type
|
||||||
+ ', point: ' + this.point
|
+ ', point: ' + this.point
|
||||||
+ ', count: ' + this.count
|
+ ', count: ' + this.count
|
||||||
+ ', modifiers: ' + this.modifiers
|
+ ', modifiers: ' + this.getModifiers(true)
|
||||||
+ ' }';
|
+ ' }';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,7 +35,9 @@ var Event = this.Event = Base.extend({
|
||||||
this.preventDefault();
|
this.preventDefault();
|
||||||
},
|
},
|
||||||
|
|
||||||
getModifiers: function() {
|
getModifiers: function(asString) {
|
||||||
return Key.modifiers;
|
return asString ? '{ ' + Base.each(Key.modifiers, function(value, key) {
|
||||||
|
this.push(key + ': ' + value);
|
||||||
|
}, []).join(', ') + ' }' : Key.modifiers;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,7 +27,7 @@ var KeyEvent = this.KeyEvent = Event.extend(new function() {
|
||||||
return '{ type: ' + this.type
|
return '{ type: ' + this.type
|
||||||
+ ', key: ' + this.key
|
+ ', key: ' + this.key
|
||||||
+ ', character: ' + this.character
|
+ ', character: ' + this.character
|
||||||
+ ', modifiers: ' + this.modifiers
|
+ ', modifiers: ' + this.getModifiers(true)
|
||||||
+ ' }';
|
+ ' }';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue