Fix various JS linting problems.

This commit is contained in:
Jürg Lehni 2015-10-27 23:35:30 +01:00
parent ac7c272401
commit 8eb0dcc87d
7 changed files with 19 additions and 19 deletions

View file

@ -843,7 +843,7 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
var children = this._children; var children = this._children;
// TODO: What to return if nothing is defined, e.g. empty Groups? // TODO: What to return if nothing is defined, e.g. empty Groups?
// Scriptographer behaves weirdly then too. // Scriptographer behaves weirdly then too.
if (!children || children.length == 0) if (!children || children.length === 0)
return new Rectangle(); return new Rectangle();
// Call _updateBoundsCache() even when the group is currently empty // Call _updateBoundsCache() even when the group is currently empty
// (or only holds empty / invisible items), so future changes in these // (or only holds empty / invisible items), so future changes in these
@ -880,8 +880,8 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
// Scale to new Size, if size changes and avoid divisions by 0: // Scale to new Size, if size changes and avoid divisions by 0:
if (rect.width != bounds.width || rect.height != bounds.height) { if (rect.width != bounds.width || rect.height != bounds.height) {
matrix.scale( matrix.scale(
bounds.width != 0 ? rect.width / bounds.width : 1, bounds.width !== 0 ? rect.width / bounds.width : 1,
bounds.height != 0 ? rect.height / bounds.height : 1); bounds.height !== 0 ? rect.height / bounds.height : 1);
} }
// Translate to bounds center: // Translate to bounds center:
center = bounds.getCenter(); center = bounds.getCenter();

View file

@ -1173,7 +1173,7 @@ new function() { // // Scope to inject various curve evaluation methods
statics: { statics: {
evaluateMethods: methods evaluateMethods: methods
} }
}) });
}, },
new function() { // Scope for methods that require private functions new function() { // Scope for methods that require private functions
@ -1308,7 +1308,7 @@ new function() { // Scope for methods that require private functions
getParameterAt: function(v, offset, start) { getParameterAt: function(v, offset, start) {
if (start === undefined) if (start === undefined)
start = offset < 0 ? 1 : 0 start = offset < 0 ? 1 : 0;
if (offset === 0) if (offset === 0)
return start; return start;
// See if we're going forward or backward, and handle cases // See if we're going forward or backward, and handle cases
@ -1557,7 +1557,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
// p2 is inside, the hull is a triangle. // p2 is inside, the hull is a triangle.
distRatio >= 2 ? [p0, p1, p3] distRatio >= 2 ? [p0, p1, p3]
// p1 is inside, the hull is a triangle. // p1 is inside, the hull is a triangle.
: distRatio <= .5 ? [p0, p2, p3] : distRatio <= 0.5 ? [p0, p2, p3]
// Hull is a quadrilateral, we need all lines in correct order. // Hull is a quadrilateral, we need all lines in correct order.
: [p0, p1, p2, p3], : [p0, p1, p2, p3],
// Line [p0, p3] is part of the hull. // Line [p0, p3] is part of the hull.

View file

@ -1206,7 +1206,7 @@ var Path = PathItem.extend(/** @lends Path# */{
if (typeof arg === 'number') if (typeof arg === 'number')
arg = this.getLocationAt(arg); arg = this.getLocationAt(arg);
if (!arg) if (!arg)
return null return null;
// split(location) // split(location)
index = arg.index; index = arg.index;
parameter = arg.parameter; parameter = arg.parameter;

View file

@ -101,7 +101,7 @@ var PathIterator = Base.extend({
var i, j = this.index; var i, j = this.index;
for (;;) { for (;;) {
i = j; i = j;
if (j == 0 || this.parts[--j].offset < offset) if (j === 0 || this.parts[--j].offset < offset)
break; break;
} }
// Find the part that succeeds the given offset, then interpolate // Find the part that succeeds the given offset, then interpolate

View file

@ -289,7 +289,7 @@ var Tool = PaperScopeItem.extend(/** @lends Tool# */{
return false; return false;
// Produce a new point on the way to point if point is further // Produce a new point on the way to point if point is further
// away than maxDistance // away than maxDistance
if (maxDistance != null && maxDistance != 0) { if (maxDistance != null && maxDistance !== 0) {
if (distance > maxDistance) { if (distance > maxDistance) {
point = this._point.add(vector.normalize(maxDistance)); point = this._point.add(vector.normalize(maxDistance));
} else if (matchMaxDistance) { } else if (matchMaxDistance) {

View file

@ -312,10 +312,10 @@ var Numerical = new function() {
// iteration) and solve the quadratic. // iteration) and solve the quadratic.
x = -(b / a) / 3; x = -(b / a) / 3;
// Evaluate q, q', b1 and c2 at x // Evaluate q, q', b1 and c2 at x
tmp = a * x, tmp = a * x;
b1 = tmp + b, b1 = tmp + b;
c2 = b1 * x + c, c2 = b1 * x + c;
qd = (tmp + b1) * x + c2, qd = (tmp + b1) * x + c2;
q = c2 * x + d; q = c2 * x + d;
// Get a good initial approximation. // Get a good initial approximation.
t = q /a; t = q /a;
@ -329,10 +329,10 @@ var Numerical = new function() {
do { do {
x = x0; x = x0;
// Evaluate q, q', b1 and c2 at x // Evaluate q, q', b1 and c2 at x
tmp = a * x, tmp = a * x;
b1 = tmp + b, b1 = tmp + b;
c2 = b1 * x + c, c2 = b1 * x + c;
qd = (tmp + b1) * x + c2, qd = (tmp + b1) * x + c2;
q = c2 * x + d; q = c2 * x + d;
// Newton's. Divide by ec to avoid x0 crossing over a // Newton's. Divide by ec to avoid x0 crossing over a
// root. // root.

View file

@ -55,7 +55,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
function getSize(name) { function getSize(name) {
return element[name] || parseInt(element.getAttribute(name), 10); return element[name] || parseInt(element.getAttribute(name), 10);
}; }
function getCanvasSize() { function getCanvasSize() {
// Try visible size first, since that will help handling previously // Try visible size first, since that will help handling previously
@ -67,7 +67,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
// Reading the attributes should still work. // Reading the attributes should still work.
? new Size(getSize('width'), getSize('height')) ? new Size(getSize('width'), getSize('height'))
: size; : size;
}; }
// If the element has the resize attribute, listen to resize events and // If the element has the resize attribute, listen to resize events and
// update its coordinate space accordingly // update its coordinate space accordingly