Fix panel height calculation for multiple carriers
Panel height was being cut off when multiple Hutschienen were added. Corrected the height formula to properly account for: - Top margin for main busbars - Full block height for equipment - Spacing between carriers - Bottom margin Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6ff56e89e4
commit
81526c9f86
1 changed files with 10 additions and 3 deletions
|
|
@ -6212,8 +6212,15 @@
|
||||||
|
|
||||||
// Panel width includes: left margin for label (60px) + rail overhang (30px) + TE width + rail overhang (30px) + padding
|
// Panel width includes: left margin for label (60px) + rail overhang (30px) + TE width + rail overhang (30px) + padding
|
||||||
var panelWidth = 60 + 30 + maxTE * self.TE_WIDTH + 30 + self.PANEL_PADDING;
|
var panelWidth = 60 + 30 + maxTE * self.TE_WIDTH + 30 + self.PANEL_PADDING;
|
||||||
// Use calculatedTopMargin for dynamic spacing
|
// Panel height calculation:
|
||||||
var panelHeight = self.calculatedTopMargin + self.BLOCK_HEIGHT + 20 + panelCarriers.length * self.RAIL_SPACING + self.BOTTOM_MARGIN;
|
// - calculatedTopMargin: space for main busbars at top
|
||||||
|
// - BLOCK_HEIGHT/2: half block above first rail
|
||||||
|
// - (carriers-1) * RAIL_SPACING: spacing between rails
|
||||||
|
// - BLOCK_HEIGHT/2: half block below last rail
|
||||||
|
// - BOTTOM_MARGIN: margin at bottom
|
||||||
|
// Simplified: calculatedTopMargin + BLOCK_HEIGHT + (carriers * RAIL_SPACING) + BOTTOM_MARGIN
|
||||||
|
var carrierCount = Math.max(panelCarriers.length, 1);
|
||||||
|
var panelHeight = self.calculatedTopMargin + self.BLOCK_HEIGHT + (carrierCount * self.RAIL_SPACING) + self.BOTTOM_MARGIN;
|
||||||
|
|
||||||
panel._x = totalWidth;
|
panel._x = totalWidth;
|
||||||
panel._width = panelWidth;
|
panel._width = panelWidth;
|
||||||
|
|
@ -6233,7 +6240,7 @@
|
||||||
if ((c.total_te || 12) > fallbackMaxTE) fallbackMaxTE = c.total_te;
|
if ((c.total_te || 12) > fallbackMaxTE) fallbackMaxTE = c.total_te;
|
||||||
});
|
});
|
||||||
totalWidth = fallbackMaxTE * self.TE_WIDTH + 150;
|
totalWidth = fallbackMaxTE * self.TE_WIDTH + 150;
|
||||||
totalHeight = self.calculatedTopMargin + self.BLOCK_HEIGHT + 20 + this.carriers.length * self.RAIL_SPACING + self.BOTTOM_MARGIN;
|
totalHeight = self.calculatedTopMargin + self.BLOCK_HEIGHT + (this.carriers.length * self.RAIL_SPACING) + self.BOTTOM_MARGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.layoutWidth = Math.max(totalWidth, 800);
|
this.layoutWidth = Math.max(totalWidth, 800);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue