diff --git a/src/core/PaperScope.js b/src/core/PaperScope.js index 2cd65362..d9f3efe8 100644 --- a/src/core/PaperScope.js +++ b/src/core/PaperScope.js @@ -126,10 +126,22 @@ var PaperScope = this.PaperScope = Base.extend(/** @lends PaperScope# */{ * paper.install(window); */ install: function(scope) { + // Define project, view and tool as getters, so they are kept up to date + var that = this; + Base.each(['project', 'view', 'tool'], function(key) { + Base.define(scope, key, { + configurable: true, + writable: true, + get: function() { + return that[key]; + } + }); + }); // Use scope as side-car (= 'this' inside iterator), and have it // returned at the end. return Base.each(this, function(value, key) { - this[key] = value; + if (!(key in this)) + this[key] = value; }, scope); },