4xx / svg-edit

Automatically exported from code.google.com/p/svg-edit
MIT License
0 stars 0 forks source link

translating g, text, use is invalid in remapElement #1179

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
There is a code in remapElement:

var existing = transformListToTransform(selected).matrix,
t_new = matrixMultiply(existing.inverse(), m, existing);

but transformListToTransform need to be passed a transformList of an element 
instead of element itself.
So, <existing> is always an identity matrix. won't work well.

I have changed this as:
 var chlist = getTransformList(selected);
 var existing = transformListToTransform(chlist).matrix;
 var t_new = matrixMultiply(existing.inverse(), m, existing);

This will handle translate correctly if I directly call remapElement.
However, If I drag a <use> object on the screen, position change now cause 
error. I guess because of this bug, recalculateAllDimensions handles this 
problem locally (as quick patch), so double correction
occurs. I suggest add new (default false) argument to remapElement,
and change action. If one wants non-buggy action, pass additional
true argument.

Original issue reported on code.google.com by psh....@gmail.com on 25 Jan 2014 at 7:06