mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-13 06:29:11 -04:00
Paperscript#run: keep tool on global the paper object.
This commit is contained in:
parent
c7cefcba3a
commit
fed52bd521
1 changed files with 3 additions and 3 deletions
|
@ -131,14 +131,14 @@ var PaperScript = new function() {
|
|||
|
||||
function run(code) {
|
||||
with (paper) {
|
||||
var tool = /onMouse(?:Up|Down|Move|Drag)/.test(code) && new Tool();
|
||||
paper.tool = /onMouse(?:Up|Down|Move|Drag)/.test(code) && new Tool();
|
||||
var res = eval(compile(code));
|
||||
if (tool) {
|
||||
if (paper.tool) {
|
||||
Base.each(['onEditOptions', 'onOptions', 'onSelect',
|
||||
'onDeselect', 'onReselect', 'onMouseDown', 'onMouseUp',
|
||||
'onMouseDrag', 'onMouseMove'], function(key) {
|
||||
try {
|
||||
tool[key] = eval(key);
|
||||
paper.tool[key] = eval(key);
|
||||
} catch (e) {
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue