if (diagram.selectedItems.nodes.length){
let vtx = diagram.selectedItems.nodes[0].offsetX;
let vty = diagram.selectedItems.nodes[0].offsetY;
let mnc= diagram.selectedItems.nodes[0].properties.addInfo[0].menuId;
let diagramData=JSON.parse(document.getElementById('diagram').ej2_instances[0].saveDiagram());
//alert("hihi");
let counti=0;
for(let i=0; i<=diagramData.nodes.length-1; i++){
if(diagram.selectedItems.nodes[0].properties.id===diagramData.nodes[i].id){
if(diagram.selectedItems.nodes[0].properties.constraints===diagramData.nodes[i].constraints){
counti=i;
}
}
}
let vcw=0;
let vch=0;
let ofx=0;
let ofy=0;
let croj=[];
let diagramElement;
//alert(counti);
for(let i=0; i<=diagramData.nodes.length-1; i++){
vcw=diagramData.nodes[i].width;
vch=diagramData.nodes[i].height;
ofx=diagramData.nodes[i].offsetX;
ofy=diagramData.nodes[i].offsetY;
//alert("hihi");
if((ofx-vcw/2 < vtx) && (vtx < ofx+vcw/2) && (ofy-vch/2 < vty) && (vty < ofy+vch/2) && ((ofx!=vtx)||(ofy!=vty))) {
if (hople(diagramData.nodes[i].addInfo[0].menuId,mnc)==1){
if(typeof(diagramData.nodes[i].children)=="undefined"){
diagramData.nodes[counti].width=50;
diagramData.nodes[counti].height=50;
diagramData.nodes[counti].offsetX=0;
diagramData.nodes[counti].offsetY=0;
//diagramData.nodes[counti].marginTop=10;
//diagramData.nodes[counti].marginLeft=10;
//diagramData.nodes[counti].style.fill="#6BA5D7";
croj.push(diagramData.nodes[counti].id);
//diagramData.nodes[i].width=400;
//diagramData.nodes[i].height=150;
diagramData.nodes[i].children=croj;
//diagramData.nodes[i].style.fill="#6BA5D7";
}
else {
alert(diagramData.nodes[i].children.length);
diagramData.nodes[counti].width=50;
diagramData.nodes[counti].height=50;
diagramData.nodes[counti].offsetX=-30+diagramData.nodes[counti].width*diagramData.nodes[i].children.length;
diagramData.nodes[counti].offsetY=0;
//diagramData.nodes[counti].marginTop=10;
//diagramData.nodes[counti].marginLeft=10;
//diagramData.nodes[counti].style.fill="#6BA5D7";
//let croj=[];
//croj.push(diagramData.nodes[counti].id);
//alert(diagramData.nodes[counti].id);
diagramData.nodes[i].width=diagramData.nodes[counti].width*(diagramData.nodes[i].children.length+2);
//diagramData.nodes[i].height=150;
alert(diagramData.nodes[i].width);
diagramData.nodes[i].children.push(diagramData.nodes[counti].id);
//diagramData.nodes[i].style.fill="#6BA5D7";
}
diagramElement= document.getElementById('diagram').ej2_instances[0];
diagramElement.clear();
if (diagramData === '') {
diagramData = JSON.parse(diagramElement.saveDiagram());
}
diagramElement.isLoading = true;
diagramElement.loadDiagram(JSON.stringify(diagramData));
diagramElement.clearSelection();
diagramElement.isLoading = false;
}
}
}
Hi Jacmd,
We have created a sample and checked on the updating or changing
the dimensions of node and positions and it’s working fine at our end. We could
not be able to replicate the issue. could you please share with us more details
such as modifying the below-attached sample link.
Sample Link: https://stackblitz.com/edit/k4dtps-zadpmt?file=index.ts
Regards,
Arun Kumar.