diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 3f0deb72..974baa44 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -150,15 +150,15 @@ var PaperScript = this.PaperScript = new function() { } } //#endif // BROWSER + // Set currently active scope. + paper = scope; var view = scope.view, // TODO: Add support for multiple tools tool = scope.tool = /on(?:Key|Mouse)(?:Up|Down|Move|Drag)/.test(code) - && new Tool(null, scope), + && new Tool(), res; // Define variables for potential handlers, so eval() calls below to // fetch their values do not require try-catch around them. - // Set currently active scope. - paper = scope; // Use with(){} in order to make the scope the current 'global' scope // instead of window. with (scope) { diff --git a/src/tool/Tool.js b/src/tool/Tool.js index 2ca8c8bd..5051134a 100644 --- a/src/tool/Tool.js +++ b/src/tool/Tool.js @@ -48,11 +48,9 @@ */ var Tool = this.Tool = Base.extend(/** @lends Tool# */{ // DOCS: rewrite Tool constructor explanation - /** - * Initializes the tool's settings, so a new tool can be assigned to it - */ - initialize: function(handlers, scope) { - this._scope = scope; + initialize: function() { + // Store reference to the currently active global paper scope: + this._scope = paper; this._firstMove = true; this._count = 0; this._downCount = 0;