var centerX = widthF / 2;
var centerY = heightF / 2;
var radiusX = widthF / 2;
var radiusY = heightF / 2;
var newD;
newD = `M${centerX - radiusX},${centerY}
A${radiusX},${radiusY} 0 1,1 ${centerX + radiusX},${centerY}
A${radiusX},${radiusY} 0 1,1 ${centerX - radiusX},${centerY} z`;
path = svg.children('path');
path.attr('d', newD);
function updatePath(opt) {
var width = opt.width;
var height = opt.height;
var rx1 = opt.rx1;
var rx2 = opt.rx2;
var rx3 = opt.rx3;
var rx4 = opt.rx4;
var path = opt.path;
const x = 0;
const y = 0;
const newD = `
M${x} ${y + rx1}
a${rx1} ${rx1} 0 0 1 ${rx1} -${rx1}
h${width - rx1 - rx2}
a${rx2} ${rx2} 0 0 1 ${rx2} ${rx2}
v${height - rx2 - rx3}
a${rx3} ${rx3} 0 0 1 -${rx3} ${rx3}
h-${width - rx3 - rx4}
a${rx4} ${rx4} 0 0 1 -${rx4} -${rx4}
v-${height - rx1 - rx4}
z
`;
path.attr('d', newD);
}
var defRadius;
var singleRadius = 1;
var rx1 = 0,rx2 = 0,rx3 = 0,rx4 = 0;
var def_rx1 = 0,def_rx2 = 0,def_rx3 = 0,def_rx4 = 0;
var radius = setts.radius;
var maxRadius = Math.min(widthF,heightF)/2;
if(setts.type=='rounded_rectangle'){
defRadius = widthF*0.1;
} else if(setts.type=='rect'){
defRadius = 0;
} else if(setts.type=='arch_down'||setts.type=='arch_up'){
defRadius = widthF/2;
} else if(setts.type=='pill'){
defRadius = heightF/2;
}
if(singleRadius){
var radius = (radius!=undefined?radius:defRadius);
if(!resizableResize&&radius&&radius>maxRadius){
radius = maxRadius;
}
rx1 = radius;
rx2 = radius;
rx3 = radius;
rx4 = radius;
if(setts.type=='arch_down'){
rx1=0;
rx2=0;
} else if(setts.type=='arch_up'){
rx3=0;
rx4=0;
}
if(widthF<(radius*2)){
widthF = radius*2;
res['minWidth'] = widthF;
}
if(heightF<(radius*2)){
heightF = radius*2;
res['minHeight'] = heightF;
}
} else {
/*
rx1 = (rx1!='none'?radius:0);
rx2 = (radius?radius:def_rx2);
rx3 = (radius?radius:def_rx3);
rx4 = (radius?radius:def_rx4);
if(!resizableResize&&(radius*2)>maxRadius){
radius = maxRadius;
}
if(widthF<(rx1+rx2)){
widthF = rx1+rx2;
res['minWidth'] = widthF;
}
if(widthF<(rx3+rx4)){
widthF = rx3+rx4;
res['minWidth'] = widthF;
}
if(heightF<(rx1+rx3)){
heightF = rx1+rx3;
res['minHeight'] = heightF;
}
if(heightF<(rx2+rx3)){
heightF = rx2+rx3;
res['minHeight'] = heightF;
}*/
}
path = svg.children('path');
updatePath({'path':path,'width':widthF,'height':heightF,'rx1':rx1,'rx2':rx2,'rx3':rx3,'rx4':rx4});
groupWrap.data('setts').radius = radius;