summaryrefslogtreecommitdiffstats
path: root/src/point.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/point.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/point.js')
-rw-r--r--src/point.js74
1 files changed, 0 insertions, 74 deletions
diff --git a/src/point.js b/src/point.js
deleted file mode 100644
index 6c64ed6..0000000
--- a/src/point.js
+++ /dev/null
@@ -1,74 +0,0 @@
-
-SVG.Point = SVG.invent({
- // Initialize
- create: function (x, y, base) {
- var source
- base = base || {x: 0, y: 0}
-
- // ensure source as object
- source = Array.isArray(x) ? {x: x[0], y: x[1]}
- : typeof x === 'object' ? {x: x.x, y: x.y}
- : {x: x, y: y}
-
- // merge source
- this.x = source.x == null ? base.x : source.x
- this.y = source.y == null ? base.y : source.y
- },
-
- // Add methods
- extend: {
- // Clone point
- clone: function () {
- return new SVG.Point(this)
- },
-
- // Morph one point into another
- morph: function (x, y) {
- // store new destination
- this.destination = new SVG.Point(x, y)
- return this
- },
-
- // Get morphed point at a given position
- at: function (pos) {
- // make sure a destination is defined
- if (!this.destination) return this
-
- // calculate morphed matrix at a given position
- var point = new SVG.Point({
- x: this.x + (this.destination.x - this.x) * pos,
- y: this.y + (this.destination.y - this.y) * pos
- })
- return point
- },
-
- // Convert to native SVGPoint
- native: function () {
- // create new point
- var point = SVG.parser.nodes.svg.node.createSVGPoint()
-
- // update with current values
- point.x = this.x
- point.y = this.y
- return point
- },
-
- // transform point with matrix
- transform: function (m) {
- // Perform the matrix multiplication
- var x = m.a * this.x + m.c * this.y + m.e
- var y = m.b * this.x + m.d * this.y + m.f
-
- // Return the required point
- return new SVG.Point(x, y)
- }
- }
-})
-
-SVG.extend(SVG.Element, {
-
- // Get point
- point: function (x, y) {
- return new SVG.Point(x, y).transform(this.screenCTM().inverse())
- }
-})