diff --git a/editor/svg-editor.js b/editor/svg-editor.js index 6d4f574d..869c0168 100644 --- a/editor/svg-editor.js +++ b/editor/svg-editor.js @@ -1126,7 +1126,14 @@ function svg_edit_setup() { $('#layer_new').click(function() { var curNames = new Array(svgCanvas.getNumLayers()); for (var i = 0; i < curNames.length; ++i) { curNames[i] = svgCanvas.getLayer(i); } - var newName = prompt("Please enter a unique layer name","Layer "+(curNames.length+1)); + + var j = (curNames.length+1); + var uniqName = "Layer " + j; + while (jQuery.inArray(uniqName, curNames) != -1) { + j++; + uniqName = "Layer " + j; + } + var newName = prompt("Please enter a unique layer name",uniqName); if (!newName) return; if (jQuery.inArray(newName, curNames) != -1) { alert("There is already a layer named that!"); diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index 27b884be..37bbb400 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -3921,8 +3921,8 @@ function BatchCommand(text) { while (i--) { var elem = elems[i]; if (elem == null) continue; - // only allow the transform attribute to change on elements, slightly hacky - if (elem.tagName == "g" && attr == "transform") 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); if (oldval == null) oldval = ""; if (oldval != newValue) {