mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Rename options.server to options.node
This commit is contained in:
parent
cd7db56249
commit
6fa6c022c9
5 changed files with 11 additions and 11 deletions
|
@ -31,4 +31,4 @@ then
|
|||
fi
|
||||
|
||||
./preprocess.sh $MODE ../src/paper.js "-d '{ \"browser\": true }' -i '../src/constants.js'" ../dist/paper.js
|
||||
#./preprocess.sh $MODE ../src/paper.js "-d '{ \"server\": true }' -i '../src/constants.js'" ../dist/paper-server.js
|
||||
#./preprocess.sh $MODE ../src/paper.js "-d '{ \"node\": true }' -i '../src/constants.js'" ../dist/paper-node.js
|
||||
|
|
|
@ -239,9 +239,9 @@ var Raster = Item.extend(/** @lends Raster# */{
|
|||
this._image = image;
|
||||
/*#*/ if (options.browser) {
|
||||
this._size = new Size(image.naturalWidth, image.naturalHeight);
|
||||
/*#*/ } else if (options.server) {
|
||||
/*#*/ } else if (options.node) {
|
||||
this._size = new Size(image.width, image.height);
|
||||
/*#*/ } // options.server
|
||||
/*#*/ } // options.node
|
||||
this._canvas = null;
|
||||
this._context = null;
|
||||
this._changed(/*#=*/ Change.GEOMETRY);
|
||||
|
@ -295,13 +295,13 @@ var Raster = Item.extend(/** @lends Raster# */{
|
|||
} else if (!image.src) {
|
||||
image.src = src;
|
||||
}
|
||||
/*#*/ } else if (options.server) {
|
||||
/*#*/ } else if (options.node) {
|
||||
// If we're running on the server and it's a string,
|
||||
// load it from disk:
|
||||
// TODO: load images async, calling setImage once loaded as above
|
||||
var image = new Image();
|
||||
image.src = fs.readFileSync(src);
|
||||
/*#*/ } // options.server
|
||||
/*#*/ } // options.node
|
||||
this.setImage(image);
|
||||
},
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ eval(fs.readFileSync(path.resolve(__dirname, '../options.js'), 'utf8'));
|
|||
// compilation of separate files, and set to correct value after.
|
||||
options.version = 'dev';
|
||||
options.browser = false;
|
||||
options.server = true;
|
||||
options.node = true;
|
||||
options.stats = false;
|
||||
|
||||
// Create a document and a window using jsdom, e.g. for exportSVG()
|
||||
|
|
|
@ -169,8 +169,8 @@ var CanvasView = View.extend(/** @lends CanvasView# */{
|
|||
};
|
||||
});
|
||||
|
||||
/*#*/ if (options.server) {
|
||||
// Node.js server based image exporting code.
|
||||
/*#*/ if (options.node) {
|
||||
// Node.js based image exporting code.
|
||||
CanvasView.inject(new function() {
|
||||
// Utility function that converts a number to a string with
|
||||
// x amount of padded 0 digits:
|
||||
|
@ -252,4 +252,4 @@ CanvasView.inject(new function() {
|
|||
}
|
||||
};
|
||||
});
|
||||
/*#*/ } // options.server
|
||||
/*#*/ } // options.node
|
||||
|
|
|
@ -83,11 +83,11 @@ var View = Base.extend(Callback, /** @lends View# */{
|
|||
style.top = offset.y + 'px';
|
||||
document.body.appendChild(stats);
|
||||
}
|
||||
/*#*/ } else if (options.server) {
|
||||
/*#*/ } else if (options.node) {
|
||||
// Generate an id for this view
|
||||
this._id = 'view-' + View._id++;
|
||||
size = new Size(element.width, element.height);
|
||||
/*#*/ } // options.server
|
||||
/*#*/ } // options.node
|
||||
// Keep track of views internally
|
||||
View._views.push(this);
|
||||
// Link this id to our view
|
||||
|
|
Loading…
Reference in a new issue