fixtransforms branch: resizing a skewed element now works properly
git-svn-id: http://svg-edit.googlecode.com/svn/branches/fixtransforms@1069 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
ccade30124
commit
2736be370b
|
@ -1908,7 +1908,8 @@ function BatchCommand(text) {
|
||||||
var operation = 0;
|
var operation = 0;
|
||||||
var N = tlist.numberOfItems;
|
var N = tlist.numberOfItems;
|
||||||
|
|
||||||
// first, if it was a scale then the second-last transform will be the [S]
|
// first, if it was a scale of a non-skewed element, then the second-last
|
||||||
|
// transform will be the [S]
|
||||||
// if we had [M][T][S][T] we want to extract the matrix equivalent of
|
// if we had [M][T][S][T] we want to extract the matrix equivalent of
|
||||||
// [T][S][T] and push it down to the element
|
// [T][S][T] and push it down to the element
|
||||||
if (N >= 3 && tlist.getItem(N-2).type == 3 &&
|
if (N >= 3 && tlist.getItem(N-2).type == 3 &&
|
||||||
|
@ -1919,31 +1920,18 @@ function BatchCommand(text) {
|
||||||
tlist.removeItem(N-1);
|
tlist.removeItem(N-1);
|
||||||
tlist.removeItem(N-2);
|
tlist.removeItem(N-2);
|
||||||
tlist.removeItem(N-3);
|
tlist.removeItem(N-3);
|
||||||
} // if we had [T][S][-T][M], then this was a matrix-element being
|
} // if we had [T][S][-T][M], then this was a skewed element being resized
|
||||||
// resized. Thus, we simply combine it all into one matrix
|
// Thus, we simply combine it all into one matrix
|
||||||
else if(N == 4 && tlist.getItem(N-1).type == 1 && !angle) {
|
else if(N == 4 && tlist.getItem(N-1).type == 1) {
|
||||||
|
operation = 3; // scale
|
||||||
m = transformListToTransform(tlist).matrix;
|
m = transformListToTransform(tlist).matrix;
|
||||||
var e2t = svgroot.createSVGTransform();
|
var e2t = svgroot.createSVGTransform();
|
||||||
e2t.setMatrix(m);
|
e2t.setMatrix(m);
|
||||||
tlist.clear();
|
tlist.clear();
|
||||||
tlist.appendItem(e2t);
|
tlist.appendItem(e2t);
|
||||||
return null;
|
// reset the matrix so that the element is not re-mapped
|
||||||
|
m = svgroot.createSVGMatrix();
|
||||||
} // if we had [R][T][S][-T][M], then this was a rotated matrix-element
|
} // if we had [R][T][S][-T][M], then this was a rotated matrix-element
|
||||||
// being resized. Thus, we simply combine the matrix and keep the rotate
|
|
||||||
else if(N == 4 && tlist.getItem(N-1).type == 1 && angle) {
|
|
||||||
m = transformListToTransform(tlist).matrix;
|
|
||||||
var e2t = svgroot.createSVGTransform();
|
|
||||||
e2t.setMatrix(m);
|
|
||||||
tlist.clear();
|
|
||||||
tlist.appendItem(e2t);
|
|
||||||
|
|
||||||
// Not positioned correctly yet.
|
|
||||||
// FIXME codedread! You're my only hope...
|
|
||||||
var newRot = svgroot.createSVGTransform();
|
|
||||||
newRot.setRotate(angle,newcenter.x,newcenter.y);
|
|
||||||
tlist.insertItemBefore(newRot, 0);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// if we had [T1][M] we want to transform this into [M][T2]
|
// if we had [T1][M] we want to transform this into [M][T2]
|
||||||
// therefore [ T2 ] = [ M_inv ] [ T1 ] [ M ] and we can push [T2]
|
// therefore [ T2 ] = [ M_inv ] [ T1 ] [ M ] and we can push [T2]
|
||||||
// down to the element
|
// down to the element
|
||||||
|
|
Loading…
Reference in New Issue