aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-06 18:52:28 +0100
committerUlrich-Matthias Schäfer <ulima.ums@googlemail.com>2017-03-06 18:52:28 +0100
commit41b55427a71f85e444a8729a552b4db5aa9ac772 (patch)
treedbc1283dcf058c020151981c2754d9a4b9c76492 /src
parent9ceaf63493ded5caa3e2eb89203d88c645b856b4 (diff)
downloadsvg.js-41b55427a71f85e444a8729a552b4db5aa9ac772.tar.gz
svg.js-41b55427a71f85e444a8729a552b4db5aa9ac772.zip
make flip working with both axis when no parameter / only offset is passed
Diffstat (limited to 'src')
-rw-r--r--src/matrix.js7
-rw-r--r--src/sugar.js3
2 files changed, 8 insertions, 2 deletions
diff --git a/src/matrix.js b/src/matrix.js
index 356b790..c040b7a 100644
--- a/src/matrix.js
+++ b/src/matrix.js
@@ -115,7 +115,12 @@ SVG.Matrix = SVG.invent({
}
// Flip matrix on x or y, at a given offset
, flip: function(a, o) {
- return a == 'x' ? this.scale(-1, 1, o, 0) : this.scale(1, -1, 0, o)
+ o = typeof a == 'number' ? a : o
+ return a == 'x' ?
+ this.scale(-1, 1, o, 0) :
+ a == 'y' ?
+ this.scale(1, -1, 0, o) :
+ this.scale(-1, -1, o, o)
}
// Skew
, skew: function(x, y, cx, cy) {
diff --git a/src/sugar.js b/src/sugar.js
index e5bea4e..098c892 100644
--- a/src/sugar.js
+++ b/src/sugar.js
@@ -53,7 +53,8 @@ SVG.extend(SVG.Element, SVG.FX, {
}
// Map flip to transform
, flip: function(a, o) {
- return this.transform({ flip: a, offset: o })
+ o = typeof a == 'number' ? a : o
+ return this.transform({ flip: a || 'both', offset: o })
}
// Map matrix to transform
, matrix: function(m) {