diff --git a/examples/Scripts/RotationRaster.html b/examples/Scripts/RotationRaster.html
index fc2f0d8e..a494360e 100644
--- a/examples/Scripts/RotationRaster.html
+++ b/examples/Scripts/RotationRaster.html
@@ -15,7 +15,7 @@
for (var x = 0; x < size.width; x++) {
for (var y = 0; y < size.height; y++) {
var gray = raster.getPixel(x, y).gray * 0.9;
- if(gray > 0.1) {
+ if (gray > 0.1) {
var pos = new Point(x, y) * colSize + colSize / 2;
var rectSize = gray * colSize.width;
var path = new Path.Rectangle([0, 0], [rectSize, rectSize]);
diff --git a/examples/Tools/MetaBalls.html b/examples/Tools/MetaBalls.html
index 42cf3a3c..ef225f86 100644
--- a/examples/Tools/MetaBalls.html
+++ b/examples/Tools/MetaBalls.html
@@ -63,7 +63,7 @@
if (radius1 == 0 || radius2 == 0)
return;
- if(d > maxDistance || d <= Math.abs(radius1 - radius2)) {
+ if (d > maxDistance || d <= Math.abs(radius1 - radius2)) {
return;
} else if (d < radius1 + radius2) { // case circles are overlapping
u1 = Math.acos((radius1 * radius1 + d * d - radius2 * radius2) / (2 * radius1 * d));
diff --git a/examples/Tools/VoronoiTool.html b/examples/Tools/VoronoiTool.html
index 707134f7..b20b67be 100644
--- a/examples/Tools/VoronoiTool.html
+++ b/examples/Tools/VoronoiTool.html
@@ -17,10 +17,10 @@
// altDown = Key.isDown('alt');
voronoiDrawer.initialize();
- if(altDown || shiftDown)
+ if (altDown || shiftDown)
var removed = voronoiDrawer.removePoint(event.point);
- if(altDown) {
- if(removed) {
+ if (altDown) {
+ if (removed) {
voronoiDrawer.initPoints();
voronoiDrawer.render();
}
@@ -30,8 +30,8 @@
}
function onMouseDrag(event) {
- if(!altDown) {
- if(event.count == 1)
+ if (!altDown) {
+ if (event.count == 1)
voronoiDrawer.showPointsDown();
voronoiDrawer.addAndRender(event.point, true, true)
voronoiDrawer.showPointsDrag();
@@ -39,10 +39,10 @@
}
function onMouseUp(event) {
- if(!altDown && !shiftDown) {
+ if (!altDown && !shiftDown) {
voronoiDrawer.addAndRender(event.point, false, false)
}
- if(shiftDown) {
+ if (shiftDown) {
voronoiDrawer.initPoints();
voronoiDrawer.render();
}
@@ -65,13 +65,13 @@
// });
// for (var i = 0, l = groups.length; i < l; i++) {
// var group = groups[i];
- // if(group.name == 'Voronoi') {
+ // if (group.name == 'Voronoi') {
// this.group = group;
// this.vGroup = group.children['vGroup'];
// i = l;
// }
// }
- if(!this.group) {
+ if (!this.group) {
this.group = new Group();
this.group.name = 'Voronoi';
this.group.data = {};
@@ -144,16 +144,16 @@
path.strokeColor='black';
path.strokeWidth = offset * 2;
var offsetted = path.expand();
- if(offsetted && offsetted.children.length) {
+ if (offsetted && offsetted.children.length) {
var compoundPath = offsetted.children[0];
- if(compoundPath.children.length) {
+ if (compoundPath.children.length) {
var inner = offsetted.children[0].children[0];
inner.moveAbove(offsetted);
inner.fillColor = 'black';
}
offsetted.remove();
}
- if(inner)
+ if (inner)
inner.data.path = cloned;
return inner;
},
@@ -164,7 +164,7 @@
var segment = path.segments[i];
var nextSegment = path.segments[i + 1 >= l ? (i + 1) % l : i + 1];
var length = (nextSegment.point - segment.point).length;
- if(length / averageLength < 0.1) {
+ if (length / averageLength < 0.1) {
var prevSegment = path.segments[i - 1 < 0 ? l - 1 : i - 1];
var line1 = new Line(prevSegment.point, segment.point, true);
var afterSegment = path.segments[i + 2 >= l ? (i + 2) % l : i + 2];
@@ -204,16 +204,16 @@
drawVoronoi: function(diagram, activePoint) {
- if(this.points.length == 2)
+ if (this.points.length == 2)
this.drawCell(diagram, 0, activePoint);
var newCell = this.drawCell(diagram, this.points.length - 1, activePoint);
- if(!activePoint && newCell) {
+ if (!activePoint && newCell) {
var checkPath = newCell.data.path;
for (var i = 0, l = this.vGroup.children.length; i < l; i++) {
var path = this.vGroup.children[i];
var toCheckPath = path.data.path;
- if(toCheckPath && checkPath.bounds.intersects(toCheckPath.bounds)) {// && toCheckPath.intersects(checkPath)) {
+ if (toCheckPath && checkPath.bounds.intersects(toCheckPath.bounds)) {// && toCheckPath.intersects(checkPath)) {
var index = this.findIndex(toCheckPath.data.center);
path.remove();
this.drawCell(diagram, index, activePoint);
@@ -230,12 +230,12 @@
removePoint: function(point) {
var hitResult = this.vGroup.hitTest(point);
- if(hitResult) {
+ if (hitResult) {
var point = hitResult.item.data.path.data.center;
var segments = this.group.data.path.segments;
for (var i = 0, l = segments.length; i < l; i++) {
var segment = segments[i];
- if(point == segment.point.multiply(100).round()) {
+ if (point == segment.point.multiply(100).round()) {
i = l;
segment.remove();
}
@@ -246,7 +246,7 @@
findIndex: function(point) {
for (var i = 0, l = this.points.length; i < l; i++) {
- if(point == this.points[i].multiply(100).round())
+ if (point == this.points[i].multiply(100).round())
return i;
}
},
@@ -262,13 +262,13 @@
var path = new Path();
//path.strokeColor = 'black';
path.data = {};
- if(remove) {
+ if (remove) {
path.removeOn({
drag: true,
up: true
});
}
- if(!remove)
+ if (!remove)
this.vGroup.appendTop(path);
var startPoint = new Point(halfedges[0].getStartpoint());
@@ -281,16 +281,16 @@
path.closed = true;
path.fillColor = new GrayColor(1 - path.length / 4000);
- if(values.drawBlobs) {
+ if (values.drawBlobs) {
var offPath = this.getOffsettedPath(path);
- if(offPath) {
+ if (offPath) {
this.removeSmallBits(offPath);
this.roundPath(offPath);
- if(values.smoothBlobs) {
+ if (values.smoothBlobs) {
offPath.smooth();
}
- if(!remove) {
+ if (!remove) {
this.vGroup.appendTop(offPath);
} else {
offPath.removeOn({
@@ -313,19 +313,19 @@
},
fastRender: function(activePoint) {
- if(!this.vGroup) {
+ if (!this.vGroup) {
this.vGroup = new Group();
this.vGroup.name = 'vGroup';
this.group.appendTop(this.vGroup);
}
this.voronoi.setSites(this.points);
var diagram = this.voronoi.compute(this.bbox);
- if(this.points.length > 1)
+ if (this.points.length > 1)
this.drawVoronoi(diagram, activePoint);
},
render: function() {
- if(this.vGroup)
+ if (this.vGroup)
this.vGroup.remove();
this.vGroup = new Group();
this.vGroup.name = 'vGroup';
@@ -337,11 +337,11 @@
addAndRender: function(point, preview, remove) {
- if(remove) this.pop();
+ if (remove) this.pop();
this.addPoint(point);
this.initPoints();
- if(preview) {
+ if (preview) {
this.render(point);
} else {
this.render(null, true);
@@ -364,7 +364,7 @@
// var vPoints = [];
// // Now we bring up the dialog
// var values = Dialog.prompt('Settings', components);
- // if(values) {
+ // if (values) {
// this.columns = values.columns;
// this.rows = values.rows * 2;
//
@@ -373,7 +373,7 @@
// for (var i = -1; i < this.columns + 1; i++) {
// for (var j = -1; j < this.rows + 1; j++) {
// var point = new Point(i, j) / new Point(size) * document.bounds.size + col / 2;
- // if(j % 4 == 2 || j% 4 == 3) {
+ // if (j % 4 == 2 || j% 4 == 3) {
// point += new Point(col.width / 2, 0);
// }
//
@@ -393,7 +393,7 @@
var vPoints = [];
// Now we bring up the dialog
var values = Dialog.prompt('Settings', components);
- if(values) {
+ if (values) {
this.columns = values.columns;
this.rows = values.rows;
@@ -402,9 +402,9 @@
for (var i = -1; i < this.columns + 1; i++) {
for (var j = -1; j < this.rows + 1; j++) {
var point = new Point(i, j) / new Point(size) * document.bounds.size + col / 2;
- if(j % 2)
+ if (j % 2)
point += new Point(col.width / 2, 0);
- if(values.loose)
+ if (values.loose)
point += (col / 4) * Point.random() - col / 4;
vPoints.push(point);
}
@@ -422,7 +422,7 @@
var vPoints = [];
// Now we bring up the dialog
var values = Dialog.prompt('Settings', components);
- if(values) {
+ if (values) {
this.columns = values.columns;
this.rows = values.rows;
var size = new Size(this.columns, this.rows);
@@ -431,11 +431,11 @@
for (var j = -1; j < this.rows; j++) {
var point = new Point(i, j) / size * document.bounds.size + col / 2;
- if(j % 2)
+ if (j % 2)
point += new Point(col.width / 2, 0);
- if(i % 2)
+ if (i % 2)
point += new Point(0, col.height / 2);
- if(values.loose)
+ if (values.loose)
point += (col / 8) * Point.random() - col / 8;
vPoints.push(point);
}
@@ -452,7 +452,7 @@
var vPoints = [];
// Now we bring up the dialog
var values = Dialog.prompt('Settings', components);
- if(values) {
+ if (values) {
this.columns = values.columns;
this.rows = values.rows;
this.parts = values.parts;
@@ -463,7 +463,7 @@
for (var i = -1; i < this.columns + 1; i++) {
for (var j = -1; j < this.rows + 1; j++) {
var point = new Point(i, j) / new Point(size) * document.bounds.size + col / 2;
- if(this.loose)
+ if (this.loose)
point += (col / 4) * Point.random() - col / 4;
vPoints.push(point);
}
@@ -480,7 +480,7 @@
var vPoints = [];
// Now we bring up the dialog
var values = Dialog.prompt('Settings', components);
- if(values) {
+ if (values) {
this.columns = values.columns;
this.rows = values.rows;
this.parts = values.parts;
@@ -490,7 +490,7 @@
for (var i = -1; i < this.columns + 1; i++) {
for (var j = -1; j < this.rows + 1; j++) {
var point = new Point(i, j) / new Point(size) * document.bounds.size + col / 2;
- if(j % 2)
+ if (j % 2)
point += new Point(col.width / 2, 0);
vPoints.push(point);
var offset = i % 2 ? 45 : 0;
@@ -542,7 +542,7 @@
selected: true
});
- if(paths.length) {
+ if (paths.length) {
voronoiDrawer.initialize();
for (var i = 0, l = paths.length; i < l; i++) {
var segments = paths[i].segments;
@@ -585,12 +585,12 @@
onClick: function() {
voronoiDrawer.initialize();
var points = drawers[values.drawer]();
- if(points.length) {
+ if (points.length) {
var confirmed = true;
- if(points.length > 800) {
+ if (points.length > 800) {
confirmed = Dialog.confirm('You are about to generate a Voronoi diagram with ' + points.length + ' points. This could take a while and could potentially crash Illustrator. Do you want to live recklessly?');
}
- if(confirmed) {
+ if (confirmed) {
voronoiDrawer.setPoints(points);
voronoiDrawer.render();
}
@@ -604,7 +604,7 @@
components.smoothBlobs.enabled = !!value;
voronoiDrawer.initialize();
voronoiDrawer.initPoints();
- if(voronoiDrawer.points.length)
+ if (voronoiDrawer.points.length)
voronoiDrawer.render();
}
},
@@ -613,7 +613,7 @@
onChange: function(value) {
voronoiDrawer.initialize();
voronoiDrawer.initPoints();
- if(voronoiDrawer.points.length)
+ if (voronoiDrawer.points.length)
voronoiDrawer.render();
}
}
diff --git a/src/color/Gradient.js b/src/color/Gradient.js
index 001859d6..dae47f89 100644
--- a/src/color/Gradient.js
+++ b/src/color/Gradient.js
@@ -20,7 +20,7 @@ var Gradient = this.Gradient = Base.extend({
// TODO: should type here be called 'radial' and have it
// receive a boolean value?
initialize: function(stops, type) {
- if(!stops) {
+ if (!stops) {
stops = [new GradientStop('white', 0),
new GradientStop('black', 1)];
}
@@ -36,12 +36,12 @@ var Gradient = this.Gradient = Base.extend({
if (stops.length < 2)
throw new Error(
'Gradient stop list needs to contain at least two stops.');
- if(!(stops[0] instanceof GradientStop)) {
+ if (!(stops[0] instanceof GradientStop)) {
for (var i = 0, l = stops.length; i < l; i++) {
var rampPoint;
var stop = stops[i];
// If it is an array, the second argument is the rampPoint:
- if(stop.length) {
+ if (stop.length) {
rampPoint = stop[1];
stop = stop[0];
} else {
diff --git a/test/lib/helpers.js b/test/lib/helpers.js
index 39aecd9e..1f42b806 100644
--- a/test/lib/helpers.js
+++ b/test/lib/helpers.js
@@ -21,9 +21,9 @@ function compareSegments(segment1, segment2) {
}
function compareNumbers(number1, number2, message) {
- if(number1 !== 0)
+ if (number1 !== 0)
number1 = Math.round(number1 * 100) / 100;
- if(number2 !== 0)
+ if (number2 !== 0)
number2 = Math.round(number2 * 100) / 100;
equals(number1, number2, message);
}