Fixed several minor bugs
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@1652 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
bcbb43ec91
commit
30248d4790
|
@ -1188,7 +1188,7 @@
|
|||
// updates the toolbar (colors, opacity, etc) based on the selected element
|
||||
// This function also updates the opacity and id elements that are in the context panel
|
||||
var updateToolbar = function() {
|
||||
if (selectedElement != null && $.inArray(selectedElement.tagName, ['image', 'foreignObject', 'g', 'a']) === -1) {
|
||||
if (selectedElement != null && $.inArray(selectedElement.tagName, ['use', 'image', 'foreignObject', 'g', 'a']) === -1) {
|
||||
|
||||
// get opacity values
|
||||
var fillOpacity = parseFloat(selectedElement.getAttribute("fill-opacity"));
|
||||
|
@ -1296,6 +1296,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
var setInputWidth = function(elem) {
|
||||
var w = Math.min(Math.max(12 + elem.value.length * 6, 50), 300);
|
||||
$(elem).width(w);
|
||||
}
|
||||
|
||||
// updates the context panel tools based on the selected element
|
||||
var updateContextPanel = function() {
|
||||
var elem = selectedElement;
|
||||
|
@ -1450,7 +1455,15 @@
|
|||
else if(el_name == 'g' || el_name == 'use') {
|
||||
$('#container_panel').show();
|
||||
var title = svgCanvas.getTitle();
|
||||
$('#g_title').val(title);
|
||||
var label = $('#g_title')[0];
|
||||
label.value = title;
|
||||
setInputWidth(label);
|
||||
var d = 'disabled';
|
||||
if(el_name == 'use') {
|
||||
label.setAttribute(d, d);
|
||||
} else {
|
||||
label.removeAttribute(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // if (elem != null)
|
||||
|
@ -1649,7 +1662,8 @@
|
|||
|
||||
$('#g_title').change(function() {
|
||||
svgCanvas.setGroupTitle(this.value);
|
||||
$(this).width(17 + this.value.length * 5);
|
||||
setInputWidth(this);
|
||||
|
||||
});
|
||||
|
||||
$('.attr_changer').change(function() {
|
||||
|
|
|
@ -7999,6 +7999,9 @@ this.setSvgString = function(xmlString) {
|
|||
|
||||
// Wrap child SVGs in group elements
|
||||
$(svgcontent).find('svg').each(function() {
|
||||
// Skip if it's in a <defs>
|
||||
if($(this).closest('defs').length) return;
|
||||
|
||||
uniquifyElems(this);
|
||||
|
||||
// Check if it already has a gsvg group
|
||||
|
@ -8218,7 +8221,6 @@ this.importSvgString = function(xmlString) {
|
|||
recalculateDimensions(use_el);
|
||||
$(use_el).data('symbol', symbol);
|
||||
addToSelection([use_el]);
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
|
@ -8753,7 +8755,7 @@ this.setGroupTitle = function(val) {
|
|||
|
||||
if(!val.length) {
|
||||
// Remove title element
|
||||
batchCmd.addSubCommand(new RemoveElementCommand(ts[i], elem));
|
||||
batchCmd.addSubCommand(new RemoveElementCommand(ts[0], elem));
|
||||
ts.remove();
|
||||
} else if(ts.length) {
|
||||
// Change title contents
|
||||
|
|
Loading…
Reference in New Issue