diff --git a/examples/Animated/animatedStar.html b/examples/Animated/animatedStar.html index 256ed116..50cdf862 100644 --- a/examples/Animated/animatedStar.html +++ b/examples/Animated/animatedStar.html @@ -29,14 +29,14 @@ count++; doc.activeLayer.children = []; var point = new Point(1024, 768).divide(2); - for(var i = 0; i < 35; i++) { + for (var i = 0; i < 35; i++) { var vector = new Point(20 + 10 * i, 0).rotate(i * (360 / 35 * 2) * Math.sin(count / 150)); var l = vector.length; var path = new Path(); // path.strokeColor = '#000000'; path.fillColor = i % 2 ? 'red' : 'black'; path.closed = true; - for(var j = 0; j < 32; j++) { + for (var j = 0; j < 32; j++) { vector = vector.rotate(45 / 4); var newPoint = point.add(vector).add(vector.rotate(-180).normalize(l * (j % 2 ? 0.1 : -0.1))); path.add(newPoint); diff --git a/examples/Scripts/arcTo.html b/examples/Scripts/arcTo.html index 274e8432..fb20a41c 100644 --- a/examples/Scripts/arcTo.html +++ b/examples/Scripts/arcTo.html @@ -22,15 +22,15 @@ var doc = new Doc(canvas); var point = new Point(1024, 768).divide(2); - for(var i = 0; i < 30; i++) { + for (var i = 0; i < 30; i++) { var vector = new Point(10 + 20 * i, 0).rotate(i); var l = vector.length; var path = new Path(); path.fillColor = i % 2 ? 'red' : 'black'; path.closed = true; - for(var j = 0; j < 17; j++) { + for (var j = 0; j < 17; j++) { vector = vector.rotate(45 / 2); - if(j == 0) { + if (j == 0) { path.add(point.add(vector)); } else { path.arcTo(point.add(vector), true); diff --git a/examples/Scripts/circle.html b/examples/Scripts/circle.html index 19a26f7b..95a7c036 100644 --- a/examples/Scripts/circle.html +++ b/examples/Scripts/circle.html @@ -23,7 +23,7 @@ var canvas = document.getElementById('canvas'); doc = new Doc(canvas); var center = doc.size.divide(2); - for(var i = 0; i < 70; i++) { + for (var i = 0; i < 70; i++) { var path = new Path.Circle(center, i * 5); path.strokeColor = 'black'; } diff --git a/examples/Scripts/lines.html b/examples/Scripts/lines.html index a8fd78ef..f4bfd48b 100644 --- a/examples/Scripts/lines.html +++ b/examples/Scripts/lines.html @@ -30,7 +30,7 @@ doc.activeLayer.children = []; var point = new Point(1024, 768).divide(2); var vector = new Point(100, 0); - for(var i = 0; i < 180; i++) { + for (var i = 0; i < 180; i++) { var path = new Path.Line(point.add(vector.rotate(i * 2).normalize(30)), point.add(vector.rotate(i * 2).normalize(30 + Math.abs(Math.sin((i + count / 20)) * 300)))); path.strokeColor = i % 4 ? 'black' : 'red'; } diff --git a/examples/Scripts/star.html b/examples/Scripts/star.html index a76b2078..9a4ff390 100644 --- a/examples/Scripts/star.html +++ b/examples/Scripts/star.html @@ -22,14 +22,14 @@ var doc = new Doc(canvas); var point = new Point(1024, 768).divide(2); - for(var i = 0; i < 30; i++) { + for (var i = 0; i < 30; i++) { var vector = new Point(1 + 10 * i, 0).rotate(i); var l = vector.length; var path = new Path(); // path.strokeColor = '#000000'; path.fillColor = i % 2 ? 'red' : 'black'; path.closed = true; - for(var j = 0; j < 32; j++) { + for (var j = 0; j < 32; j++) { vector = vector.rotate(45 / 4); var newPoint = point.add(vector).add(vector.rotate(-180).normalize(l * (j % 2 ? 0.1 : -0.1))); path.add(newPoint); diff --git a/examples/Tools/Circles.html b/examples/Tools/Circles.html index 3095593c..68fb9102 100644 --- a/examples/Tools/Circles.html +++ b/examples/Tools/Circles.html @@ -26,7 +26,7 @@ var path; var tool = new Tool({ onMouseDrag: function(event) { - if(path) path.remove(); + if (path) path.remove(); var distance = event.downPoint.subtract(event.point).length; path = new Path.Circle(event.downPoint, distance); path.strokeColor = 'black'; diff --git a/examples/Tools/Fancy Brush.html b/examples/Tools/Fancy Brush.html index 0fda427c..08b541d7 100644 --- a/examples/Tools/Fancy Brush.html +++ b/examples/Tools/Fancy Brush.html @@ -81,7 +81,7 @@ var strokePoints = strokeEnds * 2 + 1; point = point.subtract(step.divide(2)); step = step.divide(strokePoints - 1); - for(var i = 0; i < strokePoints; i++) { + for (var i = 0; i < strokePoints; i++) { var strokePoint = point.add(step.multiply(i)); var offset = delta.multiply(Math.random() * 0.3 + 0.1); if (i % 2) { diff --git a/lib/Bootstrap.js b/lib/Bootstrap.js index cb45b192..7855c86e 100644 --- a/lib/Bootstrap.js +++ b/lib/Bootstrap.js @@ -2451,7 +2451,7 @@ DomDocument = DomElement.extend({ _type: 'document', initialize: function() { - if(Browser.TRIDENT && Browser.VERSION < 7) + if (Browser.TRIDENT && Browser.VERSION < 7) try { // Fix background flickering on IE. this.$.execCommand('BackgroundImageCache', false, true); @@ -4165,7 +4165,7 @@ HtmlFormElement.inject({ setSelection: function(start, end) { var sel = end == undefined ? start : { start: start, end: end }; this.focus(); - if(this.$.setSelectionRange) { + if (this.$.setSelectionRange) { this.$.setSelectionRange(sel.start, sel.end); } else { var value = this.getValue(); @@ -4213,7 +4213,7 @@ HtmlFormElement.inject({ // Fix Firefox scroll bug, see http://userscripts.org/scripts/review/9452, #insertAtCaret() var top = this.$.scrollTop, height = this.$.scrollHeight; this.setValue(current.substring(0, range.start) + value + current.substring(range.end, current.length)); - if(top != null) + if (top != null) this.$.scrollTop = top + this.$.scrollHeight - height; return select || select == undefined ? this.setSelection(range.start, range.start + value.length) diff --git a/src/Paper.js b/src/Paper.js index ad2452a7..6f038aa3 100644 --- a/src/Paper.js +++ b/src/Paper.js @@ -3,7 +3,7 @@ Paper = Base.extend({ documents: [], activateDocument: function(doc) { var index = this.documents.indexOf(doc); - if(index != -1) + if (index != -1) this.document = this.documents[index]; } } diff --git a/src/basic/Point.js b/src/basic/Point.js index ff665c68..05ae8ddf 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -1,23 +1,23 @@ var Point = Base.extend({ beans: true, initialize: function() { - if(arguments.length == 2) { + if (arguments.length == 2) { this.x = arguments[0]; this.y = arguments[1]; - } else if(arguments.length == 1) { + } else if (arguments.length == 1) { var first = arguments[0]; - if(first == null) { + if (first == null) { this.x = this.y = 0; - } else if(first.x !== undefined) { + } else if (first.x !== undefined) { this.x = first.x; this.y = first.y; - } else if(first.width !== undefined) { + } else if (first.width !== undefined) { this.x = first.width; this.y = first.height; - } else if(first.length !== undefined) { + } else if (first.length !== undefined) { this.x = first[0]; this.y = first.length > 1 ? first[1] : first[0]; - } else if(typeof first === 'number') { + } else if (typeof first === 'number') { this.x = this.y = first; } else { this.x = this.y = 0; @@ -145,7 +145,7 @@ var Point = Base.extend({ setAngle: function(angle) { angle = this._angle = angle * Math.PI / 180; - if(!this.isZero()) { + if (!this.isZero()) { var length = this.length; this.x = Math.cos(angle) * length; this.y = Math.sin(angle) * length; @@ -154,10 +154,10 @@ var Point = Base.extend({ getAngle: function() { var angle; - if(arguments.length) { + if (arguments.length) { var point = Point.read(arguments); var div = this.length * point.length; - if(div == 0) { + if (div == 0) { return NaN; } else { angle = Math.acos(this.dot(point) / div); @@ -174,7 +174,7 @@ var Point = Base.extend({ var point = Point.read(arguments); var angle = this.angle - point.angle; var bounds = 180; - if(angle < - bounds) { + if (angle < - bounds) { return angle + bounds * 2; } else if (angle > bounds) { return angle - bounds * 2; @@ -255,7 +255,7 @@ var Point = Base.extend({ project: function() { var point = Point.read(arguments); - if(point.isZero()) { + if (point.isZero()) { return new Point(0, 0); } else { var scale = this.dot(point) / point.dot(point); diff --git a/src/basic/Rectangle.js b/src/basic/Rectangle.js index 38bd70a8..372245eb 100644 --- a/src/basic/Rectangle.js +++ b/src/basic/Rectangle.js @@ -1,14 +1,14 @@ Rectangle = Base.extend({ beans: true, initialize: function() { - if(arguments.length == 1) { + if (arguments.length == 1) { var rect = arguments[0]; this.x = rect.x; this.y = rect.y; this.width = rect.width; this.height = rect.height; - } else if(arguments.length == 2) { - if(arguments[1].x !== undefined) { + } else if (arguments.length == 2) { + if (arguments[1].x !== undefined) { // new Rectangle(point1, point2) var point1 = new Point(arguments[0]); var point2 = new Point(arguments[1]); @@ -16,11 +16,11 @@ Rectangle = Base.extend({ this.y = point1.y; this.width = point2.x - point1.x; this.height = point2.y - point1.y; - if(this.width < 0) { + if (this.width < 0) { this.x = point2.x; this.width = -this.width; } - if(this.height < 0) { + if (this.height < 0) { this.y = point2.y; this.height = -this.height; } @@ -33,7 +33,7 @@ Rectangle = Base.extend({ this.width = size.width; this.height = size.height; } - } else if(arguments.length == 4) { + } else if (arguments.length == 4) { // new Rectangle(x, y, width, height) this.x = arguments[0]; this.y = arguments[1]; @@ -221,7 +221,7 @@ Rectangle = Base.extend({ }, contains: function(rect) { - if(rect.width !== undefined) { + if (rect.width !== undefined) { return rect.x >= this.x && rect.y >= this.y && rect.x + rect.width <= this.x + this.width && rect.y + rect.height <= this.y + this.height; @@ -287,4 +287,4 @@ Rectangle = Base.extend({ } } } -}); \ No newline at end of file +}); diff --git a/src/basic/Size.js b/src/basic/Size.js index 776e5295..b18c5ed6 100644 --- a/src/basic/Size.js +++ b/src/basic/Size.js @@ -1,20 +1,20 @@ var Size = Base.extend({ initialize: function() { - if(arguments.length == 2) { + if (arguments.length == 2) { this.width = arguments[0]; this.height = arguments[1]; - } else if(arguments.length == 1) { + } else if (arguments.length == 1) { var first = arguments[0]; - if(first.width !== undefined || first.height !== undefined) { + if (first.width !== undefined || first.height !== undefined) { this.width = first.width ? first.width : 0; this.height = first.height ? first.height : 0; - } else if(first.x !== undefined || first.y !== undefined) { + } else if (first.x !== undefined || first.y !== undefined) { this.width = first.x ? first.x : 0; this.height = first.y ? first.y : 0; - } else if(first.length !== undefined) { + } else if (first.length !== undefined) { this.width = first[0]; this.height = first.length > 1 ? first[1] : first[0]; - } else if(typeof first === 'number') { + } else if (typeof first === 'number') { this.width = this.height = first; } else { this.width = this.height = 0; @@ -113,4 +113,4 @@ var Size = Base.extend({ return new Size(Math.random(), Math.random()); } } -}); \ No newline at end of file +}); diff --git a/src/document/Doc.js b/src/document/Doc.js index 6978a084..3e7d0b01 100644 --- a/src/document/Doc.js +++ b/src/document/Doc.js @@ -1,6 +1,6 @@ Doc = Base.extend({ initialize: function(canvas) { - if(canvas) { + if (canvas) { this.canvas = canvas; this.ctx = this.canvas.getContext('2d'); this.size = new Size(canvas.offsetWidth, canvas.offsetHeight); @@ -16,11 +16,11 @@ Doc = Base.extend({ }, redraw: function() { - if(this.canvas) { + if (this.canvas) { this.ctx.clearRect(0, 0, this.size.width, this.size.height); - for(var i = 0, l = this.layers.length; i < l; i++) { + for (var i = 0, l = this.layers.length; i < l; i++) { this.layers[i].draw(this.ctx); } } } -}); \ No newline at end of file +}); diff --git a/src/item/Group.js b/src/item/Group.js index b87c4d0a..9b65bf82 100644 --- a/src/item/Group.js +++ b/src/item/Group.js @@ -2,8 +2,8 @@ Group = Item.extend({ initialize: function(items) { this.base(); this.children = []; - if(items) { - for(var i = 0, l = items.length; i < l; i++) { + if (items) { + for (var i = 0, l = items.length; i < l; i++) { this.appendTop(items[i]); } } @@ -11,7 +11,7 @@ Group = Item.extend({ }, draw: function(ctx) { - for(var i = 0, l = this.children.length; i < l; i++) { + for (var i = 0, l = this.children.length; i < l; i++) { this.children[i].draw(ctx); } }, @@ -36,7 +36,7 @@ Group = Item.extend({ setClipped: function(clipped) { this.clipped = clipped; var child = this.firstChild; - if(child) + if (child) child.setClipMask(clipped); } -}); \ No newline at end of file +}); diff --git a/src/item/Item.js b/src/item/Item.js index 66e4ce61..296c273c 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -16,7 +16,7 @@ Item = Base.extend({ copyTo: function(itemOrDocument) { var copy = Base.clone(this); - if(itemOrDocument.layers) { + if (itemOrDocument.layers) { copy.parent = itemOrDocument.activeLayer; itemOrDocument.activeLayer.appendTop(copy); } else { @@ -127,7 +127,7 @@ Item = Base.extend({ setClipMask: function(clipMask) { this.clipMask = clipMask; - if(this.clipMask) { + if (this.clipMask) { this.fillColor = null; this.strokeColor = null; } @@ -137,7 +137,7 @@ Item = Base.extend({ * The first item contained within this item. */ getFirstChild: function() { - if(this.children.length > 0) + if (this.children.length > 0) return this.children[0]; }, @@ -145,7 +145,7 @@ Item = Base.extend({ * The last item contained within this item. */ getLastChild: function() { - if(this.children.length > 0) + if (this.children.length > 0) return this.children[this.children.length - 1]; }, @@ -153,9 +153,9 @@ Item = Base.extend({ * The next item on the same level as this item. */ getNextSibling: function() { - if(this.parent) { + if (this.parent) { var index = this.index + 1; - if(index < this.parent.children.length) + if (index < this.parent.children.length) return this.parent.children[index]; } }, @@ -164,9 +164,9 @@ Item = Base.extend({ * The previous item on the same level as this item. */ getPreviousSibling: function() { - if(this.parent) { + if (this.parent) { var index = this.index - 1; - if(index <= 0) + if (index <= 0) return this.parent.children[index]; } }, @@ -182,7 +182,7 @@ Item = Base.extend({ * Removes the item from its parent's children list. */ removeFromParent: function() { - if(this.parent) + if (this.parent) this.parent.children.splice(this.index, 1); this.parent = null; }, @@ -214,7 +214,7 @@ Item = Base.extend({ isEditable: function() { var parent = this; while(parent) { - if(parent.hidden || parent.locked) + if (parent.hidden || parent.locked) return false; parent = parent.parent; } @@ -350,7 +350,7 @@ Item = Base.extend({ isDescendant: function(item) { var parent = this; while(parent) { - if(parent == item) + if (parent == item) return true; parent = parent.parent; } @@ -375,10 +375,10 @@ Item = Base.extend({ isAncestor: function(item) { var parent = item; while(parent) { - if(parent == this) + if (parent == this) return true; parent = parent.parent; } return false; } -}); \ No newline at end of file +}); diff --git a/src/item/Layer.js b/src/item/Layer.js index fab5e80d..a363990d 100644 --- a/src/item/Layer.js +++ b/src/item/Layer.js @@ -11,8 +11,8 @@ Layer = Item.extend({ }, draw: function(ctx) { - for(var i = 0, l = this.children.length; i < l; i++) { + for (var i = 0, l = this.children.length; i < l; i++) { this.children[i].draw(ctx); } } -}); \ No newline at end of file +}); diff --git a/src/path/Path.js b/src/path/Path.js index 1ca1a357..6937f2ae 100644 --- a/src/path/Path.js +++ b/src/path/Path.js @@ -7,10 +7,10 @@ Path = PathItem.extend({ Line: Base.extend({ initialize: function() { var path = new Path(); - if(arguments.length == 2) { + if (arguments.length == 2) { path.addSegment(new Segment(arguments[0])); path.addSegment(new Segment(arguments[1])); - } else if(arguments.length == 4) { + } else if (arguments.length == 4) { path.addSegment(Segment.read(arguments[0], arguments[1])); path.addSegment(Segment.read(arguments[2], arguments[3])); } @@ -24,7 +24,7 @@ Path = PathItem.extend({ path.closed = true; var rectangle = Rectangle.read(arguments); var corners = ['bottomLeft', 'topLeft', 'topRight', 'bottomRight']; - for(var i = 0; i < 4; i++) { + for (var i = 0; i < 4; i++) { path.add(rectangle[corners[i]]); } return path; @@ -37,7 +37,7 @@ Path = PathItem.extend({ initialize: function() { var path = new Path(); var rect, size; - if(arguments.length == 2) { + if (arguments.length == 2) { rect = new Rectangle(arguments[0]); size = new Size(arguments[1]); } else { @@ -84,7 +84,7 @@ Path = PathItem.extend({ var rect = Rectangle.read(arguments); var topLeft = rect.topLeft; var size = new Size(rect.width, rect.height); - for(var i = 0; i < 4; i++) { + for (var i = 0; i < 4; i++) { var segment = Segment.read([segments[i]]); segment.handleIn = segment.handleIn.multiply(size); segment.handleOut = segment.handleOut.multiply(size); @@ -101,7 +101,7 @@ Path = PathItem.extend({ initialize: function() { var path = new Path(); var center, radius; - if(arguments.length == 3) { + if (arguments.length == 3) { center = new Point(arguments[0], arguments[1]); radius = arguments[2]; } else { @@ -128,4 +128,4 @@ Path = PathItem.extend({ } }) } -}); \ No newline at end of file +}); diff --git a/src/path/PathItem.js b/src/path/PathItem.js index 4f42e698..4d6f722a 100644 --- a/src/path/PathItem.js +++ b/src/path/PathItem.js @@ -51,7 +51,7 @@ PathItem = Item.extend(new function() { if (!segments || segments.length === undefined || typeof segments[0] != 'object') segments = arguments; - for(var i = 0, l = segments.length; i < l; i++) + for (var i = 0, l = segments.length; i < l; i++) this.addSegment(new Segment(segments[i])); }, @@ -156,7 +156,7 @@ PathItem = Item.extend(new function() { add: function() { var segment = Segment.read(arguments); - if(segment) + if (segment) this.addSegment(segment); }, @@ -180,13 +180,13 @@ PathItem = Item.extend(new function() { moveTo: function() { var segment = Segment.read(arguments); - if(segment && !this._segments.length) + if (segment && !this._segments.length) this.addSegment(segment); }, lineTo: function() { var segment = Segment.read(arguments); - if(segment && this._segments.length) + if (segment && this._segments.length) this.addSegment(segment); }, @@ -230,7 +230,7 @@ PathItem = Item.extend(new function() { curveTo: function(through, to, parameter) { through = new Point(through); to = new Point(to); - if(parameter == null) + if (parameter == null) parameter = 0.5; var current = this.currentSegment.point; // handle = (through - (1 - t)^2 * current - t^2 * to) / (2 * (1 - t) * t) @@ -250,11 +250,11 @@ PathItem = Item.extend(new function() { var through, to; // Get the start point: var current = this.currentSegment; - if(arguments[1] && typeof arguments[1] != 'boolean') { + if (arguments[1] && typeof arguments[1] != 'boolean') { through = new Point(arguments[0]); to = new Point(arguments[1]); } else { - if(clockwise === null) + if (clockwise === null) clockwise = true; var middle = current.point.add(to).divide(2); var step = middle.subtract(current.point); @@ -337,7 +337,7 @@ PathItem = Item.extend(new function() { lineBy: function() { var vector = Point.read(arguments); - if(vector) { + if (vector) { var current = this.currentSegment; this.lineTo(current.point.add(vector)); } @@ -457,23 +457,23 @@ PathItem = Item.extend(new function() { }, setCtxStyles: function(ctx) { - for(var i in styleNames) { + for (var i in styleNames) { var style; - if(style = this[i]) + if (style = this[i]) ctx[styleNames[i]] = style; } }, draw: function(ctx) { - if(!this.visible) return; + if (!this.visible) return; ctx.beginPath(); var cp1; - for(var i = 0, l = this._segments.length; i < l; i++) { + for (var i = 0, l = this._segments.length; i < l; i++) { var segment = this._segments[i]; var point = segment.point; var handleIn = segment.handleIn ? segment.handleIn.add(point) : point; var handleOut = segment.handleOut ? segment.handleOut.add(point) : point; - if(i == 0) { + if (i == 0) { ctx.moveTo(point.x, point.y); } else { ctx.bezierCurveTo(cp1.x, cp1.y, handleIn.x, handleIn.y, @@ -481,7 +481,7 @@ PathItem = Item.extend(new function() { } cp1 = handleOut; } - if(this.closed && this._segments.length > 1) { + if (this.closed && this._segments.length > 1) { var segment = this._segments[0]; var point = segment.point; var handleIn = segment.handleIn ? segment.handleIn.add(point) : point; @@ -490,8 +490,8 @@ PathItem = Item.extend(new function() { ctx.closePath(); } this.setCtxStyles(ctx); - if(this.fillColor) ctx.fill(); - if(this.strokeColor) ctx.stroke(); + if (this.fillColor) ctx.fill(); + if (this.strokeColor) ctx.stroke(); } }; -}); \ No newline at end of file +}); diff --git a/src/path/Segment.js b/src/path/Segment.js index 86e1be6f..96ff1b03 100644 --- a/src/path/Segment.js +++ b/src/path/Segment.js @@ -1,29 +1,29 @@ Segment = Base.extend({ initialize: function() { - if(arguments.length == 0) { + if (arguments.length == 0) { this.point = new Point(); - } else if(arguments.length == 1) { - if(arguments[0].point) { + } else if (arguments.length == 1) { + if (arguments[0].point) { var segment = arguments[0]; this.point = new Point(segment.point); - if(segment.handleIn) + if (segment.handleIn) this.handleIn = new Point(segment.handleIn); - if(segment.handleOut) + if (segment.handleOut) this.handleOut = new Point(segment.handleOut); } else { this.point = new Point(arguments[0]); } - } else if(arguments.length < 6) { - if(arguments.length == 2 && !arguments[1].x) { + } else if (arguments.length < 6) { + if (arguments.length == 2 && !arguments[1].x) { this.point = new Point(arguments[0], arguments[1]); } else { this.point = new Point(arguments[0]); - if(arguments[1]) + if (arguments[1]) this.handleIn = new Point(arguments[1]); - if(arguments[2]) + if (arguments[2]) this.handleOut = new Point(arguments[2]); } - } else if(arguments.length == 6) { + } else if (arguments.length == 6) { this.point = new Point(arguments[0], arguments[1]); this.handleIn = new Point(arguments[2], arguments[3]); this.handleOut = new Point(arguments[4], arguments[5]); @@ -36,7 +36,7 @@ Segment = Base.extend({ // TODO: // insert: function() { - // if(this._segments && this._segments.path) { + // if (this._segments && this._segments.path) { // var path = this._segments.path; // path.checkValid(); // @@ -74,8 +74,8 @@ Segment = Base.extend({ getIndex: function() { // TODO: Cache and update indices instead of searching? var segments = this.path._segments; - for(var i = 0, l = segments.length; i < l; i++) { - if(segments[i] == this) + for (var i = 0, l = segments.length; i < l; i++) { + if (segments[i] == this) return i; } }, @@ -86,7 +86,7 @@ Segment = Base.extend({ // todo // getCurve: function() { - // if(this._segments && this._segments.path) { + // if (this._segments && this._segments.path) { // var curves = this._segments.path.getCurves(); // // The curves list handles closing curves, so the curves.size // // is adjusted accordingly. just check to be in the boundaries here: @@ -121,7 +121,7 @@ Segment = Base.extend({ }, remove: function() { - if(this.path && this.path._segments) + if (this.path && this.path._segments) return this.path._segments.splice(this.index, 1); return false; }, @@ -144,4 +144,4 @@ Segment = Base.extend({ } } } -}) \ No newline at end of file +}); diff --git a/src/tool/Tool.js b/src/tool/Tool.js index 5430f7f0..1774ccce 100644 --- a/src/tool/Tool.js +++ b/src/tool/Tool.js @@ -43,4 +43,4 @@ Tool = ToolHandler.extend({ getDocument: function() { return this._document; } -}); \ No newline at end of file +}); diff --git a/src/tool/ToolHandler.js b/src/tool/ToolHandler.js index 733a64d5..510c9686 100644 --- a/src/tool/ToolHandler.js +++ b/src/tool/ToolHandler.js @@ -7,7 +7,7 @@ ToolHandler = Base.extend({ this.firstMove = true; this.count = 0; this.downCount = 0; - for(var i in handlers) { + for (var i in handlers) { this[i] = handlers[i]; } }, @@ -105,7 +105,7 @@ ToolHandler = Base.extend({ switch (type) { case 'MOUSE_DOWN': this.updateEvent(type, pt, null, null, true, false, false); - if(this.onMouseDown) + if (this.onMouseDown) this.onMouseDown(new ToolEvent(this, type, modifiers)); break; case 'MOUSE_DRAG': @@ -121,7 +121,7 @@ ToolHandler = Base.extend({ this.matchMaxDistance = false; while (this.updateEvent(type, pt, this.minDistance, this.maxDistance, false, this.needsChange, this.matchMaxDistance)) { - if(this.onMouseDrag) + if (this.onMouseDrag) this.onMouseDrag(new ToolEvent(this, type, modifiers)); this.needsChange = true; this.matchMaxDistance = true; @@ -132,12 +132,12 @@ ToolHandler = Base.extend({ // mouse drag first, then mouse up. if ((this.point.x != pt.x || this.point.y != pt.y) && this.updateEvent( 'MOUSE_DRAG', pt, this.minDistance, this.maxDistance, false, false, false)) { - if(this.onMouseDrag) + if (this.onMouseDrag) this.onMouseDrag(new ToolEvent(this, type, modifiers)); } this.updateEvent(type, pt, null, this.maxDistance, false, false, false); - if(this.onMouseUp) + if (this.onMouseUp) this.onMouseUp(new ToolEvent(this, type, modifiers)); // Start with new values for TRACK_CURSOR this.updateEvent(type, pt, null, null, true, false, false); @@ -146,11 +146,11 @@ ToolHandler = Base.extend({ case 'MOUSE_MOVE': while (this.updateEvent(type, pt, this.minDistance, this.maxDistance, this.firstMove, true, false)) { - if(this.onMouseMove) + if (this.onMouseMove) this.onMouseMove(new ToolEvent(this, type, modifiers)); this.firstMove = false; } break; } } -}); \ No newline at end of file +}); diff --git a/test/lib/qunit/qunit.js b/test/lib/qunit/qunit.js index 30e03953..894e29b6 100644 --- a/test/lib/qunit/qunit.js +++ b/test/lib/qunit/qunit.js @@ -1004,8 +1004,8 @@ QUnit.equiv = function () { parents.push(a); for (i = 0; i < len; i++) { loop = false; - for(j=0;j