Add alternative code for setting handler on tool that does not rely on eval(), commented out for now.

This commit is contained in:
Jürg Lehni 2011-05-15 23:56:41 +01:00
parent 5bc2889f1c
commit 690a79722f

View file

@ -145,6 +145,17 @@ var PaperScript = this.PaperScript = new function() {
onFrame, onResize;
var res = eval(compile(code));
if (tool) {
// We could do this instead to avoid eval(), but it's more code:
// tool.onEditOptions = onEditOptions;
// tool.onSelect = onSelect;
// tool.onDeselect = onDeselect;
// tool.onReselect = onReselect;
// tool.onMouseDown = onMouseDown;
// tool.onMouseUp = onMouseUp;
// tool.onMouseDrag = onMouseDrag;
// tool.onMouseMove = onMouseMove;
// tool.onKeyDown = onKeyDown;
// tool.onKeyUp = onKeyUp;
Base.each(['onEditOptions', 'onSelect', 'onDeselect',
'onReselect', 'onMouseDown', 'onMouseUp', 'onMouseDrag',
'onMouseMove', 'onKeyDown', 'onKeyUp'],