fix(schematic): Orthogonale Pfade erzwingen

Beim Zeichnen werden jetzt automatisch Zwischenpunkte eingefügt,
um sicherzustellen dass alle Liniensegmente horizontal oder
vertikal sind (90°-Winkel, keine Diagonalen).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eduard Wisch 2026-03-04 12:24:36 +01:00
parent 89a4db4d21
commit be3a53e77e
2 changed files with 23 additions and 4 deletions

View file

@ -9315,14 +9315,33 @@
var terminals = this.getTerminals(eq);
var termPos = this.getTerminalPosition(eq, targetTermId, terminals);
if (termPos) {
// Add orthogonal bend if needed before target
if (this.wireDrawPoints.length > 0) {
var lastPt = this.wireDrawPoints[this.wireDrawPoints.length - 1];
// If not aligned, add intermediate point for 90° bend
if (lastPt.x !== termPos.x && lastPt.y !== termPos.y) {
// Go vertical first, then horizontal
this.wireDrawPoints.push({x: lastPt.x, y: termPos.y});
}
}
this.wireDrawPoints.push({x: termPos.x, y: termPos.y});
}
}
// Build path string from points
// Build orthogonal path - ensure all segments are horizontal or vertical
var pathData = '';
for (var i = 0; i < this.wireDrawPoints.length; i++) {
pathData += (i === 0 ? 'M' : 'L') + ' ' + this.wireDrawPoints[i].x + ' ' + this.wireDrawPoints[i].y + ' ';
var pt = this.wireDrawPoints[i];
if (i === 0) {
pathData += 'M ' + pt.x + ' ' + pt.y + ' ';
} else {
var prevPt = this.wireDrawPoints[i - 1];
// If diagonal, add intermediate point
if (prevPt.x !== pt.x && prevPt.y !== pt.y) {
pathData += 'L ' + prevPt.x + ' ' + pt.y + ' ';
}
pathData += 'L ' + pt.x + ' ' + pt.y + ' ';
}
}
// Show connection dialog to set labels and save

4
sw.js
View file

@ -3,8 +3,8 @@
* Offline-First für Schaltschrank-Dokumentation
*/
const CACHE_NAME = 'kundenkarte-pwa-v6.1';
const OFFLINE_CACHE = 'kundenkarte-offline-v6.1';
const CACHE_NAME = 'kundenkarte-pwa-v6.2';
const OFFLINE_CACHE = 'kundenkarte-offline-v6.2';
// Statische Assets die immer gecached werden (ohne Query-String)
const STATIC_ASSETS = [