kimoa / svg-edit

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

Rotated, Skewed, and Grouped text objects jump around when moved around on the canvas #879

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create 3 separate text object
2. skew/rotate each of the individual objects in different ways
3. select all objects and group them
4. In rapid succession, click hold, drag object just a little bit in a 
direction, release mouse button -- repeat.  
5. make sure that your zoom is 100%

What is the expected output? What do you see instead?
As you do this process, you should notice that the text within the objects 
jumps a little bit each time you do the click/drag/release process.  If you 
where to do the click/drag/release moving in a specific x direction, the text 
should appear to "spiral" around in a circle.

I've done some digging and the core issue is somewhere in the 
svgcanvas.js|recalculateDimensions() function.  The main issue has to do with 
how the recalculation of the mid-point of the rotation property of the 
transform attribute.

I'm thinking that it's somewhere in the process of how the Scale|Translate 
properties are converted into a Matrix.  When there is a grouped object, a part 
of the transformation on that object gets pushed down into the child objects -- 
which in this case each have their own Rotate|Matrix properties.  Math is done 
to combine all these transformation into one Matrix.  (All done in 
recalculateDimensions() in svgcanvas.js)

It's been a loooong time since I've done real matrix math and computer graphics 
so I'm forgetting all the rules. 

Was hoping that someone would be able to verify that the calculations are being 
done in the right way so that when the center of the object is recalculated the 
Rotate attribute gets updated properly -- then the object will not appear to 
jump

I have included a svg file that might exhibit the behavior.  If you are not 
seeing the jumping, just try to recreate it from scratch using the above 
process...  Eventually you will see the text jump around in a spiral.

Thank you very much for your consideration!

Tested Browser:
Google Chrome: 15.0.874.106

Original issue reported on code.google.com by mark.nic...@gmail.com on 8 Nov 2011 at 4:59

Attachments: