kimoa / svg-edit

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

When text is rotated and resized, text will hop everytime it is selected. #558

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.  Create a text object with some text.
2.  Resize text and rotate text.
3.  Select text.  Maybe even try moving text.

What is the expected output? What do you see instead?
The expected output is for the text to stay still. But instead the text 
hops each time it is selected (on a mouseup event) until the mathematics 
comes to a convergence point.  The larger the transform/resize, the more 
noticeable hopping occurs.  Also, the greater the distance it is moved or 
translated, the more significant the hopping. 

In what browser did you experience this problem? (ALL, Firefox, Opera 10
Alpha, etc)
Opera firefox and chrome.

Please provide any additional information below.
I have been studying the code for several weeks in order to make the 
improvement proposed in Issue 514.  However, a text hopping problem made it 
instable.  It seems that this text hopping is not isolated to the proposed 
improvement.

Having studied the code more than I should have, I realized that this 
problem has its source in recalculateAllSelectedDimensions() which jumps to 
recalculateDimensions(selected). If we go to, say line 2422 in svgcanvas, 
we get to the code where the error is possibly coming from.  I think the 
problem is with the formula var s = sin(a)/(1-cos(a)).  I don't think it 
takes into consideration that if the object is resized, what the 
consequences are.

I also tried to seek a solution to this, but my research into SVG is very 
raw and not well rehearsed.  I was hoping that one of you might have an 
easy solution.

Original issue reported on code.google.com by anas.has...@gmail.com on 24 May 2010 at 4:15

GoogleCodeExporter commented 9 years ago
I can not reproduce this in 2.5 1572 in either chrome or firefox. Could it be 
that
some of the changes you made related to Issue 514 are indirectly causing this?

Original comment by wschleter on 24 May 2010 at 4:04

GoogleCodeExporter commented 9 years ago
I am doing this on the latest trunk builds both on my server and the one hosted 
on 
google.  I can reproduce this problem each and every time on firefox, opera, 
and 
chrome.  Resize text like 3-4 times as much.  rotate it. and then try moving 
it.  The 
text object will hop.

Original comment by anas.has...@gmail.com on 25 May 2010 at 2:40

GoogleCodeExporter commented 9 years ago
Yeah, this is basically like Issue 472. I'd "fixed" it for most conditions, but 
I
guess this one still remains. Will see if I can "fix" it too.

I put "fix" in quotes as I actually bypassed the original formula when simply
selecting/moving elements. I'd prefer it if a real fix could be found, but 
that's a
bit beyond my realm of expertise.

Original comment by adeve...@gmail.com on 25 May 2010 at 1:19

GoogleCodeExporter commented 9 years ago
Oh, and I think it only occurs on angles > 90, which may be why wschleter 
couldn't
see it.

Original comment by adeve...@gmail.com on 25 May 2010 at 1:29

GoogleCodeExporter commented 9 years ago
It occurs on all angles.  Even if its only 1 degree.  And programmatically, it 
makes 
no exception based on the angle.  Only two conditions have to be met: the 
object is 
resized by a matrix and the object is rotated.  

There is a problem with disabling function recalculateDimensions after a move 
event.  
The purpose of the function is to merge the translate item in a transform 
attribute 
during a mouseup event to the matrix item (I think its either matrix or x & y). 
At 
the same time, to recalculate coordinates of the rotate item.

If you cannot solve this puzzle, I will give it another try when I am more 
awake.  I 
know of the solution but it just cannot come to my head right now.

Original comment by anas.has...@gmail.com on 25 May 2010 at 6:09

GoogleCodeExporter commented 9 years ago
Is it a regression?

Original comment by codedr...@gmail.com on 25 May 2010 at 7:02

GoogleCodeExporter commented 9 years ago
I don't think it is a regression.  It seems to be that the rotate center is 
incorrectly  
calculated. This calculation happens during a SELECT of the object and a 
TRANSLATE of 
the object. Weirdly, the text hops back to its normal position during either a 
rotate 
command or a bold/italic command.

I am attaching a patch for svgcanvas.js that will fix this.  This time I tried 
removing 
majority of the whitespace changes, but some were still stubbornly left.

Original comment by anas.has...@gmail.com on 3 Jun 2010 at 2:25

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi,

I submitted the patch you see above.  I was not able to submit it using SVN.  I 
don't think I am admitted as commiter. Can you apply the patch to the trunk of 
the project?  Thanks.

Original comment by anas.has...@gmail.com on 10 Jun 2010 at 3:30

GoogleCodeExporter commented 9 years ago
I tried applying your patch, but it seems to basically undo the solution I came 
up with for Issue 472. Let me see if I can find a way to adjust the code to 
solve both problems (though you're welcome to try too).

Original comment by adeve...@gmail.com on 10 Jun 2010 at 1:46

GoogleCodeExporter commented 9 years ago
This problem has been reduced in r1694...it still exists, but requires less 
selection/moving depending on how much the object is rotated. The closer to 180 
degrees, the sooner it occurs.

Original comment by adeve...@gmail.com on 31 Aug 2010 at 6:11