#546 ungrouping issue fixed
parent
1897e2e0ff
commit
638df11ec2
|
@ -571,16 +571,19 @@ export const pushGroupProperty = function (g, undoable) {
|
|||
// Clone the group's filter
|
||||
gfilter = drawing.copyElem(gfilter);
|
||||
findDefs().append(gfilter);
|
||||
}
|
||||
} else {
|
||||
gfilter = getRefElem(elem.getAttribute('filter'));
|
||||
}
|
||||
|
||||
// const filterElem = getRefElem(gfilter);
|
||||
const blurElem = getFeGaussianBlur(gfilter);
|
||||
// Change this in future for different filters
|
||||
const suffix = (blurElem?.tagName === 'feGaussianBlur') ? 'blur' : 'filter';
|
||||
gfilter.id = elem.id + '_' + suffix;
|
||||
elementContext_.changeSelectedAttribute('filter', 'url(#' + gfilter.id + ')', [ elem ]);
|
||||
}
|
||||
} else {
|
||||
gfilter = getRefElem(elem.getAttribute('filter'));
|
||||
}
|
||||
// const filterElem = getRefElem(gfilter);
|
||||
const blurElem = getFeGaussianBlur(gfilter);
|
||||
|
||||
// Update blur value
|
||||
if (cblur) {
|
||||
|
|
|
@ -368,6 +368,28 @@ export const setSvgString = function (xmlString, preventUndo) {
|
|||
svgCanvas.embedImage(val);
|
||||
}
|
||||
});
|
||||
// Duplicate id replace changes
|
||||
const nodes = content.querySelectorAll('[id]');
|
||||
const ids = {};
|
||||
const totalNodes = nodes.length;
|
||||
|
||||
for(let i=0; i<totalNodes; i++) {
|
||||
const currentId = nodes[i].id ? nodes[i].id : "undefined";
|
||||
if(isNaN(ids[currentId])) {
|
||||
ids[currentId] = 0;
|
||||
}
|
||||
ids[currentId]++;
|
||||
}
|
||||
|
||||
Object.entries(ids).forEach(([ key, value ]) => {
|
||||
if (value > 1) {
|
||||
const nodes = content.querySelectorAll('[id="'+key+'"]');
|
||||
for(let i=1; i<nodes.length; i++) {
|
||||
nodes[i].setAttribute('id', svgCanvas.getNextId());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Wrap child SVGs in group elements
|
||||
const svgElements = content.querySelectorAll('svg');
|
||||
|
|
Loading…
Reference in New Issue