function ConturPanel(p) {
var pLenght = Math.round(p.ContourHeight);
var pWidth = Math.round(p.ContourWidth);
var SizePanel = {};
var line=[];
var dx = 0;
var dy = 0;
if (p.Butts.Count > 0) {
for (var i = 0; i < p.Butts.Count; i++) {
var ang = angleLine(p.Contour[p.Butts[i].ElemIndex].Pos1.x, p.Contour[p.Butts[i].ElemIndex].Pos2.x, p.Contour[p.Butts[i].ElemIndex].Pos1.y, p.Contour[p.Butts[i].ElemIndex].Pos2.y)
if (ang % 90 == 0 && p.Butts[i].Thickness > 0 && p.Butts[i].ClipPanel) {
switch (ang) {
case -90:
case 90:
if (line.filter(function(r){return r==Math.round(p.Contour[p.Butts[i].ElemIndex].Pos1.x)}).length==0) {dx += p.Butts[i].Thickness;}
line.push(Math.round(p.Contour[p.Butts[i].ElemIndex].Pos1.x))
break;
case 0:
line.push(Math.round(p.Contour[p.Butts[i].ElemIndex].Pos1.y))
if (line.filter(function(r){return r==Math.round(p.Contour[p.Butts[i].ElemIndex].Pos1.y)}).length==0) {dy += p.Butts[i].Thickness;}
break;
}
}
}
}
if (p.TextureOrientation == 2) {
SizePanel.Lenght = pLenght - Math.round(dy);
SizePanel.Width = pWidth - Math.round(dx);
}
else {
SizePanel.Lenght = pWidth - Math.round(dx);
SizePanel.Width = pLenght - Math.round(dy);
}
return SizePanel
}
[свернуть]