From 6fa6c022c9edd348cd7c5633aa2b34f80c5e46ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 28 May 2013 00:01:55 -0700 Subject: [PATCH] Rename options.server to options.node --- build/build.sh | 2 +- src/item/Raster.js | 8 ++++---- src/node/index.js | 2 +- src/ui/CanvasView.js | 6 +++--- src/ui/View.js | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/build/build.sh b/build/build.sh index bc29c1a4..f0769341 100755 --- a/build/build.sh +++ b/build/build.sh @@ -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 diff --git a/src/item/Raster.js b/src/item/Raster.js index 5b7a33e7..ef8ef98b 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.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); }, diff --git a/src/node/index.js b/src/node/index.js index 3b95bcf2..fe96aea3 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -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() diff --git a/src/ui/CanvasView.js b/src/ui/CanvasView.js index 14c71786..6e4aa8ed 100644 --- a/src/ui/CanvasView.js +++ b/src/ui/CanvasView.js @@ -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 diff --git a/src/ui/View.js b/src/ui/View.js index a0f9c449..8be7b943 100644 --- a/src/ui/View.js +++ b/src/ui/View.js @@ -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