diff --git a/examples/Tools/MultipleTools.html b/examples/Tools/MultipleTools.html new file mode 100644 index 00000000..d2c21ee6 --- /dev/null +++ b/examples/Tools/MultipleTools.html @@ -0,0 +1,44 @@ + + + + +Mulitple Tools + + + + + + Lines + Clouds + + + diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 0d0b569b..efb8f52b 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -387,9 +387,11 @@ Base.exports.PaperScript = (function() { paper = scope; var view = scope.getView(), // Only create a tool if the tool object is accessed or something - // resembling a global tool handler is contained in the code. + // resembling a global tool handler is contained in the code, but + // no tool objects are actually created. tool = /\btool\.\w+|\s+on(?:Key|Mouse)(?:Up|Down|Move|Drag)\b/ - .test(code) ? new Tool() : null, + .test(code) && !/\bnew\s+Tool\b/.test(code) + ? new Tool() : null, toolHandlers = tool ? tool._events : [], // Compile a list of all handlers that can be defined globally // inside the PaperScript. These are passed on to the function as