Fixed JS Hint errors

This commit is contained in:
ippo615
2013-07-11 19:47:33 -04:00
parent 1cbc3dd31c
commit 1d375fb711
5 changed files with 35 additions and 28 deletions

View File

@@ -30,7 +30,7 @@
child; child;
while(children.length > 0) { while(children.length > 0) {
var child = children[0]; child = children[0];
if (child.hasChildren()) { if (child.hasChildren()) {
child.removeChildren(); child.removeChildren();
} }

View File

@@ -105,6 +105,7 @@
radiusPlus1 = radius + 1, radiusPlus1 = radius + 1,
sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2, sumFactor = radiusPlus1 * ( radiusPlus1 + 1 ) / 2,
stackStart = new BlurStack(), stackStart = new BlurStack(),
stackEnd = null,
stack = stackStart, stack = stackStart,
stackIn = null, stackIn = null,
stackOut = null, stackOut = null,
@@ -113,7 +114,7 @@
for ( i = 1; i < div; i++ ) { for ( i = 1; i < div; i++ ) {
stack = stack.next = new BlurStack(); stack = stack.next = new BlurStack();
if ( i == radiusPlus1 ) var stackEnd = stack; if ( i == radiusPlus1 ) stackEnd = stack;
} }
stack.next = stackStart; stack.next = stackStart;
@@ -167,7 +168,7 @@
for ( x = 0; x < width; x++ ) for ( x = 0; x < width; x++ )
{ {
pixels[yi+3] = pa = (a_sum * mul_sum) >> shg_sum; pixels[yi+3] = pa = (a_sum * mul_sum) >> shg_sum;
if ( pa != 0 ) if ( pa !== 0 )
{ {
pa = 255 / pa; pa = 255 / pa;
pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa; pixels[yi] = ((r_sum * mul_sum) >> shg_sum) * pa;

View File

@@ -5,11 +5,11 @@
var d = []; var d = [];
d.push(idata.data[idx++], idata.data[idx++], idata.data[idx++], idata.data[idx++]); d.push(idata.data[idx++], idata.data[idx++], idata.data[idx++], idata.data[idx++]);
return d; return d;
}; }
function rgbDistance(p1, p2) { function rgbDistance(p1, p2) {
return Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2) + Math.pow(p1[2] - p2[2], 2)); return Math.sqrt(Math.pow(p1[0] - p2[0], 2) + Math.pow(p1[1] - p2[1], 2) + Math.pow(p1[2] - p2[2], 2));
}; }
function rgbMean(pTab) { function rgbMean(pTab) {
var m = [0, 0, 0]; var m = [0, 0, 0];
@@ -25,7 +25,7 @@
m[2] /= pTab.length; m[2] /= pTab.length;
return m; return m;
}; }
function backgroundMask(idata, threshold) { function backgroundMask(idata, threshold) {
var rgbv_no = pixelAt(idata, 0, 0); var rgbv_no = pixelAt(idata, 0, 0);
@@ -49,13 +49,13 @@
return mask; return mask;
} }
}; }
function applyMask(idata, mask) { function applyMask(idata, mask) {
for (var i = 0; i < idata.width * idata.height; i++) { for (var i = 0; i < idata.width * idata.height; i++) {
idata.data[4 * i + 3] = mask[i]; idata.data[4 * i + 3] = mask[i];
} }
}; }
function erodeMask(mask, sw, sh) { function erodeMask(mask, sw, sh) {
@@ -89,7 +89,7 @@
} }
return maskResult; return maskResult;
}; }
function dilateMask(mask, sw, sh) { function dilateMask(mask, sw, sh) {
@@ -123,7 +123,7 @@
} }
return maskResult; return maskResult;
}; }
function smoothEdgeMask(mask, sw, sh) { function smoothEdgeMask(mask, sw, sh) {
@@ -171,7 +171,7 @@
Kinetic.Filters.Mask = function(idata) { Kinetic.Filters.Mask = function(idata) {
// Detect pixels close to the background color // Detect pixels close to the background color
var threshold = this.getFilterThreshold(), var threshold = this.getFilterThreshold(),
mask = backgroundMask(idata, threshold); mask = backgroundMask(idata, threshold);
if (mask) { if (mask) {
// Erode // Erode
mask = erodeMask(mask, idata.width, idata.height); mask = erodeMask(mask, idata.width, idata.height);

View File

@@ -90,11 +90,13 @@
_addListeners: function(context) { _addListeners: function(context) {
var that = this, var that = this,
n; n;
var func = function(){
that._sync();
};
// update text data for certain attr changes // update text data for certain attr changes
for(n = 0; n < attrChangeListLen; n++) { for(n = 0; n < attrChangeListLen; n++) {
context.on(ATTR_CHANGE_LIST[n] + CHANGE_KINETIC, function() { context.on(ATTR_CHANGE_LIST[n] + CHANGE_KINETIC, func);
that._sync();
});
} }
}, },
getWidth: function() { getWidth: function() {
@@ -292,4 +294,4 @@
* @method * @method
* @memberof Kinetic.Tag.prototype * @memberof Kinetic.Tag.prototype
*/ */
})(); })();

View File

@@ -235,7 +235,7 @@
// init context point // init context point
var cpx = 0; var cpx = 0;
var cpy = 0; var cpy = 0;
for(var n = 1; n < arr.length; n++) { for( n = 1; n < arr.length; n++) {
var str = arr[n]; var str = arr[n];
var c = str.charAt(0); var c = str.charAt(0);
str = str.slice(1); str = str.slice(1);
@@ -259,6 +259,10 @@
var cmd = null; var cmd = null;
var points = []; var points = [];
var startX = cpx, startY = cpy; var startX = cpx, startY = cpy;
// Move var from within the switch to up here (jshint)
var prevCmd, ctlPtx, ctlPty; // Ss, Tt
var rx, ry, psi, fa, fs, x1, y1; // Aa
// convert l, H, h, V, and v to L // convert l, H, h, V, and v to L
switch (c) { switch (c) {
@@ -328,8 +332,8 @@
points.push(cpx, cpy); points.push(cpx, cpy);
break; break;
case 'S': case 'S':
var ctlPtx = cpx, ctlPty = cpy; ctlPtx = cpx, ctlPty = cpy;
var prevCmd = ca[ca.length - 1]; prevCmd = ca[ca.length - 1];
if(prevCmd.command === 'C') { if(prevCmd.command === 'C') {
ctlPtx = cpx + (cpx - prevCmd.points[2]); ctlPtx = cpx + (cpx - prevCmd.points[2]);
ctlPty = cpy + (cpy - prevCmd.points[3]); ctlPty = cpy + (cpy - prevCmd.points[3]);
@@ -341,8 +345,8 @@
points.push(cpx, cpy); points.push(cpx, cpy);
break; break;
case 's': case 's':
var ctlPtx = cpx, ctlPty = cpy; ctlPtx = cpx, ctlPty = cpy;
var prevCmd = ca[ca.length - 1]; prevCmd = ca[ca.length - 1];
if(prevCmd.command === 'C') { if(prevCmd.command === 'C') {
ctlPtx = cpx + (cpx - prevCmd.points[2]); ctlPtx = cpx + (cpx - prevCmd.points[2]);
ctlPty = cpy + (cpy - prevCmd.points[3]); ctlPty = cpy + (cpy - prevCmd.points[3]);
@@ -367,8 +371,8 @@
points.push(cpx, cpy); points.push(cpx, cpy);
break; break;
case 'T': case 'T':
var ctlPtx = cpx, ctlPty = cpy; ctlPtx = cpx, ctlPty = cpy;
var prevCmd = ca[ca.length - 1]; prevCmd = ca[ca.length - 1];
if(prevCmd.command === 'Q') { if(prevCmd.command === 'Q') {
ctlPtx = cpx + (cpx - prevCmd.points[0]); ctlPtx = cpx + (cpx - prevCmd.points[0]);
ctlPty = cpy + (cpy - prevCmd.points[1]); ctlPty = cpy + (cpy - prevCmd.points[1]);
@@ -379,8 +383,8 @@
points.push(ctlPtx, ctlPty, cpx, cpy); points.push(ctlPtx, ctlPty, cpx, cpy);
break; break;
case 't': case 't':
var ctlPtx = cpx, ctlPty = cpy; ctlPtx = cpx, ctlPty = cpy;
var prevCmd = ca[ca.length - 1]; prevCmd = ca[ca.length - 1];
if(prevCmd.command === 'Q') { if(prevCmd.command === 'Q') {
ctlPtx = cpx + (cpx - prevCmd.points[0]); ctlPtx = cpx + (cpx - prevCmd.points[0]);
ctlPty = cpy + (cpy - prevCmd.points[1]); ctlPty = cpy + (cpy - prevCmd.points[1]);
@@ -391,14 +395,14 @@
points.push(ctlPtx, ctlPty, cpx, cpy); points.push(ctlPtx, ctlPty, cpx, cpy);
break; break;
case 'A': case 'A':
var rx = p.shift(), ry = p.shift(), psi = p.shift(), fa = p.shift(), fs = p.shift(); rx = p.shift(), ry = p.shift(), psi = p.shift(), fa = p.shift(), fs = p.shift();
var x1 = cpx, y1 = cpy; cpx = p.shift(), cpy = p.shift(); x1 = cpx, y1 = cpy; cpx = p.shift(), cpy = p.shift();
cmd = 'A'; cmd = 'A';
points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi); points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi);
break; break;
case 'a': case 'a':
var rx = p.shift(), ry = p.shift(), psi = p.shift(), fa = p.shift(), fs = p.shift(); rx = p.shift(), ry = p.shift(), psi = p.shift(), fa = p.shift(), fs = p.shift();
var x1 = cpx, y1 = cpy; cpx += p.shift(), cpy += p.shift(); x1 = cpx, y1 = cpy; cpx += p.shift(), cpy += p.shift();
cmd = 'A'; cmd = 'A';
points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi); points = this.convertEndpointToCenterParameterization(x1, y1, cpx, cpy, fa, fs, rx, ry, psi);
break; break;