summaryrefslogtreecommitdiffstats
path: root/src/line.js
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-10-25 23:26:38 +0200
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2018-10-25 23:26:38 +0200
commit464af8b747389b7fdb569a933591c863b9be0f6b (patch)
treea23da0d70a26c142616207b0a0a489affd2f3ac6 /src/line.js
parentf46aedf58fbc93483cb21017ffed10e439830108 (diff)
downloadsvg.js-464af8b747389b7fdb569a933591c863b9be0f6b.tar.gz
svg.js-464af8b747389b7fdb569a933591c863b9be0f6b.zip
Rename files so that they reflect their exported classes (see next commit)
Diffstat (limited to 'src/line.js')
-rw-r--r--src/line.js57
1 files changed, 0 insertions, 57 deletions
diff --git a/src/line.js b/src/line.js
deleted file mode 100644
index da0c0ca..0000000
--- a/src/line.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* global proportionalSize */
-
-SVG.Line = SVG.invent({
- // Initialize node
- create: 'line',
-
- // Inherit from
- inherit: SVG.Shape,
-
- // Add class methods
- extend: {
- // Get array
- array: function () {
- return new SVG.PointArray([
- [ this.attr('x1'), this.attr('y1') ],
- [ this.attr('x2'), this.attr('y2') ]
- ])
- },
-
- // Overwrite native plot() method
- plot: function (x1, y1, x2, y2) {
- if (x1 == null) {
- return this.array()
- } else if (typeof y1 !== 'undefined') {
- x1 = { x1: x1, y1: y1, x2: x2, y2: y2 }
- } else {
- x1 = new SVG.PointArray(x1).toLine()
- }
-
- return this.attr(x1)
- },
-
- // Move by left top corner
- move: function (x, y) {
- return this.attr(this.array().move(x, y).toLine())
- },
-
- // Set element size to given width and height
- size: function (width, height) {
- var p = proportionalSize(this, width, height)
- return this.attr(this.array().size(p.width, p.height).toLine())
- }
- },
-
- // Add parent method
- construct: {
- // Create a line element
- line: function (x1, y1, x2, y2) {
- // make sure plot is called as a setter
- // x1 is not necessarily a number, it can also be an array, a string and a SVG.PointArray
- return SVG.Line.prototype.plot.apply(
- this.put(new SVG.Line())
- , x1 != null ? [x1, y1, x2, y2] : [0, 0, 0, 0]
- )
- }
- }
-})