diff options
author | Saivan <savian@me.com> | 2018-02-27 00:48:11 +1100 |
---|---|---|
committer | Saivan <savian@me.com> | 2018-02-27 00:48:11 +1100 |
commit | bec7881979149425a9c1b894f4741413b28c8141 (patch) | |
tree | 3a496f834520925686af3a8059766b61b65be390 /src/ellipse.js | |
parent | ec0a8aee0e21a93b22c255dae6768a9ff7b09e73 (diff) | |
download | svg.js-bec7881979149425a9c1b894f4741413b28c8141.tar.gz svg.js-bec7881979149425a9c1b894f4741413b28c8141.zip |
The first half of the library complies with Standard linting
This commit reformats the code so that it complies with the
standard linting style. Its currently a work in progress, but
it is meant to pave the way for linting in the build process
Diffstat (limited to 'src/ellipse.js')
-rw-r--r-- | src/ellipse.js | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/ellipse.js b/src/ellipse.js index da8dfea..42d772a 100644 --- a/src/ellipse.js +++ b/src/ellipse.js @@ -1,53 +1,53 @@ SVG.Circle = SVG.invent({ // Initialize node - create: 'circle' + create: 'circle', // Inherit from -, inherit: SVG.Shape + inherit: SVG.Shape, // Add parent method -, construct: { + construct: { // Create circle element, based on ellipse - circle: function(size) { - return this.put(new SVG.Circle).rx(new SVG.Number(size).divide(2)).move(0, 0) + circle: function (size) { + return this.put(new SVG.Circle()).rx(new SVG.Number(size).divide(2)).move(0, 0) } } }) SVG.extend([SVG.Circle, SVG.FX], { // Radius x value - rx: function(rx) { + rx: function (rx) { return this.attr('r', rx) - } + }, // Alias radius x value -, ry: function(ry) { + ry: function (ry) { return this.rx(ry) } }) SVG.Ellipse = SVG.invent({ // Initialize node - create: 'ellipse' + create: 'ellipse', // Inherit from -, inherit: SVG.Shape + inherit: SVG.Shape, // Add parent method -, construct: { + construct: { // Create an ellipse - ellipse: function(width, height) { - return this.put(new SVG.Ellipse).size(width, height).move(0, 0) + ellipse: function (width, height) { + return this.put(new SVG.Ellipse()).size(width, height).move(0, 0) } } }) SVG.extend([SVG.Ellipse, SVG.Rect, SVG.FX], { // Radius x value - rx: function(rx) { + rx: function (rx) { return this.attr('rx', rx) - } + }, // Radius y value -, ry: function(ry) { + ry: function (ry) { return this.attr('ry', ry) } }) @@ -55,35 +55,35 @@ SVG.extend([SVG.Ellipse, SVG.Rect, SVG.FX], { // Add common method SVG.extend([SVG.Circle, SVG.Ellipse], { // Move over x-axis - x: function(x) { - return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()) - } + x: function (x) { + return x == null ? this.cx() - this.rx() : this.cx(x + this.rx()) + }, // Move over y-axis - , y: function(y) { - return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()) - } + y: function (y) { + return y == null ? this.cy() - this.ry() : this.cy(y + this.ry()) + }, // Move by center over x-axis - , cx: function(x) { - return x == null ? this.attr('cx') : this.attr('cx', x) - } + cx: function (x) { + return x == null ? this.attr('cx') : this.attr('cx', x) + }, // Move by center over y-axis - , cy: function(y) { - return y == null ? this.attr('cy') : this.attr('cy', y) - } + cy: function (y) { + return y == null ? this.attr('cy') : this.attr('cy', y) + }, // Set width of element - , width: function(width) { - return width == null ? this.rx() * 2 : this.rx(new SVG.Number(width).divide(2)) - } + width: function (width) { + return width == null ? this.rx() * 2 : this.rx(new SVG.Number(width).divide(2)) + }, // Set height of element - , height: function(height) { - return height == null ? this.ry() * 2 : this.ry(new SVG.Number(height).divide(2)) - } + height: function (height) { + return height == null ? this.ry() * 2 : this.ry(new SVG.Number(height).divide(2)) + }, // Custom size function - , size: function(width, height) { - var p = proportionalSize(this, width, height) + size: function (width, height) { + var p = proportionalSize(this, width, height) - return this + return this .rx(new SVG.Number(p.width).divide(2)) .ry(new SVG.Number(p.height).divide(2)) - } -})
\ No newline at end of file + } +}) |