diff --git a/lib/bootstrap.js b/lib/bootstrap.js index b6c0a954..1a08c7c0 100644 --- a/lib/bootstrap.js +++ b/lib/bootstrap.js @@ -147,11 +147,8 @@ var Base = new function() { // Bootstrap scope // with optional arguments and as beans should not declare // the parameters and use the arguments array internally // instead. - if (beans && (bean = name.match(/^(get|is)(([A-Z])(.*))$/)) - // Reg-exp to detect non-hidden parameters. We only - // produce beans if there are no parameters or only - // hidden ones: - && !/^function\s*\(.*\b[^_,].*\)/.test(val)) + if (beans && val.length === 0 + && (bean = name.match(/^(get|is)(([A-Z])(.*))$/))) beans.push([ bean[3].toLowerCase() + bean[4], bean[2] ]); } // No need to look up getter if this is a function already. diff --git a/src/basic/Point.js b/src/basic/Point.js index f750f9d9..de3b5b1c 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -504,9 +504,9 @@ var Point = this.Point = Base.extend(/** @lends Point# */{ * @bean * @type Number */ - getAngle: function(_point) { + getAngle: function(/* point */) { // Hide parameters from Bootstrap so it injects bean too - return this.getAngleInRadians(_point) * 180 / Math.PI; + return this.getAngleInRadians(arguments[0]) * 180 / Math.PI; }, setAngle: function(angle) { @@ -542,9 +542,9 @@ var Point = this.Point = Base.extend(/** @lends Point# */{ * @bean * @type Number */ - getAngleInRadians: function(_point) { + getAngleInRadians: function(/* point */) { // Hide parameters from Bootstrap so it injects bean too - if (_point === undefined) { + if (arguments[0] === undefined) { if (this._angle == null) this._angle = Math.atan2(this.y, this.x); return this._angle; @@ -559,8 +559,8 @@ var Point = this.Point = Base.extend(/** @lends Point# */{ } }, - getAngleInDegrees: function(_point) { - return this.getAngle(_point); + getAngleInDegrees: function(/* point */) { + return this.getAngle(arguments[0]); }, /** diff --git a/src/basic/Rectangle.js b/src/basic/Rectangle.js index 491e20ff..417dd174 100644 --- a/src/basic/Rectangle.js +++ b/src/basic/Rectangle.js @@ -167,10 +167,10 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{ * @type Point * @bean */ - getPoint: function(_dontLink) { + getPoint: function(/* dontLink */) { // Pass on the optional argument _dontLink which tells LinkedPoint to // produce a normal point instead. Used internally for speed reasons. - return LinkedPoint.create(this, 'setPoint', this.x, this.y, _dontLink); + return LinkedPoint.create(this, 'setPoint', this.x, this.y, arguments[0]); }, setPoint: function(point) { @@ -187,9 +187,9 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{ * @type Size * @bean */ - getSize: function(_dontLink) { + getSize: function(/* dontLink */) { return LinkedSize.create(this, 'setSize', this.width, this.height, - _dontLink); + arguments[0]); }, setSize: function(size) { @@ -307,9 +307,9 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{ * @type Point * @bean */ - getCenter: function(_dontLink) { + getCenter: function(/* dontLink */) { return LinkedPoint.create(this, 'setCenter', - this.getCenterX(), this.getCenterY(), _dontLink); + this.getCenterX(), this.getCenterY(), arguments[0]); }, setCenter: function(point) { @@ -725,9 +725,9 @@ var Rectangle = this.Rectangle = Base.extend(/** @lends Rectangle# */{ setY = 'set' + y, get = 'get' + part, set = 'set' + part; - this[get] = function(_dontLink) { + this[get] = function(/* dontLink */) { return LinkedPoint.create(this, set, - this[getX](), this[getY](), _dontLink); + this[getX](), this[getY](), arguments[0]); }; this[set] = function(point) { point = Point.read(arguments); diff --git a/src/item/Item.js b/src/item/Item.js index f77ab2bb..273db523 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -512,7 +512,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ * // Move the circle 100 points to the right * circle.position.x += 100; */ - getPosition: function(_dontLink) { + getPosition: function(/* dontLink */) { // Cache position value. // Pass true for dontLink in getCenter(), so receive back a normal point var pos = this._position @@ -521,7 +521,7 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ // use them to calculate the difference in #setPosition, as when it is // modified, it would hold new values already and only then cause the // calling of #setPosition. - return _dontLink ? pos + return arguments[0] ? pos : LinkedPoint.create(this, 'setPosition', pos.x, pos.y); }, @@ -565,13 +565,13 @@ var Item = this.Item = Base.extend(Callback, /** @lends Item# */{ // Produce getters for bounds properties. These handle caching, matrices // and redirect the call to the private _getBounds, which can be // overridden by subclasses, see below. - this[name] = function(_matrix) { + this[name] = function(/* matrix */) { var getter = this._boundsGetter, // Allow subclasses to override _boundsGetter if they use // the same calculations for multiple type of bounds. // The default is name: bounds = this._getCachedBounds(typeof getter == 'string' - ? getter : getter && getter[name] || name, _matrix); + ? getter : getter && getter[name] || name, arguments[0]); // If we're returning 'bounds', create a LinkedRectangle that uses // the setBounds() setter to update the Item whenever the bounds are // changed: diff --git a/src/item/Raster.js b/src/item/Raster.js index 327d68e9..1f8b7398 100644 --- a/src/item/Raster.js +++ b/src/item/Raster.js @@ -154,13 +154,13 @@ var Raster = this.Raster = PlacedItem.extend(/** @lends Raster# */{ * @type Context * @bean */ - getContext: function(_notifyChange) { + getContext: function(/* notifyChange */) { if (!this._context) this._context = this.getCanvas().getContext('2d'); // Support a hidden parameter that indicates if the context will be used // to modify the Raster object. We can notify such changes ahead since // they are only used afterwards for redrawing. - if (_notifyChange) + if (arguments[0]) this._changed(/*#=*/ Change.PIXELS); return this._context; }, diff --git a/src/path/Curve.js b/src/path/Curve.js index 762c959e..29ea4b66 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -235,11 +235,13 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{ * @bean */ // Hide parameters from Bootstrap so it injects bean too - getLength: function(_from, _to) { - var fullLength = arguments.length == 0 || _from == 0 && _to == 1; + getLength: function(/* from, to */) { + var from = arguments[0], + to = arguments[1], + fullLength = arguments.length == 0 || from == 0 && to == 1; if (fullLength && this._length != null) return this._length; - var length = Curve.getLength(this.getValues(), _from, _to); + var length = Curve.getLength(this.getValues(), from, to); if (fullLength) this._length = length; return length; diff --git a/src/path/Path.js b/src/path/Path.js index e7050b77..6035c1a8 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -131,7 +131,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ * @type Curve[] * @bean */ - getCurves: function(_includeFill) { + getCurves: function(/* includeFill */) { var curves = this._curves, segments = this._segments; if (!curves) { @@ -148,7 +148,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{ // If we're asked to include the closing curve for fill, even if the // path is not closed for stroke, create a new uncached array and add // the closing curve. Used in Path#contains() - if (_includeFill && !this._closed && this._style._fillColor) { + if (arguments[0] && !this._closed && this._style._fillColor) { curves = curves.concat([ Curve.create(this, segments[segments.length - 1], segments[0]) ]);