diff --git a/src/basic/Point.js b/src/basic/Point.js index 6534a407..1b325ad1 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -449,14 +449,17 @@ var Point = Base.extend(/** @lends Point# */{ * remain squared, or its square root should be calculated. * @return {Number} */ - getDistance: function(point, squared) { + getDistance: function(_point, squared) { // NOTE: Although we're reading from the argument list, we need the - // above arguments to prevent a bean from being created. - point = Point.read(arguments); - squared = Base.read(arguments); - var x = point.x - this.x, + // above arguments to prevent beans from being created (Strap.js issue). + // And for browser optimization we shouldn't re-asign an object to it, + // but we need to prevent the minifier from removing it again, so: + var point = Point.read(arguments), + x = point.x - this.x, y = point.y - this.y, d = x * x + y * y; + // Reassigning boolean values to arguments is apparently OK. + squared = Base.read(arguments); return squared ? d : Math.sqrt(d); }, @@ -638,9 +641,12 @@ var Point = Base.extend(/** @lends Point# */{ * @param {Point} point * @return {Number} the angle between the two vectors */ - getDirectedAngle: function(point) { + getDirectedAngle: function(_point) { // NOTE: Although we're reading from the argument list, we need the - // above argument to prevent a bean from being created. + // above arguments to prevent beans from being created (Strap.js issue). + // And for browser optimization we shouldn't re-asign an object to it, + // but we need to prevent the minifier from removing it again, so: + var point = _point; point = Point.read(arguments); return Math.atan2(this.cross(point), this.dot(point)) * 180 / Math.PI; }, diff --git a/src/core/PaperScript.js b/src/core/PaperScript.js index 367eab22..fd8bdb34 100644 --- a/src/core/PaperScript.js +++ b/src/core/PaperScript.js @@ -14,7 +14,7 @@ * @name PaperScript * @namespace */ -var PaperScript = Base.exports.PaperScript = (function() { +Base.exports.PaperScript = (function() { // Locally turn of exports and define for inlined acorn / esprima. // Just declaring the local vars is enough, as they will be undefined. var exports, define, diff --git a/src/style/Color.js b/src/style/Color.js index 74859645..23c5438b 100644 --- a/src/style/Color.js +++ b/src/style/Color.js @@ -1137,7 +1137,6 @@ var Color = Base.extend(new function() { this[name] = function(color) { color = Color.read(arguments); var type = this._type, - properties = this._properties, components1 = this._components, components2 = color._convert(type); for (var i = 0, l = components1.length; i < l; i++)