diff options
author | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-06-13 01:43:37 +0200 |
---|---|---|
committer | Ulrich-Matthias Schäfer <ulima.ums@googlemail.com> | 2023-06-13 01:43:37 +0200 |
commit | 03322672782a6318b019eff33fe44ec800d6f12c (patch) | |
tree | 9d807e1585cf28a1ea98e87b855932dba00f1880 /src/elements/Line.js | |
parent | 8e18b4698edd00f83af0be05bb3374f92fecaeb9 (diff) | |
download | svg.js-03322672782a6318b019eff33fe44ec800d6f12c.tar.gz svg.js-03322672782a6318b019eff33fe44ec800d6f12c.zip |
dependency updates, easier formatting
Diffstat (limited to 'src/elements/Line.js')
-rw-r--r-- | src/elements/Line.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/elements/Line.js b/src/elements/Line.js index 9350a23..0dab35d 100644 --- a/src/elements/Line.js +++ b/src/elements/Line.js @@ -12,25 +12,25 @@ import * as pointed from '../modules/core/pointed.js' export default class Line extends Shape { // Initialize node - constructor (node, attrs = node) { + constructor(node, attrs = node) { super(nodeOrNew('line', node), attrs) } // Get array - array () { + array() { return new PointArray([ - [ this.attr('x1'), this.attr('y1') ], - [ this.attr('x2'), this.attr('y2') ] + [this.attr('x1'), this.attr('y1')], + [this.attr('x2'), this.attr('y2')] ]) } // Move by left top corner - move (x, y) { + move(x, y) { return this.attr(this.array().move(x, y).toLine()) } // Overwrite native plot() method - plot (x1, y1, x2, y2) { + plot(x1, y1, x2, y2) { if (x1 == null) { return this.array() } else if (typeof y1 !== 'undefined') { @@ -43,7 +43,7 @@ export default class Line extends Shape { } // Set element size to given width and height - size (width, height) { + size(width, height) { const p = proportionalSize(this, width, height) return this.attr(this.array().size(p.width, p.height).toLine()) } @@ -58,8 +58,8 @@ registerMethods({ // make sure plot is called as a setter // x1 is not necessarily a number, it can also be an array, a string and a PointArray return Line.prototype.plot.apply( - this.put(new Line()) - , args[0] != null ? args : [ 0, 0, 0, 0 ] + this.put(new Line()), + args[0] != null ? args : [0, 0, 0, 0] ) }) } |