summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/group.js4
-rw-r--r--src/helpers.js6
-rw-r--r--src/matrix.js6
3 files changed, 8 insertions, 8 deletions
diff --git a/src/group.js b/src/group.js
index a7ec2e0..1808b3f 100755
--- a/src/group.js
+++ b/src/group.js
@@ -9,11 +9,11 @@ SVG.G = SVG.invent({
, extend: {
// Move over x-axis
x: function(x) {
- return x == null ? this.ctm().x : this.transform('x', x)
+ return x == null ? this.transform('x') : this.transform({ x: x })
}
// Move over y-axis
, y: function(y) {
- return y == null ? this.ctm().y : this.transform('y', y)
+ return y == null ? this.transform('y') : this.transform({ y: y })
}
// Move by center over x-axis
, cx: function(x) {
diff --git a/src/helpers.js b/src/helpers.js
index b22a559..ae4eb04 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -42,10 +42,10 @@ function proportionalSize(box, width, height) {
}
// Delta transform point
-function deltaTransformPoint(matrix, point) {
+function deltaTransformPoint(matrix, x, y) {
return {
- x: point.x * matrix.a + point.y * matrix.c + 0
- , y: point.x * matrix.b + point.y * matrix.d + 0
+ x: x * matrix.a + y * matrix.c + 0
+ , y: x * matrix.b + y * matrix.d + 0
}
}
diff --git a/src/matrix.js b/src/matrix.js
index b6c839d..314e1e0 100644
--- a/src/matrix.js
+++ b/src/matrix.js
@@ -4,7 +4,7 @@ SVG.Matrix = SVG.invent({
var i, base = arrayToMatrix([1, 0, 0, 1, 0, 0])
// Ensure source as object
- source = source.node && source.node.getCTM ?
+ source = source && source.node && source.node.getCTM ?
source.node.getCTM() :
typeof source === 'string' ?
arrayToMatrix(source.replace(/\s/g, '').split(',')) :
@@ -25,8 +25,8 @@ SVG.Matrix = SVG.invent({
// Extract individual transformations
extract: function() {
// Find transform points
- var px = deltaTransformPoint(this, { x: 0, y: 1 })
- , py = deltaTransformPoint(this, { x: 1, y: 0 })
+ var px = deltaTransformPoint(this, 0, 1)
+ , py = deltaTransformPoint(this, 1, 0)
, skewX = 180 / Math.PI * Math.atan2(px.y, px.x) - 90
return {