summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwout <wout@impinc.co.uk>2014-07-27 13:37:26 +0200
committerwout <wout@impinc.co.uk>2014-07-27 13:37:26 +0200
commit917cd24c50ce9ca2309febc7029f4408a1a5f0ee (patch)
treea9654cc9427c9ba8f9d9ea341dde8750b9991ee1
parenta5b2301c23853cbd20b9e0771d11472dbef92cc6 (diff)
downloadsvg.js-917cd24c50ce9ca2309febc7029f4408a1a5f0ee.tar.gz
svg.js-917cd24c50ce9ca2309febc7029f4408a1a5f0ee.zip
Specified untransform() method
-rwxr-xr-xCHANGELOG.md8
-rwxr-xr-xREADME.md13
-rwxr-xr-xdist/svg.js2
-rwxr-xr-xspec/spec/element.js21
4 files changed, 34 insertions, 10 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d671159..a956d82 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,9 +20,9 @@
- completely reworked `clone()` method to use the adoption system
- added support to clone manually built text elements
- added `svg.wiml.js` plugin to plugins list
-- added `ctm()` method to for matrix-centric transformations -> __TODO!__
-- added `morph()` method to `SVG.Matrix` -> __TODO!__
-- added support for new matrix system to `SVG.FX` -> __TODO!__
+- added `ctm()` method to for matrix-centric transformations
+- added `morph()` method to `SVG.Matrix`
+- added support for new matrix system to `SVG.FX`
- completely reworked transformations to be chainable and more true to their nature
- changed `lines` reference to `lines()` on `SVG.Text` -> __TODO!__
- changed `track` reference to `track()` on `SVG.Text` -> __TODO!__
@@ -30,7 +30,7 @@
- added raw svg import functionality with the `svg()` method -> __TODO!__
- moved sup-pixel offset fix to a separate plugin -> __TODO!__
- added `native()` method to elements and matrix to get to the native api
-- added `untransform()` method to remove all transformations -> __TODO!__
+- added `untransform()` method to remove all transformations
- fixed a bug in IE11 with `mouseenter` and `mouseleave` -> __TODO!__
- switched from Ruby's `rake` to Node's `gulp` for building [thanks to Alex Ewerlöf]
- added coding style description to README
diff --git a/README.md b/README.md
index ad9e8bd..f4892bd 100755
--- a/README.md
+++ b/README.md
@@ -3175,7 +3175,7 @@ matrix.clone()
__`returns`: `SVG.Matrix`__
### morph()
-In order to animate matrices the `morph()` method lets you pass a destination matrix. This can be any value that a `SVG.Matrix` would accept on initialization:
+In order to animate matrices the `morph()` method lets you pass a destination matrix. This can be any value a `SVG.Matrix` would accept on initialization:
```javascript
matrix.morph('matrix(2,0,0,2,100,150)')
@@ -3184,12 +3184,14 @@ matrix.morph('matrix(2,0,0,2,100,150)')
__`returns`: `itself`__
### at()
-This method will morph the matrix to a given position between `0` and `1`. Continuing with the previous example:
+This method will morph the matrix to a given position between `0` and `1`:
```javascript
matrix.at(0.27)
```
+This will only work when a destination matirx is defined using the `morph()` method.
+
__`returns`: `SVG.Matrix`__
### multiply()
@@ -3211,7 +3213,7 @@ matrix.add(matrix2)
__`returns`: `SVG.Matrix`__
### inverse()
-Creates an inversed matix:
+Creates an inverted matix:
```javascript
matrix.inverse()
@@ -3467,12 +3469,15 @@ Here are a few nice plugins that are available for SVG.js:
### topath
[svg.topath.js](https://github.com/wout/svg.topath.js) to convert any other shape to a path.
+### topoly
+[svg.topoly.js](https://github.com/wout/svg.topoly.js) to convert a path to polygon or polyline.
+
### wiml
[svg.wiml.js](https://github.com/wout/svg.wiml.js) a templating language for svg output.
## Contributing
-We love contributions. Did you si it? The word LOVE? Please make sure you follow the same coding style, here are some guidelines.
+We love contributions. Yes indeed, I used the word LOVE! But please make sure you follow the same coding style. Here are some guidelines.
### Indentation
We do it with __two spaces__. Make sure you don't start using tabs because then things get messy.
diff --git a/dist/svg.js b/dist/svg.js
index fb8556f..a7cbb72 100755
--- a/dist/svg.js
+++ b/dist/svg.js
@@ -6,7 +6,7 @@
* @copyright Wout Fierens <wout@impinc.co.uk>
* @license MIT
*
-* BUILT: Sat Jul 26 2014 22:10:03 GMT+0200 (CEST)
+* BUILT: Sun Jul 27 2014 13:36:08 GMT+0200 (CEST)
*/
;(function() {
// The main wrapping element
diff --git a/spec/spec/element.js b/spec/spec/element.js
index 8864afa..176f656 100755
--- a/spec/spec/element.js
+++ b/spec/spec/element.js
@@ -191,11 +191,30 @@ describe('Element', function() {
})
})
+ describe('untransform()', function() {
+ var circle
+
+ beforeEach(function() {
+ circle = draw.circle(100).translate(50, 100)
+ })
+
+ it('removes the transform attribute', function() {
+ expect(circle.node.getAttribute('transform')).toBe('matrix(1,0,0,1,50,100)')
+ circle.untransform()
+ expect(circle.node.getAttribute('transform')).toBeNull()
+ })
+ it('resets the current transform matix', function() {
+ expect(circle.ctm()).toEqual(new SVG.Matrix(1,0,0,1,50,100))
+ circle.untransform()
+ expect(circle.ctm()).toEqual(new SVG.Matrix)
+ })
+ })
+
describe('ctm()', function() {
var rect
beforeEach(function() {
- rect = draw.rect(100,100)
+ rect = draw.rect(100, 100)
})
it('gets the current transform matrix of the element', function() {