Try to make Jeff happy

Make use of a nonce for setting SVG-Edit IDs
option. By default, SVG-Edit behaves as before.
Calling svgCanvas.randomizeIds(true) gives our
behaviour, instead.

Also, sync with latest SVG-Edit (but disable,
for now, manual editing of IDs).
This commit is contained in:
Jacques Distler 2010-02-27 09:49:02 -06:00
parent 8a851eeab2
commit 519f81ab20
8 changed files with 144 additions and 300 deletions

View file

@ -665,6 +665,7 @@ function svg_edit_setup() {
};
// 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 &&
selectedElement.tagName != "image" &&
@ -727,6 +728,7 @@ function svg_edit_setup() {
var opac_perc = ((selectedElement.getAttribute("opacity")||1.0)*100);
$('#group_opacity').val(opac_perc);
$('#opac_slider').slider('option', 'value', opac_perc);
$('#elem_id').val(selectedElement.id);
}
updateToolButtonState();
@ -1034,7 +1036,17 @@ function svg_edit_setup() {
this.value = selectedElement.getAttribute(attr);
return false;
}
// if the user is changing the id, then de-select the element first
// change the ID, then re-select it with the new ID
if (attr == "id") {
var elem = selectedElement;
svgCanvas.clearSelection();
elem.id = val;
svgCanvas.addToSelection([elem],true);
}
else {
svgCanvas.changeSelectedAttribute(attr, val);
}
});
// Prevent selection of elements when shift-clicking
@ -2778,7 +2790,7 @@ function svg_edit_setup() {
updateCanvas(true);
});
// var revnums = "svg-editor.js ($Rev: 1430 $) ";
// var revnums = "svg-editor.js ($Rev: 1433 $) ";
// revnums += svgCanvas.getVersion();
// $('#copyright')[0].setAttribute("title", revnums);
return svgCanvas;