#546 ungrouping issue fixed
parent
1897e2e0ff
commit
638df11ec2
|
@ -571,16 +571,19 @@ export const pushGroupProperty = function (g, undoable) {
|
||||||
// Clone the group's filter
|
// Clone the group's filter
|
||||||
gfilter = drawing.copyElem(gfilter);
|
gfilter = drawing.copyElem(gfilter);
|
||||||
findDefs().append(gfilter);
|
findDefs().append(gfilter);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gfilter = getRefElem(elem.getAttribute('filter'));
|
|
||||||
}
|
|
||||||
// const filterElem = getRefElem(gfilter);
|
// const filterElem = getRefElem(gfilter);
|
||||||
const blurElem = getFeGaussianBlur(gfilter);
|
const blurElem = getFeGaussianBlur(gfilter);
|
||||||
// Change this in future for different filters
|
// Change this in future for different filters
|
||||||
const suffix = (blurElem?.tagName === 'feGaussianBlur') ? 'blur' : 'filter';
|
const suffix = (blurElem?.tagName === 'feGaussianBlur') ? 'blur' : 'filter';
|
||||||
gfilter.id = elem.id + '_' + suffix;
|
gfilter.id = elem.id + '_' + suffix;
|
||||||
elementContext_.changeSelectedAttribute('filter', 'url(#' + gfilter.id + ')', [ elem ]);
|
elementContext_.changeSelectedAttribute('filter', 'url(#' + gfilter.id + ')', [ elem ]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
gfilter = getRefElem(elem.getAttribute('filter'));
|
||||||
|
}
|
||||||
|
// const filterElem = getRefElem(gfilter);
|
||||||
|
const blurElem = getFeGaussianBlur(gfilter);
|
||||||
|
|
||||||
// Update blur value
|
// Update blur value
|
||||||
if (cblur) {
|
if (cblur) {
|
||||||
|
|
|
@ -368,6 +368,28 @@ export const setSvgString = function (xmlString, preventUndo) {
|
||||||
svgCanvas.embedImage(val);
|
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
|
// Wrap child SVGs in group elements
|
||||||
const svgElements = content.querySelectorAll('svg');
|
const svgElements = content.querySelectorAll('svg');
|
||||||
|
|
Loading…
Reference in New Issue