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;
// TODO: What to return if nothing is defined, e.g. empty Groups?
// Scriptographer behaves weirdly then too.
if (!children || children.length == 0)
if (!children || children.length === 0)
return new Rectangle();
// Call _updateBoundsCache() even when the group is currently empty
// (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:
if (rect.width != bounds.width || rect.height != bounds.height) {
matrix.scale(
bounds.width != 0 ? rect.width / bounds.width : 1,
bounds.height != 0 ? rect.height / bounds.height : 1);
bounds.width !== 0 ? rect.width / bounds.width : 1,
bounds.height !== 0 ? rect.height / bounds.height : 1);
}
// Translate to bounds center:
center = bounds.getCenter();

View file

@ -1173,7 +1173,7 @@ new function() { // // Scope to inject various curve evaluation methods
statics: {
evaluateMethods: methods
}
})
});
},
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) {
if (start === undefined)
start = offset < 0 ? 1 : 0
start = offset < 0 ? 1 : 0;
if (offset === 0)
return start;
// 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.
distRatio >= 2 ? [p0, p1, p3]
// 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.
: [p0, p1, p2, p3],
// Line [p0, p3] is part of the hull.

View file

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

View file

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

View file

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

View file

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

View file

@ -55,7 +55,7 @@ var View = Base.extend(Emitter, /** @lends View# */{
function getSize(name) {
return element[name] || parseInt(element.getAttribute(name), 10);
};
}
function getCanvasSize() {
// 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.
? new Size(getSize('width'), getSize('height'))
: size;
};
}
// If the element has the resize attribute, listen to resize events and
// update its coordinate space accordingly