1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00

moveGroupAttrsToElems now applies transforms to sub-groups & text.

This commit is contained in:
Nathan Muir
2013-08-27 08:40:07 +10:00
committed by deepsweet
parent 633c981304
commit d0a4e91e95
4 changed files with 50 additions and 3 deletions

View File

@ -32,8 +32,8 @@ plugins:
- removeHiddenElems - removeHiddenElems
- removeEmptyText - removeEmptyText
- moveElemsAttrsToGroup - moveElemsAttrsToGroup
- collapseGroups
- moveGroupAttrsToElems - moveGroupAttrsToElems
- collapseGroups
- convertPathData - convertPathData
- convertTransform - convertTransform
- removeEmptyAttrs - removeEmptyAttrs

View File

@ -1,10 +1,13 @@
'use strict'; 'use strict';
exports.type = 'perItemReverse'; exports.type = 'perItem';
exports.active = true; exports.active = true;
var pathElems = require('./_collections.js').pathElems; var pathElems = require('./_collections.js').pathElems.slice();
pathElems.push('g');
pathElems.push('text');
/** /**
* Move group attrs to the content elements. * Move group attrs to the content elements.

View File

@ -0,0 +1,19 @@
<svg xmlns="http://www.w3.org/2000/svg">
<g transform="rotate(30)">
<g transform="scale(2)">
<path d="M0,0 L10,20"/>
<path d="M0,10 L20,30"/>
</g>
</g>
</svg>
@@@
<svg xmlns="http://www.w3.org/2000/svg">
<g>
<g>
<path d="M0,0 L10,20" transform="rotate(30) scale(2)"/>
<path d="M0,10 L20,30" transform="rotate(30) scale(2)"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 440 B

View File

@ -0,0 +1,25 @@
<svg xmlns="http://www.w3.org/2000/svg">
<g transform="rotate(30)">
<g>
<g transform="scale(2)">
<path d="M0,0 L10,20"/>
<path d="M0,10 L20,30"/>
</g>
</g>
<path d="M0,10 L20,30"/>
</g>
</svg>
@@@
<svg xmlns="http://www.w3.org/2000/svg">
<g>
<g>
<g>
<path d="M0,0 L10,20" transform="rotate(30) scale(2)"/>
<path d="M0,10 L20,30" transform="rotate(30) scale(2)"/>
</g>
</g>
<path d="M0,10 L20,30" transform="rotate(30)"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 611 B