fixtransforms branch: groups with skewed elements now resize/move properly
git-svn-id: http://svg-edit.googlecode.com/svn/branches/fixtransforms@1034 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
4ca4260fc9
commit
f2c98ab46e
|
@ -11,10 +11,9 @@
|
||||||
/*
|
/*
|
||||||
TODOs for TransformList:
|
TODOs for TransformList:
|
||||||
|
|
||||||
* fix resizing of rotated elements
|
* go through Selector.resize() and make sure groups account for rotated/skewed children
|
||||||
* when resizing a group and elements are rotated within, collapse matrices now that it works
|
|
||||||
* go through ungrouping again
|
|
||||||
* go through Selector.resize() and rework so that they are always rectangular
|
* go through Selector.resize() and rework so that they are always rectangular
|
||||||
|
* go through ungrouping again
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
TODOs for Localizing:
|
TODOs for Localizing:
|
||||||
|
@ -1617,14 +1616,16 @@ function BatchCommand(text) {
|
||||||
var m = transformListToTransform(childTlist).matrix;
|
var m = transformListToTransform(childTlist).matrix;
|
||||||
|
|
||||||
var angle = canvas.getRotationAngle(child);
|
var angle = canvas.getRotationAngle(child);
|
||||||
if(angle) {
|
if(angle || hasMatrixTransform(childTlist)) {
|
||||||
var em = matrixMultiply(tm, sm, tmn);
|
var em = matrixMultiply(tm, sm, tmn, m);
|
||||||
|
|
||||||
// this does not appear to work, something wrong with my logic here
|
// this does not appear to work, something wrong with my logic here
|
||||||
var e2t = svgroot.createSVGTransform();
|
var e2t = svgroot.createSVGTransform();
|
||||||
e2t.setMatrix(em);
|
e2t.setMatrix(em);
|
||||||
childTlist.insertItemBefore(e2t,0);
|
childTlist.clear();
|
||||||
|
childTlist.appendItem(e2t,0);
|
||||||
}
|
}
|
||||||
|
// if not rotated or skewed, push the [T][S][-T] down to the child
|
||||||
else {
|
else {
|
||||||
// update the transform list with translate,scale,translate
|
// update the transform list with translate,scale,translate
|
||||||
|
|
||||||
|
@ -2002,6 +2003,14 @@ function BatchCommand(text) {
|
||||||
return svgroot.createSVGTransformFromMatrix(m);
|
return svgroot.createSVGTransformFromMatrix(m);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var hasMatrixTransform = function(tlist) {
|
||||||
|
var num = tlist.numberOfItems;
|
||||||
|
while (num--) {
|
||||||
|
if (tlist.getItem(num).type == 1) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// // Easy way to loop through transform list, but may not be worthwhile
|
// // Easy way to loop through transform list, but may not be worthwhile
|
||||||
// var eachXform = function(elem, callback) {
|
// var eachXform = function(elem, callback) {
|
||||||
// var tlist = canvas.getTransformList(elem);
|
// var tlist = canvas.getTransformList(elem);
|
||||||
|
|
Loading…
Reference in New Issue