summaryrefslogtreecommitdiffstats
path: root/src/point.js
diff options
context:
space:
mode:
authorSaivan <savian@me.com>2018-03-05 02:24:43 +1100
committerSaivan <savian@me.com>2018-03-05 02:24:43 +1100
commit4a03212d2dfac7079d51bd98faefe423889761cf (patch)
tree7cc09f4340d98ffc8317ab40b47028810b8cb167 /src/point.js
parentc64401369e6a2e066c9a38abd7b0e385555fe36d (diff)
downloadsvg.js-4a03212d2dfac7079d51bd98faefe423889761cf.tar.gz
svg.js-4a03212d2dfac7079d51bd98faefe423889761cf.zip
Fixed recommendations by @Fuzzyma regarding transforms
This commit fixes a number of issues with transformations: - Removed move/dmove/etc... on groups - Sugar was being passed origin instead of ox, oy - Updated the changelog - Removed parseMatrix in favor of new SVG.Matrix() - .matrix is the getter for a matrix, not .transform - added a [02:24:41] Using gulpfile ~/Desktop/svg/svg.js/gulpfile.js [02:24:41] Starting 'lint'... [02:24:43] Finished 'lint' after 2.32 s directive
Diffstat (limited to 'src/point.js')
-rw-r--r--src/point.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/point.js b/src/point.js
index afb972f..437f83c 100644
--- a/src/point.js
+++ b/src/point.js
@@ -1,19 +1,18 @@
SVG.Point = SVG.invent({
// Initialize
- create: function (x, y) {
- var base = {x: 0, y: 0}
+ 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 != null ? {x: x, y: (y != null ? y : x)}
- : base // If y has no value, then x is used has its value
+ : {x: x, y: y}
// merge source
- this.x = source.x
- this.y = source.y
+ this.x = source.x == null ? base.x : source.x
+ this.y = source.y == null ? base.y : source.y
},
// Add methods