paths.html aktualisiert

This commit is contained in:
Hlars 2025-11-11 18:42:55 +00:00
parent a5d3a50f0f
commit ca07308acb

View File

@ -1,20 +1,36 @@
<svg [attr.viewBox]="viewBox" xmlns="http://www.w3.org/2000/svg" <svg [attr.viewBox]="viewBox" xmlns="http://www.w3.org/2000/svg"
style="border: solid thin black; margin: 1rem; padding: 5px"> style="border: solid thin black; margin: 1rem; padding: 5px">
@let allSinglePoints = getSinglePoints();
@let firstPoint = allSinglePoints[0];
@let lastPoint = allSinglePoints[allSinglePoints.length - 1];
<line [attr.x1]="firstPoint" [attr.y1]="1.5*normalizedLineHeight" [attr.x2]="lastPoint"
[attr.y2]="1.5*normalizedLineHeight" [attr.stroke-width]="normalizedNumberLineStrokeWidth" stroke="#000000">
</line>
@for (singlePoint of allSinglePoints; track $index) {
<line [attr.x1]="singlePoint" [attr.y1]="normalizedLineHeight" [attr.x2]="singlePoint"
[attr.y2]="2*normalizedLineHeight" [attr.stroke-width]="normalizedNumberLineStrokeWidth" stroke="#000000">
</line>
<text [attr.font-size]="normalizedNumberLineFontSize" [attr.x]="singlePoint"
[attr.y]="$index % 2 === 0 ? normalizedLineHeight : 2*normalizedLineHeight"
[attr.alignment-baseline]="$index % 2 === 1 ? 'before-edge' : 'after-edge'"
[attr.text-anchor]="singlePoint < lastPoint / 2 ? 'start' : 'end'">{{singlePoint}} mm</text>
}
@for (point of points; track $index; let index=$index) { @for (point of points; track $index; let index=$index) {
@let color = getRandomColor(index); @let color = getRandomColor(index);
@for (line of lineCountNumber(point.count); track line) { @for (line of lineCountNumber(point.count); track line) {
@let start = line % 2 === 1 ? point.start : point.end; @let start = line % 2 === 1 ? point.start : point.end;
@let end = line % 2 === 1 ? point.end : point.start; @let end = line % 2 === 1 ? point.end : point.start;
@let offset = (start > end ? 0.5 : -0.5) * strokeWidth; @let offset = (start > end ? 0.5 : -0.5) * normalizedStrokeWidth;
<line [attr.x1]="start + offset" [attr.y1]="getLineNumber(index, line) * lineGap + 0.5 * strokeWidth" <line [attr.x1]="start + offset" [attr.y1]="getLineNumber(index, line) * lineGap + 0.5 * normalizedStrokeWidth"
[attr.x2]="end + offset" [attr.y2]="getLineNumber(index, line) * lineGap + 0.5 * strokeWidth" [attr.x2]="end + offset" [attr.y2]="getLineNumber(index, line) * lineGap + 0.5 * normalizedStrokeWidth"
[attr.stroke]="color" [attr.stroke-width]="strokeWidth" /> [attr.stroke]="color" [attr.stroke-width]="normalizedStrokeWidth" />
@if (index @if (index
< points.length - 1 || (index===points.length && line < point.count)) { <line [attr.x1]="end" < points.length - 1 || (index===points.length - 1 && line < point.count)) { <line [attr.x1]="end"
[attr.y1]="getLineNumber(index, line) * lineGap" [attr.x2]="end" [attr.y1]="getLineNumber(index, line) * lineGap" [attr.x2]="end"
[attr.y2]="(getLineNumber(index, line)+1) * lineGap + strokeWidth" [attr.stroke]="color" [attr.y2]="(getLineNumber(index, line)+1) * lineGap + normalizedStrokeWidth" [attr.stroke]="color"
[attr.stroke-width]="strokeWidth" /> [attr.stroke-width]="normalizedStrokeWidth" />
} }
} }
} }

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB