4xx / svg-edit

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

Certain attribute changes while in textedit mode don't apply correctly #1143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a text element with the text tool and type some text (STAY in 
textedit mode, with cursor blinking)
2. Change the font size with your keyboard and press enter

What is the expected output? What do you see instead?
You expect the font size to successfully change, but instead it does not. The 
text element will quickly change to the font size you specified and then will 
immediately flash back to the old value.

The above is only one of multiple side effects caused by this issue. Instead of 
changing the font-size, try changing the font-family (again, while remaining in 
textedit mode). You'll see the font of your text element change, but the font 
family dropdown will still show the old font (until you de-select/re-select). 
Same issue with x/y coordinate text boxes.

The problem is in changeSelectedAttributeNoUndo (~6665 in svgcanvas.js). 
There's a check if we're in "textedit" mode, and if so there's a call to 
textActions.toSelectMode(). The problem is that this occurs BEFORE the element 
is actually updated with the new attribute value. toSelectMode() ultimately 
calls updateContextPanel() which gets (stale) attributes from the selected 
element and writes them to the UI. In the case of font-size, this triggers the 
setFontSize() process again and the size gets annoyingly reset to the old value.

I moved the textActions.toSelectMode() call down after elem.setAttribute() and 
now I don't have this problem anymore.

Thoughts?

Original issue reported on code.google.com by dan...@trydesignlab.com on 18 Sep 2013 at 11:33

GoogleCodeExporter commented 9 years ago
Here's the pull request so you can see exactly what I'm talking about: 
https://github.com/danxshap/svg-edit/pull/7/files

Original comment by dan...@trydesignlab.com on 18 Sep 2013 at 11:34

GoogleCodeExporter commented 9 years ago

Original comment by dan...@trydesignlab.com on 21 Sep 2013 at 10:21