circuit-to-svg 0.0.230 → 0.0.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +351 -188
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// lib/pcb/convert-circuit-json-to-pcb-svg.ts
|
|
2
2
|
import { stringify } from "svgson";
|
|
3
3
|
import {
|
|
4
|
-
applyToPoint as
|
|
4
|
+
applyToPoint as applyToPoint22,
|
|
5
5
|
compose as compose5,
|
|
6
6
|
scale as scale2,
|
|
7
7
|
translate as translate5
|
|
@@ -520,11 +520,171 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
|
|
|
520
520
|
return [svgObject];
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-
|
|
523
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-dimension.ts
|
|
524
524
|
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
525
|
+
function normalize(vector) {
|
|
526
|
+
const length = Math.hypot(vector.x, vector.y) || 1;
|
|
527
|
+
return { x: vector.x / length, y: vector.y / length };
|
|
528
|
+
}
|
|
529
|
+
function toPath(points) {
|
|
530
|
+
return points.map(
|
|
531
|
+
(point, index) => index === 0 ? `M ${point.x} ${point.y}` : `L ${point.x} ${point.y}`
|
|
532
|
+
).join(" ");
|
|
533
|
+
}
|
|
534
|
+
function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
535
|
+
const { transform } = ctx;
|
|
536
|
+
const { from, to, text, font_size = 1, color, arrow_size } = dimension;
|
|
537
|
+
if (!from || !to) {
|
|
538
|
+
console.error("Invalid pcb_note_dimension endpoints", { from, to });
|
|
539
|
+
return [];
|
|
540
|
+
}
|
|
541
|
+
if (!Number.isFinite(arrow_size) || arrow_size <= 0) {
|
|
542
|
+
console.error("Invalid pcb_note_dimension arrow_size", arrow_size);
|
|
543
|
+
return [];
|
|
544
|
+
}
|
|
545
|
+
const direction = normalize({ x: to.x - from.x, y: to.y - from.y });
|
|
546
|
+
if (Number.isNaN(direction.x) || Number.isNaN(direction.y)) {
|
|
547
|
+
return [];
|
|
548
|
+
}
|
|
549
|
+
const perpendicular = { x: -direction.y, y: direction.x };
|
|
550
|
+
const arrowHalfWidth = arrow_size / 2;
|
|
551
|
+
const fromBase = {
|
|
552
|
+
x: from.x + direction.x * arrow_size,
|
|
553
|
+
y: from.y + direction.y * arrow_size
|
|
554
|
+
};
|
|
555
|
+
const toBase = {
|
|
556
|
+
x: to.x - direction.x * arrow_size,
|
|
557
|
+
y: to.y - direction.y * arrow_size
|
|
558
|
+
};
|
|
559
|
+
const fromTriangle = [
|
|
560
|
+
toScreen(from),
|
|
561
|
+
toScreen({
|
|
562
|
+
x: fromBase.x + perpendicular.x * arrowHalfWidth,
|
|
563
|
+
y: fromBase.y + perpendicular.y * arrowHalfWidth
|
|
564
|
+
}),
|
|
565
|
+
toScreen({
|
|
566
|
+
x: fromBase.x - perpendicular.x * arrowHalfWidth,
|
|
567
|
+
y: fromBase.y - perpendicular.y * arrowHalfWidth
|
|
568
|
+
})
|
|
569
|
+
];
|
|
570
|
+
const toTriangle = [
|
|
571
|
+
toScreen(to),
|
|
572
|
+
toScreen({
|
|
573
|
+
x: toBase.x + perpendicular.x * arrowHalfWidth,
|
|
574
|
+
y: toBase.y + perpendicular.y * arrowHalfWidth
|
|
575
|
+
}),
|
|
576
|
+
toScreen({
|
|
577
|
+
x: toBase.x - perpendicular.x * arrowHalfWidth,
|
|
578
|
+
y: toBase.y - perpendicular.y * arrowHalfWidth
|
|
579
|
+
})
|
|
580
|
+
];
|
|
581
|
+
const [lineStartX, lineStartY] = applyToPoint5(transform, [
|
|
582
|
+
fromBase.x,
|
|
583
|
+
fromBase.y
|
|
584
|
+
]);
|
|
585
|
+
const [lineEndX, lineEndY] = applyToPoint5(transform, [toBase.x, toBase.y]);
|
|
586
|
+
const strokeWidth = arrow_size / 5 * Math.abs(transform.a);
|
|
587
|
+
const lineColor = color || "rgba(255,255,255,0.5)";
|
|
588
|
+
const midPoint = {
|
|
589
|
+
x: (from.x + to.x) / 2,
|
|
590
|
+
y: (from.y + to.y) / 2
|
|
591
|
+
};
|
|
592
|
+
const textOffset = arrow_size * 1.5;
|
|
593
|
+
const textPoint = {
|
|
594
|
+
x: midPoint.x + perpendicular.x * textOffset,
|
|
595
|
+
y: midPoint.y + perpendicular.y * textOffset
|
|
596
|
+
};
|
|
597
|
+
const [textX, textY] = applyToPoint5(transform, [textPoint.x, textPoint.y]);
|
|
598
|
+
const transformedFontSize = font_size * Math.abs(transform.a);
|
|
599
|
+
const children = [
|
|
600
|
+
{
|
|
601
|
+
name: "path",
|
|
602
|
+
type: "element",
|
|
603
|
+
value: "",
|
|
604
|
+
attributes: {
|
|
605
|
+
d: `M ${lineStartX} ${lineStartY} L ${lineEndX} ${lineEndY}`,
|
|
606
|
+
stroke: lineColor,
|
|
607
|
+
fill: "none",
|
|
608
|
+
"stroke-width": strokeWidth.toString(),
|
|
609
|
+
"stroke-linecap": "round",
|
|
610
|
+
class: "pcb-note-dimension-line"
|
|
611
|
+
},
|
|
612
|
+
children: []
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: "path",
|
|
616
|
+
type: "element",
|
|
617
|
+
value: "",
|
|
618
|
+
attributes: {
|
|
619
|
+
d: `${toPath(fromTriangle)} Z`,
|
|
620
|
+
fill: lineColor,
|
|
621
|
+
class: "pcb-note-dimension-arrow"
|
|
622
|
+
},
|
|
623
|
+
children: []
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
name: "path",
|
|
627
|
+
type: "element",
|
|
628
|
+
value: "",
|
|
629
|
+
attributes: {
|
|
630
|
+
d: `${toPath(toTriangle)} Z`,
|
|
631
|
+
fill: lineColor,
|
|
632
|
+
class: "pcb-note-dimension-arrow"
|
|
633
|
+
},
|
|
634
|
+
children: []
|
|
635
|
+
}
|
|
636
|
+
];
|
|
637
|
+
if (text) {
|
|
638
|
+
children.push({
|
|
639
|
+
name: "text",
|
|
640
|
+
type: "element",
|
|
641
|
+
value: "",
|
|
642
|
+
attributes: {
|
|
643
|
+
x: textX.toString(),
|
|
644
|
+
y: textY.toString(),
|
|
645
|
+
fill: lineColor,
|
|
646
|
+
"font-size": transformedFontSize.toString(),
|
|
647
|
+
"font-family": "Arial, sans-serif",
|
|
648
|
+
"text-anchor": "middle",
|
|
649
|
+
"dominant-baseline": "central",
|
|
650
|
+
class: "pcb-note-dimension-text"
|
|
651
|
+
},
|
|
652
|
+
children: [
|
|
653
|
+
{
|
|
654
|
+
type: "text",
|
|
655
|
+
name: "",
|
|
656
|
+
value: text,
|
|
657
|
+
attributes: {},
|
|
658
|
+
children: []
|
|
659
|
+
}
|
|
660
|
+
]
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
return [
|
|
664
|
+
{
|
|
665
|
+
name: "g",
|
|
666
|
+
type: "element",
|
|
667
|
+
value: "",
|
|
668
|
+
attributes: {
|
|
669
|
+
class: "pcb-note-dimension",
|
|
670
|
+
"data-type": "pcb_note_dimension",
|
|
671
|
+
"data-pcb-note-dimension-id": dimension.pcb_note_dimension_id,
|
|
672
|
+
"data-pcb-layer": "overlay"
|
|
673
|
+
},
|
|
674
|
+
children
|
|
675
|
+
}
|
|
676
|
+
];
|
|
677
|
+
function toScreen(point) {
|
|
678
|
+
const [x, y] = applyToPoint5(transform, [point.x, point.y]);
|
|
679
|
+
return { x, y };
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-plated-hole.ts
|
|
684
|
+
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
525
685
|
function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
526
686
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
527
|
-
const [x, y] =
|
|
687
|
+
const [x, y] = applyToPoint6(transform, [hole.x, hole.y]);
|
|
528
688
|
const copperLayer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
|
|
529
689
|
if (hole.shape === "pill") {
|
|
530
690
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
@@ -641,7 +801,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
641
801
|
const scaledRectPadHeight = hole.rect_pad_height * Math.abs(transform.a);
|
|
642
802
|
const scaledRectBorderRadius = (hole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
643
803
|
const holeRadius = scaledHoleDiameter / 2;
|
|
644
|
-
const [holeCx, holeCy] =
|
|
804
|
+
const [holeCx, holeCy] = applyToPoint6(transform, [
|
|
645
805
|
h.x + (h.hole_offset_x ?? 0),
|
|
646
806
|
h.y + (h.hole_offset_y ?? 0)
|
|
647
807
|
]);
|
|
@@ -706,7 +866,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
706
866
|
const pillHoleWithOffsets = pillHole;
|
|
707
867
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
708
868
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
709
|
-
const [holeCenterX, holeCenterY] =
|
|
869
|
+
const [holeCenterX, holeCenterY] = applyToPoint6(transform, [
|
|
710
870
|
pillHole.x + holeOffsetX,
|
|
711
871
|
pillHole.y + holeOffsetY
|
|
712
872
|
]);
|
|
@@ -775,7 +935,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
775
935
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
776
936
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
777
937
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
778
|
-
const [holeCenterX, holeCenterY] =
|
|
938
|
+
const [holeCenterX, holeCenterY] = applyToPoint6(transform, [
|
|
779
939
|
rotatedHole.x + holeOffsetX,
|
|
780
940
|
rotatedHole.y + holeOffsetY
|
|
781
941
|
]);
|
|
@@ -838,12 +998,12 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
838
998
|
}
|
|
839
999
|
|
|
840
1000
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-path.ts
|
|
841
|
-
import { applyToPoint as
|
|
1001
|
+
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
842
1002
|
function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
|
|
843
1003
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
844
1004
|
if (!silkscreenPath.route || !Array.isArray(silkscreenPath.route)) return [];
|
|
845
1005
|
let path = silkscreenPath.route.map((point, index) => {
|
|
846
|
-
const [x, y] =
|
|
1006
|
+
const [x, y] = applyToPoint7(transform, [point.x, point.y]);
|
|
847
1007
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
848
1008
|
}).join(" ");
|
|
849
1009
|
const firstPoint = silkscreenPath.route[0];
|
|
@@ -879,7 +1039,7 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
|
|
|
879
1039
|
|
|
880
1040
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-text.ts
|
|
881
1041
|
import {
|
|
882
|
-
applyToPoint as
|
|
1042
|
+
applyToPoint as applyToPoint8,
|
|
883
1043
|
compose as compose2,
|
|
884
1044
|
rotate as rotate2,
|
|
885
1045
|
translate as translate2,
|
|
@@ -901,7 +1061,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
901
1061
|
console.error("Invalid anchor_position:", anchor_position);
|
|
902
1062
|
return [];
|
|
903
1063
|
}
|
|
904
|
-
const [transformedX, transformedY] =
|
|
1064
|
+
const [transformedX, transformedY] = applyToPoint8(transform, [
|
|
905
1065
|
anchor_position.x,
|
|
906
1066
|
anchor_position.y
|
|
907
1067
|
]);
|
|
@@ -1009,7 +1169,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
1009
1169
|
}
|
|
1010
1170
|
|
|
1011
1171
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-rect.ts
|
|
1012
|
-
import { applyToPoint as
|
|
1172
|
+
import { applyToPoint as applyToPoint9 } from "transformation-matrix";
|
|
1013
1173
|
function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
1014
1174
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1015
1175
|
const {
|
|
@@ -1028,7 +1188,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
1028
1188
|
console.error("Invalid rectangle data:", { center, width, height });
|
|
1029
1189
|
return [];
|
|
1030
1190
|
}
|
|
1031
|
-
const [transformedX, transformedY] =
|
|
1191
|
+
const [transformedX, transformedY] = applyToPoint9(transform, [
|
|
1032
1192
|
center.x,
|
|
1033
1193
|
center.y
|
|
1034
1194
|
]);
|
|
@@ -1075,7 +1235,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
1075
1235
|
}
|
|
1076
1236
|
|
|
1077
1237
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-circle.ts
|
|
1078
|
-
import { applyToPoint as
|
|
1238
|
+
import { applyToPoint as applyToPoint10 } from "transformation-matrix";
|
|
1079
1239
|
function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
1080
1240
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1081
1241
|
const {
|
|
@@ -1090,7 +1250,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
|
1090
1250
|
console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
|
|
1091
1251
|
return [];
|
|
1092
1252
|
}
|
|
1093
|
-
const [transformedX, transformedY] =
|
|
1253
|
+
const [transformedX, transformedY] = applyToPoint10(transform, [
|
|
1094
1254
|
center.x,
|
|
1095
1255
|
center.y
|
|
1096
1256
|
]);
|
|
@@ -1118,7 +1278,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
|
1118
1278
|
}
|
|
1119
1279
|
|
|
1120
1280
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-line.ts
|
|
1121
|
-
import { applyToPoint as
|
|
1281
|
+
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
1122
1282
|
function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
1123
1283
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1124
1284
|
const {
|
|
@@ -1135,8 +1295,8 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
|
1135
1295
|
console.error("Invalid coordinates:", { x1, y1, x2, y2 });
|
|
1136
1296
|
return [];
|
|
1137
1297
|
}
|
|
1138
|
-
const [transformedX1, transformedY1] =
|
|
1139
|
-
const [transformedX2, transformedY2] =
|
|
1298
|
+
const [transformedX1, transformedY1] = applyToPoint11(transform, [x1, y1]);
|
|
1299
|
+
const [transformedX2, transformedY2] = applyToPoint11(transform, [x2, y2]);
|
|
1140
1300
|
const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
|
|
1141
1301
|
const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
|
|
1142
1302
|
return [
|
|
@@ -1171,7 +1331,7 @@ function pairs(arr) {
|
|
|
1171
1331
|
}
|
|
1172
1332
|
|
|
1173
1333
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
|
|
1174
|
-
import { applyToPoint as
|
|
1334
|
+
import { applyToPoint as applyToPoint12 } from "transformation-matrix";
|
|
1175
1335
|
|
|
1176
1336
|
// lib/pcb/colors.ts
|
|
1177
1337
|
var DEFAULT_PCB_COLOR_MAP = {
|
|
@@ -1227,8 +1387,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
1227
1387
|
const segments = pairs(trace.route);
|
|
1228
1388
|
const svgObjects = [];
|
|
1229
1389
|
for (const [start, end] of segments) {
|
|
1230
|
-
const startPoint =
|
|
1231
|
-
const endPoint =
|
|
1390
|
+
const startPoint = applyToPoint12(transform, [start.x, start.y]);
|
|
1391
|
+
const endPoint = applyToPoint12(transform, [end.x, end.y]);
|
|
1232
1392
|
const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
|
|
1233
1393
|
if (!layer) continue;
|
|
1234
1394
|
if (layerFilter && layer !== layerFilter) continue;
|
|
@@ -1300,7 +1460,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
1300
1460
|
}
|
|
1301
1461
|
|
|
1302
1462
|
// lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
|
|
1303
|
-
import { applyToPoint as
|
|
1463
|
+
import { applyToPoint as applyToPoint13 } from "transformation-matrix";
|
|
1304
1464
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
1305
1465
|
const { transform, layer: layerFilter, colorMap: colorMap2, renderSolderMask } = ctx;
|
|
1306
1466
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
@@ -1310,7 +1470,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1310
1470
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
1311
1471
|
const width = pad.width * Math.abs(transform.a);
|
|
1312
1472
|
const height = pad.height * Math.abs(transform.d);
|
|
1313
|
-
const [x, y] =
|
|
1473
|
+
const [x, y] = applyToPoint13(transform, [pad.x, pad.y]);
|
|
1314
1474
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
1315
1475
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
1316
1476
|
const padElement2 = {
|
|
@@ -1392,7 +1552,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1392
1552
|
const width = pad.width * Math.abs(transform.a);
|
|
1393
1553
|
const height = pad.height * Math.abs(transform.d);
|
|
1394
1554
|
const radius = pad.radius * Math.abs(transform.a);
|
|
1395
|
-
const [x, y] =
|
|
1555
|
+
const [x, y] = applyToPoint13(transform, [pad.x, pad.y]);
|
|
1396
1556
|
const padElement = {
|
|
1397
1557
|
name: "rect",
|
|
1398
1558
|
type: "element",
|
|
@@ -1430,7 +1590,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1430
1590
|
}
|
|
1431
1591
|
if (pad.shape === "circle") {
|
|
1432
1592
|
const radius = pad.radius * Math.abs(transform.a);
|
|
1433
|
-
const [x, y] =
|
|
1593
|
+
const [x, y] = applyToPoint13(transform, [pad.x, pad.y]);
|
|
1434
1594
|
const padElement = {
|
|
1435
1595
|
name: "circle",
|
|
1436
1596
|
type: "element",
|
|
@@ -1465,7 +1625,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1465
1625
|
}
|
|
1466
1626
|
if (pad.shape === "polygon") {
|
|
1467
1627
|
const points = (pad.points ?? []).map(
|
|
1468
|
-
(point) =>
|
|
1628
|
+
(point) => applyToPoint13(transform, [point.x, point.y])
|
|
1469
1629
|
);
|
|
1470
1630
|
const padElement = {
|
|
1471
1631
|
name: "polygon",
|
|
@@ -1501,32 +1661,32 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1501
1661
|
}
|
|
1502
1662
|
|
|
1503
1663
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
|
|
1504
|
-
import { applyToPoint as
|
|
1664
|
+
import { applyToPoint as applyToPoint14 } from "transformation-matrix";
|
|
1505
1665
|
function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
1506
1666
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1507
1667
|
const { width, height, center, outline } = pcbBoard;
|
|
1508
1668
|
let path;
|
|
1509
1669
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
1510
1670
|
path = outline.map((point, index) => {
|
|
1511
|
-
const [x, y] =
|
|
1671
|
+
const [x, y] = applyToPoint14(transform, [point.x, point.y]);
|
|
1512
1672
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
1513
1673
|
}).join(" ");
|
|
1514
1674
|
} else {
|
|
1515
1675
|
const halfWidth = width / 2;
|
|
1516
1676
|
const halfHeight = height / 2;
|
|
1517
|
-
const topLeft =
|
|
1677
|
+
const topLeft = applyToPoint14(transform, [
|
|
1518
1678
|
center.x - halfWidth,
|
|
1519
1679
|
center.y - halfHeight
|
|
1520
1680
|
]);
|
|
1521
|
-
const topRight =
|
|
1681
|
+
const topRight = applyToPoint14(transform, [
|
|
1522
1682
|
center.x + halfWidth,
|
|
1523
1683
|
center.y - halfHeight
|
|
1524
1684
|
]);
|
|
1525
|
-
const bottomRight =
|
|
1685
|
+
const bottomRight = applyToPoint14(transform, [
|
|
1526
1686
|
center.x + halfWidth,
|
|
1527
1687
|
center.y + halfHeight
|
|
1528
1688
|
]);
|
|
1529
|
-
const bottomLeft =
|
|
1689
|
+
const bottomLeft = applyToPoint14(transform, [
|
|
1530
1690
|
center.x - halfWidth,
|
|
1531
1691
|
center.y + halfHeight
|
|
1532
1692
|
]);
|
|
@@ -1553,10 +1713,10 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
1553
1713
|
}
|
|
1554
1714
|
|
|
1555
1715
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
1556
|
-
import { applyToPoint as
|
|
1716
|
+
import { applyToPoint as applyToPoint15 } from "transformation-matrix";
|
|
1557
1717
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
1558
1718
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1559
|
-
const [x, y] =
|
|
1719
|
+
const [x, y] = applyToPoint15(transform, [hole.x, hole.y]);
|
|
1560
1720
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
1561
1721
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
1562
1722
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -1602,10 +1762,10 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
1602
1762
|
}
|
|
1603
1763
|
|
|
1604
1764
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
1605
|
-
import { applyToPoint as
|
|
1765
|
+
import { applyToPoint as applyToPoint16 } from "transformation-matrix";
|
|
1606
1766
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
1607
1767
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1608
|
-
const [x, y] =
|
|
1768
|
+
const [x, y] = applyToPoint16(transform, [hole.x, hole.y]);
|
|
1609
1769
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
1610
1770
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
1611
1771
|
const radius = scaledDiameter / 2;
|
|
@@ -1679,7 +1839,7 @@ import {
|
|
|
1679
1839
|
getFullConnectivityMapFromCircuitJson
|
|
1680
1840
|
} from "circuit-json-to-connectivity-map";
|
|
1681
1841
|
import "svgson";
|
|
1682
|
-
import { applyToPoint as
|
|
1842
|
+
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
1683
1843
|
|
|
1684
1844
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
1685
1845
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -1759,11 +1919,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
1759
1919
|
});
|
|
1760
1920
|
const svgObjects = [];
|
|
1761
1921
|
for (const line of ratsNestLines) {
|
|
1762
|
-
const transformedStart =
|
|
1922
|
+
const transformedStart = applyToPoint17(transform, [
|
|
1763
1923
|
line.startPoint.x,
|
|
1764
1924
|
line.startPoint.y
|
|
1765
1925
|
]);
|
|
1766
|
-
const transformedEnd =
|
|
1926
|
+
const transformedEnd = applyToPoint17(transform, [
|
|
1767
1927
|
line.endPoint.x,
|
|
1768
1928
|
line.endPoint.y
|
|
1769
1929
|
]);
|
|
@@ -1791,7 +1951,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
1791
1951
|
|
|
1792
1952
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
1793
1953
|
import {
|
|
1794
|
-
applyToPoint as
|
|
1954
|
+
applyToPoint as applyToPoint18,
|
|
1795
1955
|
compose as compose3,
|
|
1796
1956
|
rotate as rotate3,
|
|
1797
1957
|
translate as translate3,
|
|
@@ -1801,7 +1961,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1801
1961
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1802
1962
|
if (cutout.shape === "rect") {
|
|
1803
1963
|
const rectCutout = cutout;
|
|
1804
|
-
const [cx, cy] =
|
|
1964
|
+
const [cx, cy] = applyToPoint18(transform, [
|
|
1805
1965
|
rectCutout.center.x,
|
|
1806
1966
|
rectCutout.center.y
|
|
1807
1967
|
]);
|
|
@@ -1832,7 +1992,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1832
1992
|
}
|
|
1833
1993
|
if (cutout.shape === "circle") {
|
|
1834
1994
|
const circleCutout = cutout;
|
|
1835
|
-
const [cx, cy] =
|
|
1995
|
+
const [cx, cy] = applyToPoint18(transform, [
|
|
1836
1996
|
circleCutout.center.x,
|
|
1837
1997
|
circleCutout.center.y
|
|
1838
1998
|
]);
|
|
@@ -1859,7 +2019,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1859
2019
|
const polygonCutout = cutout;
|
|
1860
2020
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
1861
2021
|
const transformedPoints = polygonCutout.points.map(
|
|
1862
|
-
(p) =>
|
|
2022
|
+
(p) => applyToPoint18(transform, [p.x, p.y])
|
|
1863
2023
|
);
|
|
1864
2024
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
1865
2025
|
return [
|
|
@@ -1883,7 +2043,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1883
2043
|
|
|
1884
2044
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
1885
2045
|
import {
|
|
1886
|
-
applyToPoint as
|
|
2046
|
+
applyToPoint as applyToPoint20,
|
|
1887
2047
|
compose as compose4,
|
|
1888
2048
|
rotate as rotate4,
|
|
1889
2049
|
toString as matrixToString7,
|
|
@@ -1891,11 +2051,11 @@ import {
|
|
|
1891
2051
|
} from "transformation-matrix";
|
|
1892
2052
|
|
|
1893
2053
|
// lib/utils/ring-to-path-d.ts
|
|
1894
|
-
import { applyToPoint as
|
|
2054
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
1895
2055
|
function ringToPathD(vertices, transform) {
|
|
1896
2056
|
if (vertices.length === 0) return "";
|
|
1897
2057
|
const transformedVertices = vertices.map((v) => {
|
|
1898
|
-
const [x, y] =
|
|
2058
|
+
const [x, y] = applyToPoint19(transform, [v.x, v.y]);
|
|
1899
2059
|
return { ...v, x, y };
|
|
1900
2060
|
});
|
|
1901
2061
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -1928,7 +2088,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
1928
2088
|
const color = layerNameToColor(layer, colorMap2);
|
|
1929
2089
|
const opacity = "0.5";
|
|
1930
2090
|
if (pour.shape === "rect") {
|
|
1931
|
-
const [cx, cy] =
|
|
2091
|
+
const [cx, cy] = applyToPoint20(transform, [pour.center.x, pour.center.y]);
|
|
1932
2092
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
1933
2093
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
1934
2094
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -1958,7 +2118,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
1958
2118
|
if (pour.shape === "polygon") {
|
|
1959
2119
|
if (!pour.points || pour.points.length === 0) return [];
|
|
1960
2120
|
const transformedPoints = pour.points.map(
|
|
1961
|
-
(p) =>
|
|
2121
|
+
(p) => applyToPoint20(transform, [p.x, p.y])
|
|
1962
2122
|
);
|
|
1963
2123
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
1964
2124
|
return [
|
|
@@ -2143,11 +2303,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
2143
2303
|
}
|
|
2144
2304
|
|
|
2145
2305
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
2146
|
-
import { applyToPoint as
|
|
2306
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
2147
2307
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
2148
2308
|
const { transform } = ctx;
|
|
2149
2309
|
const { center, width, height, rotation = 0 } = component;
|
|
2150
|
-
const [x, y] =
|
|
2310
|
+
const [x, y] = applyToPoint21(transform, [center.x, center.y]);
|
|
2151
2311
|
const scaledWidth = width * Math.abs(transform.a);
|
|
2152
2312
|
const scaledHeight = height * Math.abs(transform.d);
|
|
2153
2313
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -2197,7 +2357,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
2197
2357
|
var package_default = {
|
|
2198
2358
|
name: "circuit-to-svg",
|
|
2199
2359
|
type: "module",
|
|
2200
|
-
version: "0.0.
|
|
2360
|
+
version: "0.0.230",
|
|
2201
2361
|
description: "Convert Circuit JSON to SVG",
|
|
2202
2362
|
main: "dist/index.js",
|
|
2203
2363
|
files: [
|
|
@@ -2221,7 +2381,7 @@ var package_default = {
|
|
|
2221
2381
|
"bun-match-svg": "^0.0.12",
|
|
2222
2382
|
esbuild: "^0.20.2",
|
|
2223
2383
|
"performance-now": "^2.1.0",
|
|
2224
|
-
"circuit-json": "^0.0.
|
|
2384
|
+
"circuit-json": "^0.0.277",
|
|
2225
2385
|
react: "19.1.0",
|
|
2226
2386
|
"react-cosmos": "7.0.0",
|
|
2227
2387
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -2266,6 +2426,7 @@ var TYPE_PRIORITY = {
|
|
|
2266
2426
|
pcb_component: 60,
|
|
2267
2427
|
pcb_fabrication_note_text: 70,
|
|
2268
2428
|
pcb_fabrication_note_path: 70,
|
|
2429
|
+
pcb_note_dimension: 70,
|
|
2269
2430
|
pcb_trace_error: 80,
|
|
2270
2431
|
pcb_rats_nest: 85
|
|
2271
2432
|
};
|
|
@@ -2640,6 +2801,8 @@ function createSvgObjects({
|
|
|
2640
2801
|
return createSvgObjectsFromPcbFabricationNotePath(elm, ctx);
|
|
2641
2802
|
case "pcb_fabrication_note_text":
|
|
2642
2803
|
return createSvgObjectsFromPcbFabricationNoteText(elm, ctx);
|
|
2804
|
+
case "pcb_note_dimension":
|
|
2805
|
+
return createSvgObjectsFromPcbNoteDimension(elm, ctx);
|
|
2643
2806
|
case "pcb_silkscreen_path":
|
|
2644
2807
|
return createSvgObjectsFromPcbSilkscreenPath(elm, ctx);
|
|
2645
2808
|
case "pcb_board":
|
|
@@ -2653,8 +2816,8 @@ function createSvgObjects({
|
|
|
2653
2816
|
}
|
|
2654
2817
|
}
|
|
2655
2818
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
2656
|
-
const [x1, y1] =
|
|
2657
|
-
const [x2, y2] =
|
|
2819
|
+
const [x1, y1] = applyToPoint22(transform, [minX, minY]);
|
|
2820
|
+
const [x2, y2] = applyToPoint22(transform, [maxX, maxY]);
|
|
2658
2821
|
const width = Math.abs(x2 - x1);
|
|
2659
2822
|
const height = Math.abs(y2 - y1);
|
|
2660
2823
|
const x = Math.min(x1, x2);
|
|
@@ -2684,14 +2847,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
2684
2847
|
import { stringify as stringify2 } from "svgson";
|
|
2685
2848
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
2686
2849
|
import {
|
|
2687
|
-
applyToPoint as
|
|
2850
|
+
applyToPoint as applyToPoint29,
|
|
2688
2851
|
compose as compose6,
|
|
2689
2852
|
scale as scale3,
|
|
2690
2853
|
translate as translate6
|
|
2691
2854
|
} from "transformation-matrix";
|
|
2692
2855
|
|
|
2693
2856
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
2694
|
-
import { applyToPoint as
|
|
2857
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
2695
2858
|
var DEFAULT_BOARD_STYLE = {
|
|
2696
2859
|
fill: "none",
|
|
2697
2860
|
stroke: "rgb(0,0,0)",
|
|
@@ -2703,25 +2866,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
2703
2866
|
let path;
|
|
2704
2867
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
2705
2868
|
path = outline.map((point, index) => {
|
|
2706
|
-
const [x, y] =
|
|
2869
|
+
const [x, y] = applyToPoint23(transform, [point.x, point.y]);
|
|
2707
2870
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
2708
2871
|
}).join(" ");
|
|
2709
2872
|
} else {
|
|
2710
2873
|
const halfWidth = width / 2;
|
|
2711
2874
|
const halfHeight = height / 2;
|
|
2712
|
-
const topLeft =
|
|
2875
|
+
const topLeft = applyToPoint23(transform, [
|
|
2713
2876
|
center.x - halfWidth,
|
|
2714
2877
|
center.y - halfHeight
|
|
2715
2878
|
]);
|
|
2716
|
-
const topRight =
|
|
2879
|
+
const topRight = applyToPoint23(transform, [
|
|
2717
2880
|
center.x + halfWidth,
|
|
2718
2881
|
center.y - halfHeight
|
|
2719
2882
|
]);
|
|
2720
|
-
const bottomRight =
|
|
2883
|
+
const bottomRight = applyToPoint23(transform, [
|
|
2721
2884
|
center.x + halfWidth,
|
|
2722
2885
|
center.y + halfHeight
|
|
2723
2886
|
]);
|
|
2724
|
-
const bottomLeft =
|
|
2887
|
+
const bottomLeft = applyToPoint23(transform, [
|
|
2725
2888
|
center.x - halfWidth,
|
|
2726
2889
|
center.y + halfHeight
|
|
2727
2890
|
]);
|
|
@@ -2747,7 +2910,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
2747
2910
|
}
|
|
2748
2911
|
|
|
2749
2912
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
2750
|
-
import { applyToPoint as
|
|
2913
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
2751
2914
|
|
|
2752
2915
|
// lib/utils/get-sch-font-size.ts
|
|
2753
2916
|
import "transformation-matrix";
|
|
@@ -2773,8 +2936,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
2773
2936
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
2774
2937
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
2775
2938
|
return null;
|
|
2776
|
-
const [x, y] =
|
|
2777
|
-
const [pinX, pinY] =
|
|
2939
|
+
const [x, y] = applyToPoint25(transform, [center.x, center.y]);
|
|
2940
|
+
const [pinX, pinY] = applyToPoint25(transform, [portPosition.x, portPosition.y]);
|
|
2778
2941
|
const scaledWidth = width * Math.abs(transform.a);
|
|
2779
2942
|
const scaledHeight = height * Math.abs(transform.d);
|
|
2780
2943
|
const isTopLayer = layer === "top";
|
|
@@ -2936,11 +3099,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
2936
3099
|
}
|
|
2937
3100
|
|
|
2938
3101
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
2939
|
-
import { applyToPoint as
|
|
3102
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
2940
3103
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
2941
3104
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
2942
3105
|
const { transform } = ctx;
|
|
2943
|
-
const [x, y] =
|
|
3106
|
+
const [x, y] = applyToPoint26(transform, [hole.x, hole.y]);
|
|
2944
3107
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
2945
3108
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
2946
3109
|
const radius = scaledDiameter / 2;
|
|
@@ -3004,12 +3167,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
3004
3167
|
}
|
|
3005
3168
|
|
|
3006
3169
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
3007
|
-
import { applyToPoint as
|
|
3170
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
3008
3171
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
3009
3172
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
3010
3173
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
3011
3174
|
const { transform } = ctx;
|
|
3012
|
-
const [x, y] =
|
|
3175
|
+
const [x, y] = applyToPoint27(transform, [hole.x, hole.y]);
|
|
3013
3176
|
if (hole.shape === "pill") {
|
|
3014
3177
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
3015
3178
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -3104,7 +3267,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3104
3267
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
3105
3268
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
3106
3269
|
const holeRadius = scaledHoleDiameter / 2;
|
|
3107
|
-
const [holeCx, holeCy] =
|
|
3270
|
+
const [holeCx, holeCy] = applyToPoint27(transform, [
|
|
3108
3271
|
circularHole.x + circularHole.hole_offset_x,
|
|
3109
3272
|
circularHole.y + circularHole.hole_offset_y
|
|
3110
3273
|
]);
|
|
@@ -3162,7 +3325,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3162
3325
|
const pillHoleWithOffsets = pillHole;
|
|
3163
3326
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
3164
3327
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
3165
|
-
const [holeCenterX, holeCenterY] =
|
|
3328
|
+
const [holeCenterX, holeCenterY] = applyToPoint27(transform, [
|
|
3166
3329
|
pillHole.x + holeOffsetX,
|
|
3167
3330
|
pillHole.y + holeOffsetY
|
|
3168
3331
|
]);
|
|
@@ -3224,7 +3387,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3224
3387
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
3225
3388
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
3226
3389
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
3227
|
-
const [holeCenterX, holeCenterY] =
|
|
3390
|
+
const [holeCenterX, holeCenterY] = applyToPoint27(transform, [
|
|
3228
3391
|
rotatedHole.x + holeOffsetX,
|
|
3229
3392
|
rotatedHole.y + holeOffsetY
|
|
3230
3393
|
]);
|
|
@@ -3280,14 +3443,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3280
3443
|
}
|
|
3281
3444
|
|
|
3282
3445
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
3283
|
-
import { applyToPoint as
|
|
3446
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
3284
3447
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
3285
3448
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
3286
3449
|
const { transform } = ctx;
|
|
3287
3450
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
3288
3451
|
const width = pad.width * Math.abs(transform.a);
|
|
3289
3452
|
const height = pad.height * Math.abs(transform.d);
|
|
3290
|
-
const [x, y] =
|
|
3453
|
+
const [x, y] = applyToPoint28(transform, [pad.x, pad.y]);
|
|
3291
3454
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
3292
3455
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
3293
3456
|
return [
|
|
@@ -3339,7 +3502,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3339
3502
|
const width = pad.width * Math.abs(transform.a);
|
|
3340
3503
|
const height = pad.height * Math.abs(transform.d);
|
|
3341
3504
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3342
|
-
const [x, y] =
|
|
3505
|
+
const [x, y] = applyToPoint28(transform, [pad.x, pad.y]);
|
|
3343
3506
|
return [
|
|
3344
3507
|
{
|
|
3345
3508
|
name: "rect",
|
|
@@ -3362,7 +3525,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3362
3525
|
}
|
|
3363
3526
|
if (pad.shape === "circle") {
|
|
3364
3527
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3365
|
-
const [x, y] =
|
|
3528
|
+
const [x, y] = applyToPoint28(transform, [pad.x, pad.y]);
|
|
3366
3529
|
return [
|
|
3367
3530
|
{
|
|
3368
3531
|
name: "circle",
|
|
@@ -3382,7 +3545,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3382
3545
|
}
|
|
3383
3546
|
if (pad.shape === "polygon") {
|
|
3384
3547
|
const points = (pad.points ?? []).map(
|
|
3385
|
-
(point) =>
|
|
3548
|
+
(point) => applyToPoint28(transform, [point.x, point.y])
|
|
3386
3549
|
);
|
|
3387
3550
|
return [
|
|
3388
3551
|
{
|
|
@@ -3559,8 +3722,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
3559
3722
|
}
|
|
3560
3723
|
}
|
|
3561
3724
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
3562
|
-
const [x1, y1] =
|
|
3563
|
-
const [x2, y2] =
|
|
3725
|
+
const [x1, y1] = applyToPoint29(transform, [minX, minY]);
|
|
3726
|
+
const [x2, y2] = applyToPoint29(transform, [maxX, maxY]);
|
|
3564
3727
|
const width = Math.abs(x2 - x1);
|
|
3565
3728
|
const height = Math.abs(y2 - y1);
|
|
3566
3729
|
const x = Math.min(x1, x2);
|
|
@@ -3589,7 +3752,7 @@ import {
|
|
|
3589
3752
|
} from "transformation-matrix";
|
|
3590
3753
|
|
|
3591
3754
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
3592
|
-
import { applyToPoint as
|
|
3755
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
3593
3756
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
3594
3757
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
3595
3758
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -3599,25 +3762,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3599
3762
|
let path;
|
|
3600
3763
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
3601
3764
|
path = outline.map((point, index) => {
|
|
3602
|
-
const [x, y] =
|
|
3765
|
+
const [x, y] = applyToPoint30(transform, [point.x, point.y]);
|
|
3603
3766
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3604
3767
|
}).join(" ");
|
|
3605
3768
|
} else {
|
|
3606
3769
|
const halfWidth = width / 2;
|
|
3607
3770
|
const halfHeight = height / 2;
|
|
3608
|
-
const topLeft =
|
|
3771
|
+
const topLeft = applyToPoint30(transform, [
|
|
3609
3772
|
center.x - halfWidth,
|
|
3610
3773
|
center.y - halfHeight
|
|
3611
3774
|
]);
|
|
3612
|
-
const topRight =
|
|
3775
|
+
const topRight = applyToPoint30(transform, [
|
|
3613
3776
|
center.x + halfWidth,
|
|
3614
3777
|
center.y - halfHeight
|
|
3615
3778
|
]);
|
|
3616
|
-
const bottomRight =
|
|
3779
|
+
const bottomRight = applyToPoint30(transform, [
|
|
3617
3780
|
center.x + halfWidth,
|
|
3618
3781
|
center.y + halfHeight
|
|
3619
3782
|
]);
|
|
3620
|
-
const bottomLeft =
|
|
3783
|
+
const bottomLeft = applyToPoint30(transform, [
|
|
3621
3784
|
center.x - halfWidth,
|
|
3622
3785
|
center.y + halfHeight
|
|
3623
3786
|
]);
|
|
@@ -3635,10 +3798,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3635
3798
|
const halfWidth = width2 / 2;
|
|
3636
3799
|
const halfHeight = height2 / 2;
|
|
3637
3800
|
const [tl, tr, br, bl] = [
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3801
|
+
applyToPoint30(transform, [x - halfWidth, y - halfHeight]),
|
|
3802
|
+
applyToPoint30(transform, [x + halfWidth, y - halfHeight]),
|
|
3803
|
+
applyToPoint30(transform, [x + halfWidth, y + halfHeight]),
|
|
3804
|
+
applyToPoint30(transform, [x - halfWidth, y + halfHeight])
|
|
3642
3805
|
];
|
|
3643
3806
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
3644
3807
|
} else if (cutout.shape === "circle") {
|
|
@@ -3665,7 +3828,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3665
3828
|
|
|
3666
3829
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
3667
3830
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
3668
|
-
import { applyToPoint as
|
|
3831
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
3669
3832
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
3670
3833
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
3671
3834
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -3675,7 +3838,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
3675
3838
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
3676
3839
|
return [];
|
|
3677
3840
|
}
|
|
3678
|
-
const [x, y] =
|
|
3841
|
+
const [x, y] = applyToPoint31(transform, [center.x, center.y]);
|
|
3679
3842
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3680
3843
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3681
3844
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -3736,11 +3899,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
3736
3899
|
}
|
|
3737
3900
|
|
|
3738
3901
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
3739
|
-
import { applyToPoint as
|
|
3902
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
3740
3903
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
3741
3904
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
3742
3905
|
const { transform } = ctx;
|
|
3743
|
-
const [x, y] =
|
|
3906
|
+
const [x, y] = applyToPoint32(transform, [hole.x, hole.y]);
|
|
3744
3907
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
3745
3908
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
3746
3909
|
const radius = scaledDiameter / 2;
|
|
@@ -3804,12 +3967,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
3804
3967
|
}
|
|
3805
3968
|
|
|
3806
3969
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
3807
|
-
import { applyToPoint as
|
|
3970
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
3808
3971
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
3809
3972
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
3810
3973
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
3811
3974
|
const { transform } = ctx;
|
|
3812
|
-
const [x, y] =
|
|
3975
|
+
const [x, y] = applyToPoint33(transform, [hole.x, hole.y]);
|
|
3813
3976
|
if (hole.shape === "pill") {
|
|
3814
3977
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
3815
3978
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -4044,14 +4207,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
4044
4207
|
}
|
|
4045
4208
|
|
|
4046
4209
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
4047
|
-
import { applyToPoint as
|
|
4210
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
4048
4211
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
4049
4212
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
4050
4213
|
const { transform } = ctx;
|
|
4051
4214
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
4052
4215
|
const width = pad.width * Math.abs(transform.a);
|
|
4053
4216
|
const height = pad.height * Math.abs(transform.d);
|
|
4054
|
-
const [x, y] =
|
|
4217
|
+
const [x, y] = applyToPoint34(transform, [pad.x, pad.y]);
|
|
4055
4218
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
4056
4219
|
return [
|
|
4057
4220
|
{
|
|
@@ -4094,7 +4257,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4094
4257
|
const width = pad.width * Math.abs(transform.a);
|
|
4095
4258
|
const height = pad.height * Math.abs(transform.d);
|
|
4096
4259
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4097
|
-
const [x, y] =
|
|
4260
|
+
const [x, y] = applyToPoint34(transform, [pad.x, pad.y]);
|
|
4098
4261
|
return [
|
|
4099
4262
|
{
|
|
4100
4263
|
name: "rect",
|
|
@@ -4117,7 +4280,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4117
4280
|
}
|
|
4118
4281
|
if (pad.shape === "circle") {
|
|
4119
4282
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4120
|
-
const [x, y] =
|
|
4283
|
+
const [x, y] = applyToPoint34(transform, [pad.x, pad.y]);
|
|
4121
4284
|
return [
|
|
4122
4285
|
{
|
|
4123
4286
|
name: "circle",
|
|
@@ -4137,7 +4300,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4137
4300
|
}
|
|
4138
4301
|
if (pad.shape === "polygon") {
|
|
4139
4302
|
const points = (pad.points ?? []).map(
|
|
4140
|
-
(point) =>
|
|
4303
|
+
(point) => applyToPoint34(transform, [point.x, point.y])
|
|
4141
4304
|
);
|
|
4142
4305
|
return [
|
|
4143
4306
|
{
|
|
@@ -4158,7 +4321,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4158
4321
|
}
|
|
4159
4322
|
|
|
4160
4323
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
4161
|
-
import { applyToPoint as
|
|
4324
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
4162
4325
|
import { calculateElbow } from "calculate-elbow";
|
|
4163
4326
|
|
|
4164
4327
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -4235,7 +4398,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
4235
4398
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
4236
4399
|
if (!label_info) return [];
|
|
4237
4400
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
4238
|
-
const [port_x, port_y] =
|
|
4401
|
+
const [port_x, port_y] = applyToPoint35(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
4239
4402
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
4240
4403
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
4241
4404
|
const elbow_path = calculateElbow(
|
|
@@ -4376,7 +4539,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
4376
4539
|
}
|
|
4377
4540
|
|
|
4378
4541
|
// lib/pinout/calculate-label-positions.ts
|
|
4379
|
-
import { applyToPoint as
|
|
4542
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
4380
4543
|
|
|
4381
4544
|
// lib/pinout/constants.ts
|
|
4382
4545
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -4414,7 +4577,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4414
4577
|
);
|
|
4415
4578
|
const mapToEdgePort = (pinout_label) => ({
|
|
4416
4579
|
pcb_port: pinout_label.pcb_port,
|
|
4417
|
-
y:
|
|
4580
|
+
y: applyToPoint36(transform, [
|
|
4418
4581
|
pinout_label.pcb_port.x,
|
|
4419
4582
|
pinout_label.pcb_port.y
|
|
4420
4583
|
])[1],
|
|
@@ -4429,7 +4592,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4429
4592
|
} else {
|
|
4430
4593
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
4431
4594
|
pcb_port: pinout_label.pcb_port,
|
|
4432
|
-
y:
|
|
4595
|
+
y: applyToPoint36(transform, [
|
|
4433
4596
|
pinout_label.pcb_port.x,
|
|
4434
4597
|
pinout_label.pcb_port.y
|
|
4435
4598
|
])[1],
|
|
@@ -4437,7 +4600,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4437
4600
|
})).sort((a, b) => a.y - b.y);
|
|
4438
4601
|
}
|
|
4439
4602
|
if (edge_ports.length === 0) return;
|
|
4440
|
-
const board_edge_x =
|
|
4603
|
+
const board_edge_x = applyToPoint36(transform, [
|
|
4441
4604
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
4442
4605
|
0
|
|
4443
4606
|
])[0];
|
|
@@ -5086,14 +5249,14 @@ import {
|
|
|
5086
5249
|
} from "transformation-matrix";
|
|
5087
5250
|
|
|
5088
5251
|
// lib/sch/draw-schematic-grid.ts
|
|
5089
|
-
import { applyToPoint as
|
|
5252
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
5090
5253
|
function drawSchematicGrid(params) {
|
|
5091
5254
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
5092
5255
|
const cellSize = params.cellSize ?? 1;
|
|
5093
5256
|
const labelCells = params.labelCells ?? false;
|
|
5094
5257
|
const gridLines = [];
|
|
5095
5258
|
const transformPoint = (x, y) => {
|
|
5096
|
-
const [transformedX, transformedY] =
|
|
5259
|
+
const [transformedX, transformedY] = applyToPoint37(params.transform, [x, y]);
|
|
5097
5260
|
return { x: transformedX, y: transformedY };
|
|
5098
5261
|
};
|
|
5099
5262
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -5174,15 +5337,15 @@ function drawSchematicGrid(params) {
|
|
|
5174
5337
|
}
|
|
5175
5338
|
|
|
5176
5339
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
5177
|
-
import { applyToPoint as
|
|
5340
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
5178
5341
|
function drawSchematicLabeledPoints(params) {
|
|
5179
5342
|
const { points, transform } = params;
|
|
5180
5343
|
const labeledPointsGroup = [];
|
|
5181
5344
|
for (const point of points) {
|
|
5182
|
-
const [x1, y1] =
|
|
5183
|
-
const [x2, y2] =
|
|
5184
|
-
const [x3, y3] =
|
|
5185
|
-
const [x4, y4] =
|
|
5345
|
+
const [x1, y1] = applyToPoint38(transform, [point.x - 0.1, point.y - 0.1]);
|
|
5346
|
+
const [x2, y2] = applyToPoint38(transform, [point.x + 0.1, point.y + 0.1]);
|
|
5347
|
+
const [x3, y3] = applyToPoint38(transform, [point.x - 0.1, point.y + 0.1]);
|
|
5348
|
+
const [x4, y4] = applyToPoint38(transform, [point.x + 0.1, point.y - 0.1]);
|
|
5186
5349
|
labeledPointsGroup.push({
|
|
5187
5350
|
name: "path",
|
|
5188
5351
|
type: "element",
|
|
@@ -5193,7 +5356,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
5193
5356
|
"stroke-opacity": "0.7"
|
|
5194
5357
|
}
|
|
5195
5358
|
});
|
|
5196
|
-
const [labelX, labelY] =
|
|
5359
|
+
const [labelX, labelY] = applyToPoint38(transform, [
|
|
5197
5360
|
point.x + 0.15,
|
|
5198
5361
|
point.y - 0.15
|
|
5199
5362
|
]);
|
|
@@ -6287,7 +6450,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
6287
6450
|
import { symbols } from "schematic-symbols";
|
|
6288
6451
|
import "svgson";
|
|
6289
6452
|
import {
|
|
6290
|
-
applyToPoint as
|
|
6453
|
+
applyToPoint as applyToPoint40,
|
|
6291
6454
|
compose as compose9
|
|
6292
6455
|
} from "transformation-matrix";
|
|
6293
6456
|
|
|
@@ -6371,13 +6534,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
6371
6534
|
}
|
|
6372
6535
|
|
|
6373
6536
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
6374
|
-
import { applyToPoint as
|
|
6537
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
6375
6538
|
var createSvgSchErrorText = ({
|
|
6376
6539
|
text,
|
|
6377
6540
|
realCenter,
|
|
6378
6541
|
realToScreenTransform
|
|
6379
6542
|
}) => {
|
|
6380
|
-
const screenCenter =
|
|
6543
|
+
const screenCenter = applyToPoint39(realToScreenTransform, realCenter);
|
|
6381
6544
|
return {
|
|
6382
6545
|
type: "element",
|
|
6383
6546
|
name: "text",
|
|
@@ -6486,11 +6649,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6486
6649
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
6487
6650
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
6488
6651
|
};
|
|
6489
|
-
const [screenMinX, screenMinY] =
|
|
6652
|
+
const [screenMinX, screenMinY] = applyToPoint40(
|
|
6490
6653
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6491
6654
|
[bounds.minX, bounds.minY]
|
|
6492
6655
|
);
|
|
6493
|
-
const [screenMaxX, screenMaxY] =
|
|
6656
|
+
const [screenMaxX, screenMaxY] = applyToPoint40(
|
|
6494
6657
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6495
6658
|
[bounds.maxX, bounds.maxY]
|
|
6496
6659
|
);
|
|
@@ -6519,7 +6682,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6519
6682
|
name: "path",
|
|
6520
6683
|
attributes: {
|
|
6521
6684
|
d: points.map((p, i) => {
|
|
6522
|
-
const [x, y] =
|
|
6685
|
+
const [x, y] = applyToPoint40(
|
|
6523
6686
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6524
6687
|
[p.x, p.y]
|
|
6525
6688
|
);
|
|
@@ -6535,7 +6698,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6535
6698
|
});
|
|
6536
6699
|
}
|
|
6537
6700
|
for (const text of texts) {
|
|
6538
|
-
const screenTextPos =
|
|
6701
|
+
const screenTextPos = applyToPoint40(
|
|
6539
6702
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6540
6703
|
text
|
|
6541
6704
|
);
|
|
@@ -6587,7 +6750,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6587
6750
|
});
|
|
6588
6751
|
}
|
|
6589
6752
|
for (const box of boxes) {
|
|
6590
|
-
const screenBoxPos =
|
|
6753
|
+
const screenBoxPos = applyToPoint40(
|
|
6591
6754
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6592
6755
|
box
|
|
6593
6756
|
);
|
|
@@ -6611,7 +6774,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6611
6774
|
}
|
|
6612
6775
|
for (const port of symbol.ports) {
|
|
6613
6776
|
if (connectedSymbolPorts.has(port)) continue;
|
|
6614
|
-
const screenPortPos =
|
|
6777
|
+
const screenPortPos = applyToPoint40(
|
|
6615
6778
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6616
6779
|
port
|
|
6617
6780
|
);
|
|
@@ -6631,7 +6794,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6631
6794
|
});
|
|
6632
6795
|
}
|
|
6633
6796
|
for (const circle of circles) {
|
|
6634
|
-
const screenCirclePos =
|
|
6797
|
+
const screenCirclePos = applyToPoint40(
|
|
6635
6798
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6636
6799
|
circle
|
|
6637
6800
|
);
|
|
@@ -6658,14 +6821,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6658
6821
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
6659
6822
|
import "schematic-symbols";
|
|
6660
6823
|
import "svgson";
|
|
6661
|
-
import { applyToPoint as
|
|
6824
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
6662
6825
|
|
|
6663
6826
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
6664
6827
|
import "transformation-matrix";
|
|
6665
6828
|
import "@tscircuit/circuit-json-util";
|
|
6666
6829
|
|
|
6667
6830
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
6668
|
-
import { applyToPoint as
|
|
6831
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
6669
6832
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
6670
6833
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
6671
6834
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -6718,8 +6881,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
6718
6881
|
realEdgePos.y += realPinLineLength;
|
|
6719
6882
|
break;
|
|
6720
6883
|
}
|
|
6721
|
-
const screenSchPortPos =
|
|
6722
|
-
const screenRealEdgePos =
|
|
6884
|
+
const screenSchPortPos = applyToPoint41(transform, schPort.center);
|
|
6885
|
+
const screenRealEdgePos = applyToPoint41(transform, realEdgePos);
|
|
6723
6886
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
6724
6887
|
const realLineEnd = { ...schPort.center };
|
|
6725
6888
|
if (!isConnected) {
|
|
@@ -6738,7 +6901,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
6738
6901
|
break;
|
|
6739
6902
|
}
|
|
6740
6903
|
}
|
|
6741
|
-
const screenLineEnd =
|
|
6904
|
+
const screenLineEnd = applyToPoint41(transform, realLineEnd);
|
|
6742
6905
|
svgObjects.push({
|
|
6743
6906
|
name: "line",
|
|
6744
6907
|
type: "element",
|
|
@@ -6859,7 +7022,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
6859
7022
|
};
|
|
6860
7023
|
|
|
6861
7024
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
6862
|
-
import { applyToPoint as
|
|
7025
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
6863
7026
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
6864
7027
|
const svgObjects = [];
|
|
6865
7028
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -6877,7 +7040,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
6877
7040
|
} else {
|
|
6878
7041
|
realPinNumberPos.y += 0.02;
|
|
6879
7042
|
}
|
|
6880
|
-
const screenPinNumberTextPos =
|
|
7043
|
+
const screenPinNumberTextPos = applyToPoint42(transform, realPinNumberPos);
|
|
6881
7044
|
svgObjects.push({
|
|
6882
7045
|
name: "text",
|
|
6883
7046
|
type: "element",
|
|
@@ -6907,7 +7070,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
6907
7070
|
};
|
|
6908
7071
|
|
|
6909
7072
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
6910
|
-
import { applyToPoint as
|
|
7073
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
6911
7074
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
6912
7075
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
6913
7076
|
const svgObjects = [];
|
|
@@ -6921,7 +7084,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
6921
7084
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
6922
7085
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
6923
7086
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
6924
|
-
const screenPinNumberTextPos =
|
|
7087
|
+
const screenPinNumberTextPos = applyToPoint43(transform, realPinNumberPos);
|
|
6925
7088
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
6926
7089
|
if (!label) return [];
|
|
6927
7090
|
const isNegated = label.startsWith("N_");
|
|
@@ -6969,13 +7132,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
6969
7132
|
};
|
|
6970
7133
|
|
|
6971
7134
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
6972
|
-
import { applyToPoint as
|
|
7135
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
6973
7136
|
var createSvgSchText = ({
|
|
6974
7137
|
elm,
|
|
6975
7138
|
transform,
|
|
6976
7139
|
colorMap: colorMap2
|
|
6977
7140
|
}) => {
|
|
6978
|
-
const center =
|
|
7141
|
+
const center = applyToPoint45(transform, elm.position);
|
|
6979
7142
|
const textAnchorMap = {
|
|
6980
7143
|
center: "middle",
|
|
6981
7144
|
center_right: "end",
|
|
@@ -7059,11 +7222,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
7059
7222
|
colorMap: colorMap2
|
|
7060
7223
|
}) => {
|
|
7061
7224
|
const svgObjects = [];
|
|
7062
|
-
const componentScreenTopLeft =
|
|
7225
|
+
const componentScreenTopLeft = applyToPoint46(transform, {
|
|
7063
7226
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
7064
7227
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
7065
7228
|
});
|
|
7066
|
-
const componentScreenBottomRight =
|
|
7229
|
+
const componentScreenBottomRight = applyToPoint46(transform, {
|
|
7067
7230
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
7068
7231
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
7069
7232
|
});
|
|
@@ -7149,13 +7312,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
7149
7312
|
}
|
|
7150
7313
|
|
|
7151
7314
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
7152
|
-
import { applyToPoint as
|
|
7315
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7153
7316
|
function createSvgObjectsFromSchVoltageProbe({
|
|
7154
7317
|
probe,
|
|
7155
7318
|
transform,
|
|
7156
7319
|
colorMap: colorMap2
|
|
7157
7320
|
}) {
|
|
7158
|
-
const [screenX, screenY] =
|
|
7321
|
+
const [screenX, screenY] = applyToPoint47(transform, [
|
|
7159
7322
|
probe.position.x,
|
|
7160
7323
|
probe.position.y
|
|
7161
7324
|
]);
|
|
@@ -7215,17 +7378,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
7215
7378
|
}
|
|
7216
7379
|
|
|
7217
7380
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
7218
|
-
import { applyToPoint as
|
|
7381
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7219
7382
|
function createSvgObjectsFromSchDebugObject({
|
|
7220
7383
|
debugObject,
|
|
7221
7384
|
transform
|
|
7222
7385
|
}) {
|
|
7223
7386
|
if (debugObject.shape === "rect") {
|
|
7224
|
-
let [screenLeft, screenTop] =
|
|
7387
|
+
let [screenLeft, screenTop] = applyToPoint48(transform, [
|
|
7225
7388
|
debugObject.center.x - debugObject.size.width / 2,
|
|
7226
7389
|
debugObject.center.y - debugObject.size.height / 2
|
|
7227
7390
|
]);
|
|
7228
|
-
let [screenRight, screenBottom] =
|
|
7391
|
+
let [screenRight, screenBottom] = applyToPoint48(transform, [
|
|
7229
7392
|
debugObject.center.x + debugObject.size.width / 2,
|
|
7230
7393
|
debugObject.center.y + debugObject.size.height / 2
|
|
7231
7394
|
]);
|
|
@@ -7235,7 +7398,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7235
7398
|
];
|
|
7236
7399
|
const width = Math.abs(screenRight - screenLeft);
|
|
7237
7400
|
const height = Math.abs(screenBottom - screenTop);
|
|
7238
|
-
const [screenCenterX, screenCenterY] =
|
|
7401
|
+
const [screenCenterX, screenCenterY] = applyToPoint48(transform, [
|
|
7239
7402
|
debugObject.center.x,
|
|
7240
7403
|
debugObject.center.y
|
|
7241
7404
|
]);
|
|
@@ -7281,11 +7444,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7281
7444
|
];
|
|
7282
7445
|
}
|
|
7283
7446
|
if (debugObject.shape === "line") {
|
|
7284
|
-
const [screenStartX, screenStartY] =
|
|
7447
|
+
const [screenStartX, screenStartY] = applyToPoint48(transform, [
|
|
7285
7448
|
debugObject.start.x,
|
|
7286
7449
|
debugObject.start.y
|
|
7287
7450
|
]);
|
|
7288
|
-
const [screenEndX, screenEndY] =
|
|
7451
|
+
const [screenEndX, screenEndY] = applyToPoint48(transform, [
|
|
7289
7452
|
debugObject.end.x,
|
|
7290
7453
|
debugObject.end.y
|
|
7291
7454
|
]);
|
|
@@ -7335,7 +7498,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7335
7498
|
}
|
|
7336
7499
|
|
|
7337
7500
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
7338
|
-
import { applyToPoint as
|
|
7501
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7339
7502
|
function createSchematicTrace({
|
|
7340
7503
|
trace,
|
|
7341
7504
|
transform,
|
|
@@ -7349,11 +7512,11 @@ function createSchematicTrace({
|
|
|
7349
7512
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
7350
7513
|
const edge = edges[edgeIndex];
|
|
7351
7514
|
if (edge.is_crossing) continue;
|
|
7352
|
-
const [screenFromX, screenFromY] =
|
|
7515
|
+
const [screenFromX, screenFromY] = applyToPoint49(transform, [
|
|
7353
7516
|
edge.from.x,
|
|
7354
7517
|
edge.from.y
|
|
7355
7518
|
]);
|
|
7356
|
-
const [screenToX, screenToY] =
|
|
7519
|
+
const [screenToX, screenToY] = applyToPoint49(transform, [
|
|
7357
7520
|
edge.to.x,
|
|
7358
7521
|
edge.to.y
|
|
7359
7522
|
]);
|
|
@@ -7397,11 +7560,11 @@ function createSchematicTrace({
|
|
|
7397
7560
|
}
|
|
7398
7561
|
for (const edge of edges) {
|
|
7399
7562
|
if (!edge.is_crossing) continue;
|
|
7400
|
-
const [screenFromX, screenFromY] =
|
|
7563
|
+
const [screenFromX, screenFromY] = applyToPoint49(transform, [
|
|
7401
7564
|
edge.from.x,
|
|
7402
7565
|
edge.from.y
|
|
7403
7566
|
]);
|
|
7404
|
-
const [screenToX, screenToY] =
|
|
7567
|
+
const [screenToX, screenToY] = applyToPoint49(transform, [
|
|
7405
7568
|
edge.to.x,
|
|
7406
7569
|
edge.to.y
|
|
7407
7570
|
]);
|
|
@@ -7445,7 +7608,7 @@ function createSchematicTrace({
|
|
|
7445
7608
|
}
|
|
7446
7609
|
if (trace.junctions) {
|
|
7447
7610
|
for (const junction of trace.junctions) {
|
|
7448
|
-
const [screenX, screenY] =
|
|
7611
|
+
const [screenX, screenY] = applyToPoint49(transform, [
|
|
7449
7612
|
junction.x,
|
|
7450
7613
|
junction.y
|
|
7451
7614
|
]);
|
|
@@ -7500,7 +7663,7 @@ function createSchematicTrace({
|
|
|
7500
7663
|
|
|
7501
7664
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
7502
7665
|
import {
|
|
7503
|
-
applyToPoint as
|
|
7666
|
+
applyToPoint as applyToPoint51,
|
|
7504
7667
|
compose as compose11,
|
|
7505
7668
|
rotate as rotate6,
|
|
7506
7669
|
scale as scale6,
|
|
@@ -7509,7 +7672,7 @@ import {
|
|
|
7509
7672
|
|
|
7510
7673
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
7511
7674
|
import {
|
|
7512
|
-
applyToPoint as
|
|
7675
|
+
applyToPoint as applyToPoint50,
|
|
7513
7676
|
compose as compose10,
|
|
7514
7677
|
rotate as rotate5,
|
|
7515
7678
|
scale as scale5,
|
|
@@ -7584,7 +7747,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7584
7747
|
x: symbolBounds.minX,
|
|
7585
7748
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
7586
7749
|
};
|
|
7587
|
-
const rotatedSymbolEnd =
|
|
7750
|
+
const rotatedSymbolEnd = applyToPoint50(rotationMatrix, symbolEndPoint);
|
|
7588
7751
|
const symbolToRealTransform = compose10(
|
|
7589
7752
|
translate10(
|
|
7590
7753
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -7594,11 +7757,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7594
7757
|
scale5(1)
|
|
7595
7758
|
// Use full symbol size
|
|
7596
7759
|
);
|
|
7597
|
-
const [screenMinX, screenMinY] =
|
|
7760
|
+
const [screenMinX, screenMinY] = applyToPoint50(
|
|
7598
7761
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7599
7762
|
[bounds.minX, bounds.minY]
|
|
7600
7763
|
);
|
|
7601
|
-
const [screenMaxX, screenMaxY] =
|
|
7764
|
+
const [screenMaxX, screenMaxY] = applyToPoint50(
|
|
7602
7765
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7603
7766
|
[bounds.maxX, bounds.maxY]
|
|
7604
7767
|
);
|
|
@@ -7622,7 +7785,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7622
7785
|
});
|
|
7623
7786
|
for (const path of symbolPaths) {
|
|
7624
7787
|
const symbolPath = path.points.map((p, i) => {
|
|
7625
|
-
const [x, y] =
|
|
7788
|
+
const [x, y] = applyToPoint50(
|
|
7626
7789
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7627
7790
|
[p.x, p.y]
|
|
7628
7791
|
);
|
|
@@ -7643,7 +7806,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7643
7806
|
});
|
|
7644
7807
|
}
|
|
7645
7808
|
for (const text of symbolTexts) {
|
|
7646
|
-
const screenTextPos =
|
|
7809
|
+
const screenTextPos = applyToPoint50(
|
|
7647
7810
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7648
7811
|
text
|
|
7649
7812
|
);
|
|
@@ -7685,7 +7848,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7685
7848
|
});
|
|
7686
7849
|
}
|
|
7687
7850
|
for (const box of symbolBoxes) {
|
|
7688
|
-
const screenBoxPos =
|
|
7851
|
+
const screenBoxPos = applyToPoint50(
|
|
7689
7852
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7690
7853
|
box
|
|
7691
7854
|
);
|
|
@@ -7708,7 +7871,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7708
7871
|
});
|
|
7709
7872
|
}
|
|
7710
7873
|
for (const circle of symbolCircles) {
|
|
7711
|
-
const screenCirclePos =
|
|
7874
|
+
const screenCirclePos = applyToPoint50(
|
|
7712
7875
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7713
7876
|
circle
|
|
7714
7877
|
);
|
|
@@ -7753,14 +7916,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
7753
7916
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
7754
7917
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
7755
7918
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
7756
|
-
const screenCenter =
|
|
7919
|
+
const screenCenter = applyToPoint51(realToScreenTransform, schNetLabel.center);
|
|
7757
7920
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
7758
7921
|
schNetLabel.anchor_side
|
|
7759
7922
|
);
|
|
7760
7923
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
7761
7924
|
screenTextGrowthVec.y *= -1;
|
|
7762
7925
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
7763
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
7926
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint51(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
7764
7927
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
7765
7928
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
7766
7929
|
};
|
|
@@ -7801,7 +7964,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
7801
7964
|
y: -0.6
|
|
7802
7965
|
}
|
|
7803
7966
|
].map(
|
|
7804
|
-
(fontRelativePoint) =>
|
|
7967
|
+
(fontRelativePoint) => applyToPoint51(
|
|
7805
7968
|
compose11(
|
|
7806
7969
|
realToScreenTransform,
|
|
7807
7970
|
translate11(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -7878,17 +8041,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
7878
8041
|
};
|
|
7879
8042
|
|
|
7880
8043
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
7881
|
-
import { applyToPoint as
|
|
8044
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
7882
8045
|
var createSvgObjectsFromSchematicBox = ({
|
|
7883
8046
|
schematicBox,
|
|
7884
8047
|
transform,
|
|
7885
8048
|
colorMap: colorMap2
|
|
7886
8049
|
}) => {
|
|
7887
|
-
const topLeft =
|
|
8050
|
+
const topLeft = applyToPoint52(transform, {
|
|
7888
8051
|
x: schematicBox.x,
|
|
7889
8052
|
y: schematicBox.y
|
|
7890
8053
|
});
|
|
7891
|
-
const bottomRight =
|
|
8054
|
+
const bottomRight = applyToPoint52(transform, {
|
|
7892
8055
|
x: schematicBox.x + schematicBox.width,
|
|
7893
8056
|
y: schematicBox.y + schematicBox.height
|
|
7894
8057
|
});
|
|
@@ -7924,7 +8087,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
7924
8087
|
};
|
|
7925
8088
|
|
|
7926
8089
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
7927
|
-
import { applyToPoint as
|
|
8090
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
7928
8091
|
var createSvgObjectsFromSchematicTable = ({
|
|
7929
8092
|
schematicTable,
|
|
7930
8093
|
transform,
|
|
@@ -7957,11 +8120,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
7957
8120
|
const svgObjects = [];
|
|
7958
8121
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
7959
8122
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
7960
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
8123
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint53(transform, [
|
|
7961
8124
|
topLeftX,
|
|
7962
8125
|
topLeftY
|
|
7963
8126
|
]);
|
|
7964
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
8127
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint53(transform, [
|
|
7965
8128
|
topLeftX + totalWidth,
|
|
7966
8129
|
topLeftY - totalHeight
|
|
7967
8130
|
]);
|
|
@@ -7993,8 +8156,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
7993
8156
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
7994
8157
|
);
|
|
7995
8158
|
if (!isMerged) {
|
|
7996
|
-
const start =
|
|
7997
|
-
const end =
|
|
8159
|
+
const start = applyToPoint53(transform, { x: currentX, y: segmentStartY });
|
|
8160
|
+
const end = applyToPoint53(transform, { x: currentX, y: segmentEndY });
|
|
7998
8161
|
svgObjects.push({
|
|
7999
8162
|
name: "line",
|
|
8000
8163
|
type: "element",
|
|
@@ -8023,11 +8186,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8023
8186
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
8024
8187
|
);
|
|
8025
8188
|
if (!isMerged) {
|
|
8026
|
-
const start =
|
|
8189
|
+
const start = applyToPoint53(transform, {
|
|
8027
8190
|
x: segmentStartX,
|
|
8028
8191
|
y: currentY
|
|
8029
8192
|
});
|
|
8030
|
-
const end =
|
|
8193
|
+
const end = applyToPoint53(transform, { x: segmentEndX, y: currentY });
|
|
8031
8194
|
svgObjects.push({
|
|
8032
8195
|
name: "line",
|
|
8033
8196
|
type: "element",
|
|
@@ -8069,7 +8232,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8069
8232
|
} else if (vertical_align === "bottom") {
|
|
8070
8233
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
8071
8234
|
}
|
|
8072
|
-
const screenTextAnchorPos =
|
|
8235
|
+
const screenTextAnchorPos = applyToPoint53(transform, realTextAnchorPos);
|
|
8073
8236
|
const fontSize = getSchScreenFontSize(
|
|
8074
8237
|
transform,
|
|
8075
8238
|
"reference_designator",
|
|
@@ -8125,13 +8288,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8125
8288
|
|
|
8126
8289
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
8127
8290
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
8128
|
-
import { applyToPoint as
|
|
8291
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
8129
8292
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
8130
8293
|
var createSvgObjectsForSchPortHover = ({
|
|
8131
8294
|
schPort,
|
|
8132
8295
|
transform
|
|
8133
8296
|
}) => {
|
|
8134
|
-
const screenSchPortPos =
|
|
8297
|
+
const screenSchPortPos = applyToPoint54(transform, schPort.center);
|
|
8135
8298
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
8136
8299
|
return [
|
|
8137
8300
|
{
|
|
@@ -8176,14 +8339,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
8176
8339
|
};
|
|
8177
8340
|
|
|
8178
8341
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
8179
|
-
import { applyToPoint as
|
|
8342
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
8180
8343
|
function createSvgObjectsFromSchematicLine({
|
|
8181
8344
|
schLine,
|
|
8182
8345
|
transform,
|
|
8183
8346
|
colorMap: colorMap2
|
|
8184
8347
|
}) {
|
|
8185
|
-
const p1 =
|
|
8186
|
-
const p2 =
|
|
8348
|
+
const p1 = applyToPoint55(transform, { x: schLine.x1, y: schLine.y1 });
|
|
8349
|
+
const p2 = applyToPoint55(transform, { x: schLine.x2, y: schLine.y2 });
|
|
8187
8350
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
8188
8351
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
8189
8352
|
return [
|
|
@@ -8212,13 +8375,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
8212
8375
|
}
|
|
8213
8376
|
|
|
8214
8377
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
8215
|
-
import { applyToPoint as
|
|
8378
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
8216
8379
|
function createSvgObjectsFromSchematicCircle({
|
|
8217
8380
|
schCircle,
|
|
8218
8381
|
transform,
|
|
8219
8382
|
colorMap: colorMap2
|
|
8220
8383
|
}) {
|
|
8221
|
-
const center =
|
|
8384
|
+
const center = applyToPoint56(transform, schCircle.center);
|
|
8222
8385
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
8223
8386
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
8224
8387
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -8248,13 +8411,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
8248
8411
|
}
|
|
8249
8412
|
|
|
8250
8413
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
8251
|
-
import { applyToPoint as
|
|
8414
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
8252
8415
|
function createSvgObjectsFromSchematicRect({
|
|
8253
8416
|
schRect,
|
|
8254
8417
|
transform,
|
|
8255
8418
|
colorMap: colorMap2
|
|
8256
8419
|
}) {
|
|
8257
|
-
const center =
|
|
8420
|
+
const center = applyToPoint57(transform, schRect.center);
|
|
8258
8421
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
8259
8422
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
8260
8423
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -8290,13 +8453,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
8290
8453
|
}
|
|
8291
8454
|
|
|
8292
8455
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
8293
|
-
import { applyToPoint as
|
|
8456
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
8294
8457
|
function createSvgObjectsFromSchematicArc({
|
|
8295
8458
|
schArc,
|
|
8296
8459
|
transform,
|
|
8297
8460
|
colorMap: colorMap2
|
|
8298
8461
|
}) {
|
|
8299
|
-
const center =
|
|
8462
|
+
const center = applyToPoint58(transform, schArc.center);
|
|
8300
8463
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
8301
8464
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
8302
8465
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -9328,18 +9491,18 @@ function formatNumber2(value) {
|
|
|
9328
9491
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
9329
9492
|
import { stringify as stringify7 } from "svgson";
|
|
9330
9493
|
import {
|
|
9331
|
-
applyToPoint as
|
|
9494
|
+
applyToPoint as applyToPoint61,
|
|
9332
9495
|
compose as compose14,
|
|
9333
9496
|
scale as scale8,
|
|
9334
9497
|
translate as translate14
|
|
9335
9498
|
} from "transformation-matrix";
|
|
9336
9499
|
|
|
9337
9500
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
9338
|
-
import { applyToPoint as
|
|
9501
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
9339
9502
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
9340
9503
|
const { transform, layer: layerFilter } = ctx;
|
|
9341
9504
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
9342
|
-
const [x, y] =
|
|
9505
|
+
const [x, y] = applyToPoint60(transform, [solderPaste.x, solderPaste.y]);
|
|
9343
9506
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
9344
9507
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
9345
9508
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -9550,8 +9713,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
9550
9713
|
}
|
|
9551
9714
|
}
|
|
9552
9715
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
9553
|
-
const [x1, y1] =
|
|
9554
|
-
const [x2, y2] =
|
|
9716
|
+
const [x1, y1] = applyToPoint61(transform, [minX, minY]);
|
|
9717
|
+
const [x2, y2] = applyToPoint61(transform, [maxX, maxY]);
|
|
9555
9718
|
const width = Math.abs(x2 - x1);
|
|
9556
9719
|
const height = Math.abs(y2 - y1);
|
|
9557
9720
|
const x = Math.min(x1, x2);
|