Rename options.server to options.node

This commit is contained in:
Jürg Lehni 2013-05-28 00:01:55 -07:00
parent cd7db56249
commit 6fa6c022c9
5 changed files with 11 additions and 11 deletions

View file

@ -31,4 +31,4 @@ then
fi fi
./preprocess.sh $MODE ../src/paper.js "-d '{ \"browser\": true }' -i '../src/constants.js'" ../dist/paper.js ./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

View file

@ -239,9 +239,9 @@ var Raster = Item.extend(/** @lends Raster# */{
this._image = image; this._image = image;
/*#*/ if (options.browser) { /*#*/ if (options.browser) {
this._size = new Size(image.naturalWidth, image.naturalHeight); this._size = new Size(image.naturalWidth, image.naturalHeight);
/*#*/ } else if (options.server) { /*#*/ } else if (options.node) {
this._size = new Size(image.width, image.height); this._size = new Size(image.width, image.height);
/*#*/ } // options.server /*#*/ } // options.node
this._canvas = null; this._canvas = null;
this._context = null; this._context = null;
this._changed(/*#=*/ Change.GEOMETRY); this._changed(/*#=*/ Change.GEOMETRY);
@ -295,13 +295,13 @@ var Raster = Item.extend(/** @lends Raster# */{
} else if (!image.src) { } else if (!image.src) {
image.src = src; image.src = src;
} }
/*#*/ } else if (options.server) { /*#*/ } else if (options.node) {
// If we're running on the server and it's a string, // If we're running on the server and it's a string,
// load it from disk: // load it from disk:
// TODO: load images async, calling setImage once loaded as above // TODO: load images async, calling setImage once loaded as above
var image = new Image(); var image = new Image();
image.src = fs.readFileSync(src); image.src = fs.readFileSync(src);
/*#*/ } // options.server /*#*/ } // options.node
this.setImage(image); this.setImage(image);
}, },

View file

@ -24,7 +24,7 @@ eval(fs.readFileSync(path.resolve(__dirname, '../options.js'), 'utf8'));
// compilation of separate files, and set to correct value after. // compilation of separate files, and set to correct value after.
options.version = 'dev'; options.version = 'dev';
options.browser = false; options.browser = false;
options.server = true; options.node = true;
options.stats = false; options.stats = false;
// Create a document and a window using jsdom, e.g. for exportSVG() // Create a document and a window using jsdom, e.g. for exportSVG()

View file

@ -169,8 +169,8 @@ var CanvasView = View.extend(/** @lends CanvasView# */{
}; };
}); });
/*#*/ if (options.server) { /*#*/ if (options.node) {
// Node.js server based image exporting code. // Node.js based image exporting code.
CanvasView.inject(new function() { CanvasView.inject(new function() {
// Utility function that converts a number to a string with // Utility function that converts a number to a string with
// x amount of padded 0 digits: // x amount of padded 0 digits:
@ -252,4 +252,4 @@ CanvasView.inject(new function() {
} }
}; };
}); });
/*#*/ } // options.server /*#*/ } // options.node

View file

@ -83,11 +83,11 @@ var View = Base.extend(Callback, /** @lends View# */{
style.top = offset.y + 'px'; style.top = offset.y + 'px';
document.body.appendChild(stats); document.body.appendChild(stats);
} }
/*#*/ } else if (options.server) { /*#*/ } else if (options.node) {
// Generate an id for this view // Generate an id for this view
this._id = 'view-' + View._id++; this._id = 'view-' + View._id++;
size = new Size(element.width, element.height); size = new Size(element.width, element.height);
/*#*/ } // options.server /*#*/ } // options.node
// Keep track of views internally // Keep track of views internally
View._views.push(this); View._views.push(this);
// Link this id to our view // Link this id to our view