diff --git a/editor/svg-editor.html b/editor/svg-editor.html
index e2aa8d3d..514e9325 100644
--- a/editor/svg-editor.html
+++ b/editor/svg-editor.html
@@ -125,6 +125,13 @@ script type="text/javascript" src="locale/locale.min.js">
+
+
-
diff --git a/editor/svg-editor.js b/editor/svg-editor.js
index 81902a3a..a1ee57fe 100644
--- a/editor/svg-editor.js
+++ b/editor/svg-editor.js
@@ -103,6 +103,7 @@ function svg_edit_setup() {
if(type == 'prompt') {
var input = $('
').prependTo(btn_holder);
input.val(defText || '');
+ input.bind('keydown', {combi:'return'}, function() {ok.click();});
}
box.show();
@@ -324,7 +325,7 @@ function svg_edit_setup() {
$('#group_opacity').val(opac_perc);
$('#opac_slider').slider('option', 'value', opac_perc);
}
-
+
updateToolButtonState();
};
@@ -345,9 +346,27 @@ function svg_edit_setup() {
#ellipse_panel, #line_panel, #text_panel, #image_panel').hide();
if (elem != null) {
$('#angle').val(svgCanvas.getRotationAngle(elem));
-
+
if(!is_node) {
$('#selected_panel').show();
+ // Elements in this array already have coord fields
+ if($.inArray(elem.nodeName, ['line', 'circle', 'ellipse']) != -1) {
+ $('#xy_panel').hide();
+ } else {
+ var x,y;
+ // Get BBox vals for g, polyline and path
+ if($.inArray(elem.nodeName, ['g', 'polyline', 'path']) != -1) {
+ var bb = svgCanvas.getStrokedBBox([elem]);
+ x = bb.x;
+ y = bb.y;
+ } else {
+ x = elem.getAttribute('x');
+ y = elem.getAttribute('y');
+ }
+ $('#selected_x').val(x || 0);
+ $('#selected_y').val(y || 0);
+ $('#xy_panel').show();
+ }
} else {
var point = svgCanvas.getNodePoint();
if(point) {
@@ -366,12 +385,12 @@ function svg_edit_setup() {
// update contextual tools here
var panels = {
g: [],
- rect: ['rx','x','y','width','height'],
- image: ['x','y','width','height'],
+ rect: ['rx','width','height'],
+ image: ['width','height'],
circle: ['cx','cy','r'],
ellipse: ['cx','cy','rx','ry'],
line: ['x1','y1','x2','y2'],
- text: ['x','y']
+ text: []
};
var el_name = elem.tagName;
diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js
index c9860ff9..40133077 100644
--- a/editor/svgcanvas.js
+++ b/editor/svgcanvas.js
@@ -5256,6 +5256,15 @@ function BatchCommand(text) {
while (i--) {
var elem = elems[i];
if (elem == null) continue;
+ // Set x,y vals on elements that don't have them
+ if((attr == 'x' || attr == 'y') && $.inArray(elem.tagName, ['g', 'polyline', 'path']) != -1) {
+ var bbox = canvas.getStrokedBBox([elem]);
+ var diff_x = attr == 'x' ? newValue - bbox.x : 0;
+ var diff_y = attr == 'y' ? newValue - bbox.y : 0;
+ canvas.moveSelectedElements(diff_x*current_zoom, diff_y*current_zoom, true);
+ continue;
+ }
+
// only allow the transform/opacity attribute to change on
elements, slightly hacky
if (elem.tagName == "g" && (attr != "transform" && attr != "opacity")) continue;
var oldval = attr == "#text" ? elem.textContent : elem.getAttribute(attr);