mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Define PaperScope#paper as a reference to the local scope.
And use it to fix Raster JSON example.
This commit is contained in:
parent
c76dae5b06
commit
df80eb2f23
2 changed files with 13 additions and 1 deletions
|
@ -15,7 +15,7 @@
|
||||||
</script>
|
</script>
|
||||||
<script type="text/paperscript" canvas="canvas2">
|
<script type="text/paperscript" canvas="canvas2">
|
||||||
window.importJSON = function(json) {
|
window.importJSON = function(json) {
|
||||||
project.activate();
|
paper.activate();
|
||||||
console.log(json);
|
console.log(json);
|
||||||
project.importJSON(json);
|
project.importJSON(json);
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,18 @@ var PaperScope = Base.extend(/** @lends PaperScope# */{
|
||||||
return this._tool;
|
return this._tool;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A reference to the local scope. This is required, so `paper` will always
|
||||||
|
* refer to the local scope, even when calling into it from another scope.
|
||||||
|
* `paper.activate();` will have to be called in such a situation.
|
||||||
|
* @type PaperScript
|
||||||
|
* @private
|
||||||
|
* @bean
|
||||||
|
*/
|
||||||
|
getPaper: function() {
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The list of available tools.
|
* The list of available tools.
|
||||||
* @name PaperScope#tools
|
* @name PaperScope#tools
|
||||||
|
|
Loading…
Reference in a new issue