fix(schematic): Grid-Punkte exakt auf Terminal-Positionen

Das Wire-Grid wird jetzt direkt aus den Equipment-Terminal-Positionen
berechnet, identisch zu getTerminalPosition():

- X: eq._x + teIndex * TE_WIDTH + TE_WIDTH/2
- Y: eq._y - 5 (top) / eq._y + height + 5 (bottom)

Vorher wurden Grid-Punkte aus TE-Slots berechnet, was nicht den
+2px Equipment-Offset berücksichtigte.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-03-04 08:41:03 +01:00
parent 50ae4e4a08
commit 89a4db4d21

View file

@ -8974,20 +8974,45 @@
var svgWidth = parseInt(this.svgElement.getAttribute('width')) || 800; var svgWidth = parseInt(this.svgElement.getAttribute('width')) || 800;
var svgHeight = parseInt(this.svgElement.getAttribute('height')) || 600; var svgHeight = parseInt(this.svgElement.getAttribute('height')) || 600;
// X-Positionen: TE-Slots + Rand links/rechts // X- und Y-Positionen direkt aus Equipment-Terminals berechnen
// (Exakt wie getTerminalPosition() es macht)
var xPositions = []; var xPositions = [];
var yPositions = [];
var minX = Infinity, maxX = 0; var minX = Infinity, maxX = 0;
var minY = Infinity, maxY = 0;
this.carriers.forEach(function(carrier) { this.equipment.forEach(function(eq) {
if (typeof carrier._x === 'undefined') return; if (typeof eq._x === 'undefined' || typeof eq._y === 'undefined') return;
var totalTE = carrier.total_te || 12;
var carrierEndX = carrier._x + totalTE * self.TE_WIDTH;
if (carrier._x < minX) minX = carrier._x;
if (carrierEndX > maxX) maxX = carrierEndX;
for (var te = 1; te <= totalTE; te++) { var widthTE = parseFloat(eq.width_te) || 1;
var teX = carrier._x + (te - 1) * self.TE_WIDTH + (self.TE_WIDTH / 2); var terminals = self.getTerminals(eq);
if (xPositions.indexOf(teX) === -1) xPositions.push(teX);
// Alle Terminals dieses Equipment durchgehen
var topTerminals = terminals.filter(function(t) { return t.pos === 'top'; });
var bottomTerminals = terminals.filter(function(t) { return t.pos === 'bottom'; });
// Top-Terminals
for (var i = 0; i < topTerminals.length; i++) {
var teIndex = i % widthTE;
var x = eq._x + (teIndex * self.TE_WIDTH) + (self.TE_WIDTH / 2);
var y = eq._y - 5;
if (xPositions.indexOf(x) === -1) xPositions.push(x);
if (yPositions.indexOf(y) === -1) yPositions.push(y);
if (x < minX) minX = x;
if (x > maxX) maxX = x;
if (y < minY) minY = y;
}
// Bottom-Terminals
for (var j = 0; j < bottomTerminals.length; j++) {
var teIdx = j % widthTE;
var xb = eq._x + (teIdx * self.TE_WIDTH) + (self.TE_WIDTH / 2);
var yb = eq._y + (eq._height || self.BLOCK_HEIGHT) + 5;
if (xPositions.indexOf(xb) === -1) xPositions.push(xb);
if (yPositions.indexOf(yb) === -1) yPositions.push(yb);
if (xb < minX) minX = xb;
if (xb > maxX) maxX = xb;
if (yb > maxY) maxY = yb;
} }
}); });
@ -9001,20 +9026,6 @@
} }
} }
// Y-Positionen: Terminals + Routing-Bereich
var yPositions = [];
var minY = Infinity, maxY = 0;
this.equipment.forEach(function(eq) {
if (typeof eq._y === 'undefined') return;
var topY = eq._y - 7;
var bottomY = eq._y + (eq._height || self.BLOCK_HEIGHT) + 7;
if (topY < minY) minY = topY;
if (bottomY > maxY) maxY = bottomY;
if (yPositions.indexOf(topY) === -1) yPositions.push(topY);
if (yPositions.indexOf(bottomY) === -1) yPositions.push(bottomY);
});
// Routing-Bereich ober- und unterhalb der Blöcke // Routing-Bereich ober- und unterhalb der Blöcke
this.carriers.forEach(function(carrier) { this.carriers.forEach(function(carrier) {
if (typeof carrier._y === 'undefined') return; if (typeof carrier._y === 'undefined') return;