diff options
author | Saivan <savian@me.com> | 2018-03-02 12:14:42 +1100 |
---|---|---|
committer | Saivan <savian@me.com> | 2018-03-02 12:14:42 +1100 |
commit | 1582edb4236628fbc7875242f159c16283b769c2 (patch) | |
tree | 1d915c21fce7ce3997edaedd92f4f1a8d8968d9d /src/point.js | |
parent | 13cf84b716cd3e06330fa0ea6f077bbe7de0eb88 (diff) | |
download | svg.js-1582edb4236628fbc7875242f159c16283b769c2.tar.gz svg.js-1582edb4236628fbc7875242f159c16283b769c2.zip |
Implemented new transformations
This commit implements the new transformation model, but it also
needs to modify a few tests to fit the new format. This is still
a work in progress.
Diffstat (limited to 'src/point.js')
-rw-r--r-- | src/point.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/point.js b/src/point.js index 682092e..afb972f 100644 --- a/src/point.js +++ b/src/point.js @@ -22,13 +22,14 @@ SVG.Point = SVG.invent({ 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 @@ -39,9 +40,9 @@ SVG.Point = SVG.invent({ 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 @@ -50,9 +51,9 @@ SVG.Point = SVG.invent({ // update with current values point.x = this.x point.y = this.y - return point }, + // transform point with matrix transform: function (matrix) { return new SVG.Point(this.native().matrixTransform(matrix.native())) @@ -66,5 +67,4 @@ SVG.extend(SVG.Element, { point: function (x, y) { return new SVG.Point(x, y).transform(this.screenCTM().inverse()) } - }) |