mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-07-29 07:09:45 -04:00
Further refine Node.js integration.
This commit is contained in:
parent
82b9cb3dbf
commit
dd96d67fe1
4 changed files with 9 additions and 7 deletions
src/node
|
@ -87,8 +87,6 @@ var context = vm.createContext({
|
|||
|
||||
// Load Paper.js library files:
|
||||
context.include('paper.js');
|
||||
// Fix version now. Remove 2nd dot, so we can make a float out of it:
|
||||
options.version = parseFloat(json.version.replace(/(.)(\d)$/, '$2'));
|
||||
|
||||
// Since the context used for Paper.js compilation, and the context in which
|
||||
// Node.js scripts are executed do not share the definition of Object, we need
|
||||
|
@ -109,7 +107,9 @@ Base.isPlainObject = function(obj) {
|
|||
Base.each({
|
||||
Canvas: Canvas,
|
||||
XMLSerializer: XMLSerializer,
|
||||
DOMParser: DOMParser
|
||||
DOMParser: DOMParser,
|
||||
// Also fix version. Remove 2nd dot, so we can make a float out of it:
|
||||
version: parseFloat(json.version.replace(/(.)(\d)$/, '$2'))
|
||||
}, function(value, key) {
|
||||
this[key] = value;
|
||||
}, context.PaperScope.prototype);
|
||||
|
@ -125,4 +125,4 @@ require.extensions['.pjs'] = function(module, uri) {
|
|||
module.exports = scope;
|
||||
};
|
||||
|
||||
module.exports = new context.PaperScope();
|
||||
module.exports = context.paper;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue