Fix Bug 80: add text controls for x,y (merge Alexis' patch)

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@371 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2009-08-13 15:42:41 +00:00
parent 794db6ba98
commit 83275046b4
4 changed files with 16 additions and 2 deletions

View File

@ -130,6 +130,10 @@
<div id="text_panel">
<img class="tool_sep" src="images/sep.png" alt="|"/>
<label class="text_tool">x:</label>
<input id="text_x" class="text_tool attr_changer" title="Change text X coordinate" alt="x" size="3"/>
<label class="text_tool">y:</label>
<input id="text_y" class="text_tool attr_changer" title="Change text Y coordinate" alt="y" size="3"/>
<img class="tool_button" id="tool_bold" src="images/bold.png" title="Bold Text [B]" alt="Bold"/>
<img class="tool_button" id="tool_italic" src="images/italic.png" title="Italic Text [I]" alt="Italic"/>
<select id="font_family" class="text_tool" title="Change Font Family">

View File

@ -190,6 +190,8 @@ function svg_edit_setup() {
case "text":
// jquery's show() always sets display to block
$('#text_panel').show().css("display", "inline");
$('#text_x').val(elem.getAttribute("x")||0);
$('#text_y').val(elem.getAttribute("y")||0);
if (svgCanvas.getItalic()) {
$('#tool_italic').addClass('tool_button_current');
}
@ -205,8 +207,8 @@ function svg_edit_setup() {
$('#font_family').val(elem.getAttribute("font-family"));
$('#font_size').val(elem.getAttribute("font-size"));
$('#text').val(elem.textContent);
$('#text').focus();
if (shouldHighlightText) {
$('#text').focus();
$('#text').select();
}
break;

View File

@ -2079,7 +2079,10 @@ function SvgCanvas(c)
if (attr == "#text") elem.textContent = val;
else elem.setAttribute(attr, val);
selectedBBoxes[i] = elem.getBBox();
selectorManager.requestSelector(elem).resize(selectedBBoxes[i]);
// Timeout needed for Opera & Firefox
setTimeout(function() {
selectorManager.requestSelector(elem).resize(selectedBBoxes[i]);
},0);
var changes = {};
changes[attr] = oldval;
batchCmd.addSubCommand(new ChangeElementCommand(elem, changes, attr));
@ -2096,6 +2099,10 @@ function SvgCanvas(c)
$(container).mousedown(mouseDown);
$(container).mousemove(mouseMove);
// TODO: Unfortunately Mozilla does not handle internal references to gradients
// inside a data: URL document. This means that any elements filled/stroked
// with a gradient will appear black in Firefox, etc. See bug 308590
// https://bugzilla.mozilla.org/show_bug.cgi?id=308590
this.saveHandler = function(svg) {
window.open("data:image/svg+xml;base64," + Utils.encode64(svg));
};

View File

@ -156,6 +156,7 @@
<img class="tool_button" id="tools_rect_show" src="http://svg-edit.googlecode.com/svn/trunk/editor/images/square.png" title="Square/Rect Tool [4/Shift+4]" alt="Square"/><br/>
<img class="tool_button" id="tools_ellipse_show" src="http://svg-edit.googlecode.com/svn/trunk/editor/images/circle.png" title="Ellipse/Circle Tool [5/Shift+5]" alt="Circle"/><br/>
<img class="tool_button" id="tool_text" src="http://svg-edit.googlecode.com/svn/trunk/editor/images/text.png" title="Text Tool [6]" alt="Text"/>
<img class="tool_button" id="tool_poly" src="images/polygon.png" title="Poly Tool [7]" alt="Poly"/>
</div> <!-- tools_left -->
<div id="tools_bottom" class="tools_panel">