circuit-to-svg 0.0.230 → 0.0.232
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 +600 -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 applyToPoint26,
|
|
5
5
|
compose as compose5,
|
|
6
6
|
scale as scale2,
|
|
7
7
|
translate as translate5
|
|
@@ -520,11 +520,408 @@ 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-note-text.ts
|
|
684
|
+
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
685
|
+
var DEFAULT_OVERLAY_COLOR = "rgba(255,255,255,0.5)";
|
|
686
|
+
function createSvgObjectsFromPcbNoteText(note, ctx) {
|
|
687
|
+
const { transform } = ctx;
|
|
688
|
+
const {
|
|
689
|
+
anchor_position,
|
|
690
|
+
text,
|
|
691
|
+
font_size = 1,
|
|
692
|
+
anchor_alignment = "center",
|
|
693
|
+
color
|
|
694
|
+
} = note;
|
|
695
|
+
if (!anchor_position || typeof anchor_position.x !== "number" || typeof anchor_position.y !== "number") {
|
|
696
|
+
console.error("Invalid pcb_note_text anchor_position", anchor_position);
|
|
697
|
+
return [];
|
|
698
|
+
}
|
|
699
|
+
if (typeof text !== "string" || text.length === 0) {
|
|
700
|
+
console.error("Invalid pcb_note_text text", text);
|
|
701
|
+
return [];
|
|
702
|
+
}
|
|
703
|
+
const [x, y] = applyToPoint6(transform, [anchor_position.x, anchor_position.y]);
|
|
704
|
+
const transformedFontSize = font_size * Math.abs(transform.a);
|
|
705
|
+
let textAnchor = "middle";
|
|
706
|
+
let dominantBaseline = "central";
|
|
707
|
+
switch (anchor_alignment) {
|
|
708
|
+
case "top_left":
|
|
709
|
+
textAnchor = "start";
|
|
710
|
+
dominantBaseline = "text-before-edge";
|
|
711
|
+
break;
|
|
712
|
+
case "top_right":
|
|
713
|
+
textAnchor = "end";
|
|
714
|
+
dominantBaseline = "text-before-edge";
|
|
715
|
+
break;
|
|
716
|
+
case "bottom_left":
|
|
717
|
+
textAnchor = "start";
|
|
718
|
+
dominantBaseline = "text-after-edge";
|
|
719
|
+
break;
|
|
720
|
+
case "bottom_right":
|
|
721
|
+
textAnchor = "end";
|
|
722
|
+
dominantBaseline = "text-after-edge";
|
|
723
|
+
break;
|
|
724
|
+
case "center":
|
|
725
|
+
default:
|
|
726
|
+
textAnchor = "middle";
|
|
727
|
+
dominantBaseline = "central";
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
const svgObject = {
|
|
731
|
+
name: "text",
|
|
732
|
+
type: "element",
|
|
733
|
+
value: "",
|
|
734
|
+
attributes: {
|
|
735
|
+
x: x.toString(),
|
|
736
|
+
y: y.toString(),
|
|
737
|
+
fill: color ?? DEFAULT_OVERLAY_COLOR,
|
|
738
|
+
"font-family": "Arial, sans-serif",
|
|
739
|
+
"font-size": transformedFontSize.toString(),
|
|
740
|
+
"text-anchor": textAnchor,
|
|
741
|
+
"dominant-baseline": dominantBaseline,
|
|
742
|
+
class: "pcb-note-text",
|
|
743
|
+
"data-type": "pcb_note_text",
|
|
744
|
+
"data-pcb-note-text-id": note.pcb_note_text_id,
|
|
745
|
+
"data-pcb-layer": "overlay"
|
|
746
|
+
},
|
|
747
|
+
children: [
|
|
748
|
+
{
|
|
749
|
+
type: "text",
|
|
750
|
+
name: "",
|
|
751
|
+
value: text,
|
|
752
|
+
attributes: {},
|
|
753
|
+
children: []
|
|
754
|
+
}
|
|
755
|
+
]
|
|
756
|
+
};
|
|
757
|
+
return [svgObject];
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-rect.ts
|
|
761
|
+
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
762
|
+
var DEFAULT_OVERLAY_COLOR2 = "rgba(255,255,255,0.5)";
|
|
763
|
+
var DEFAULT_FILL_COLOR = "rgba(255,255,255,0.2)";
|
|
764
|
+
function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
765
|
+
const { transform } = ctx;
|
|
766
|
+
const {
|
|
767
|
+
center,
|
|
768
|
+
width,
|
|
769
|
+
height,
|
|
770
|
+
stroke_width,
|
|
771
|
+
is_filled,
|
|
772
|
+
has_stroke,
|
|
773
|
+
is_stroke_dashed,
|
|
774
|
+
color
|
|
775
|
+
} = noteRect;
|
|
776
|
+
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
777
|
+
console.error("Invalid pcb_note_rect data", { center, width, height });
|
|
778
|
+
return [];
|
|
779
|
+
}
|
|
780
|
+
const halfWidth = width / 2;
|
|
781
|
+
const halfHeight = height / 2;
|
|
782
|
+
const [topLeftX, topLeftY] = applyToPoint7(transform, [
|
|
783
|
+
center.x - halfWidth,
|
|
784
|
+
center.y + halfHeight
|
|
785
|
+
]);
|
|
786
|
+
const [bottomRightX, bottomRightY] = applyToPoint7(transform, [
|
|
787
|
+
center.x + halfWidth,
|
|
788
|
+
center.y - halfHeight
|
|
789
|
+
]);
|
|
790
|
+
const rectX = Math.min(topLeftX, bottomRightX);
|
|
791
|
+
const rectY = Math.min(topLeftY, bottomRightY);
|
|
792
|
+
const rectWidth = Math.abs(bottomRightX - topLeftX);
|
|
793
|
+
const rectHeight = Math.abs(bottomRightY - topLeftY);
|
|
794
|
+
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
795
|
+
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
796
|
+
const overlayColor = color ?? DEFAULT_OVERLAY_COLOR2;
|
|
797
|
+
const attributes = {
|
|
798
|
+
x: rectX.toString(),
|
|
799
|
+
y: rectY.toString(),
|
|
800
|
+
width: rectWidth.toString(),
|
|
801
|
+
height: rectHeight.toString(),
|
|
802
|
+
class: "pcb-note-rect",
|
|
803
|
+
"data-type": "pcb_note_rect",
|
|
804
|
+
"data-pcb-note-rect-id": noteRect.pcb_note_rect_id,
|
|
805
|
+
"data-pcb-layer": "overlay"
|
|
806
|
+
};
|
|
807
|
+
if (is_filled) {
|
|
808
|
+
attributes.fill = color ?? DEFAULT_FILL_COLOR;
|
|
809
|
+
} else {
|
|
810
|
+
attributes.fill = "none";
|
|
811
|
+
}
|
|
812
|
+
const shouldDrawStroke = has_stroke ?? transformedStrokeWidth > 0;
|
|
813
|
+
if (shouldDrawStroke) {
|
|
814
|
+
attributes.stroke = overlayColor;
|
|
815
|
+
attributes["stroke-width"] = transformedStrokeWidth.toString();
|
|
816
|
+
if (is_stroke_dashed) {
|
|
817
|
+
const dash = 0.2 * Math.abs(transform.a);
|
|
818
|
+
const gap = 0.1 * Math.abs(transform.a);
|
|
819
|
+
attributes["stroke-dasharray"] = `${dash} ${gap}`;
|
|
820
|
+
}
|
|
821
|
+
} else {
|
|
822
|
+
attributes.stroke = "none";
|
|
823
|
+
}
|
|
824
|
+
const svgObject = {
|
|
825
|
+
name: "rect",
|
|
826
|
+
type: "element",
|
|
827
|
+
value: "",
|
|
828
|
+
attributes,
|
|
829
|
+
children: []
|
|
830
|
+
};
|
|
831
|
+
return [svgObject];
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-path.ts
|
|
835
|
+
import { applyToPoint as applyToPoint8 } from "transformation-matrix";
|
|
836
|
+
var DEFAULT_OVERLAY_COLOR3 = "rgba(255,255,255,0.5)";
|
|
837
|
+
function createSvgObjectsFromPcbNotePath(notePath, ctx) {
|
|
838
|
+
const { transform } = ctx;
|
|
839
|
+
if (!Array.isArray(notePath.route) || notePath.route.length === 0) {
|
|
840
|
+
console.error("Invalid pcb_note_path route", notePath.route);
|
|
841
|
+
return [];
|
|
842
|
+
}
|
|
843
|
+
for (const point of notePath.route) {
|
|
844
|
+
if (typeof point.x !== "number" || typeof point.y !== "number") {
|
|
845
|
+
console.error("Invalid point in pcb_note_path", point);
|
|
846
|
+
return [];
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
const pathD = notePath.route.map((point, index) => {
|
|
850
|
+
const [x, y] = applyToPoint8(transform, [point.x, point.y]);
|
|
851
|
+
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
852
|
+
}).join(" ");
|
|
853
|
+
const strokeWidth = notePath.stroke_width * Math.abs(transform.a);
|
|
854
|
+
const svgObject = {
|
|
855
|
+
name: "path",
|
|
856
|
+
type: "element",
|
|
857
|
+
value: "",
|
|
858
|
+
attributes: {
|
|
859
|
+
d: pathD,
|
|
860
|
+
stroke: notePath.color ?? DEFAULT_OVERLAY_COLOR3,
|
|
861
|
+
fill: "none",
|
|
862
|
+
"stroke-width": strokeWidth.toString(),
|
|
863
|
+
class: "pcb-note-path",
|
|
864
|
+
"data-type": "pcb_note_path",
|
|
865
|
+
"data-pcb-note-path-id": notePath.pcb_note_path_id,
|
|
866
|
+
"data-pcb-layer": "overlay"
|
|
867
|
+
},
|
|
868
|
+
children: []
|
|
869
|
+
};
|
|
870
|
+
return [svgObject];
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-line.ts
|
|
874
|
+
import { applyToPoint as applyToPoint9 } from "transformation-matrix";
|
|
875
|
+
var DEFAULT_OVERLAY_COLOR4 = "rgba(255,255,255,0.5)";
|
|
876
|
+
function createSvgObjectsFromPcbNoteLine(noteLine, ctx) {
|
|
877
|
+
const { transform } = ctx;
|
|
878
|
+
const { x1, y1, x2, y2, stroke_width, color, is_dashed } = noteLine;
|
|
879
|
+
if (typeof x1 !== "number" || typeof y1 !== "number" || typeof x2 !== "number" || typeof y2 !== "number") {
|
|
880
|
+
console.error("Invalid pcb_note_line coordinates", {
|
|
881
|
+
x1,
|
|
882
|
+
y1,
|
|
883
|
+
x2,
|
|
884
|
+
y2
|
|
885
|
+
});
|
|
886
|
+
return [];
|
|
887
|
+
}
|
|
888
|
+
const [startX, startY] = applyToPoint9(transform, [x1, y1]);
|
|
889
|
+
const [endX, endY] = applyToPoint9(transform, [x2, y2]);
|
|
890
|
+
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
891
|
+
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
892
|
+
const attributes = {
|
|
893
|
+
x1: startX.toString(),
|
|
894
|
+
y1: startY.toString(),
|
|
895
|
+
x2: endX.toString(),
|
|
896
|
+
y2: endY.toString(),
|
|
897
|
+
stroke: color ?? DEFAULT_OVERLAY_COLOR4,
|
|
898
|
+
"stroke-width": transformedStrokeWidth.toString(),
|
|
899
|
+
"stroke-linecap": "round",
|
|
900
|
+
class: "pcb-note-line",
|
|
901
|
+
"data-type": "pcb_note_line",
|
|
902
|
+
"data-pcb-note-line-id": noteLine.pcb_note_line_id,
|
|
903
|
+
"data-pcb-layer": "overlay"
|
|
904
|
+
};
|
|
905
|
+
if (is_dashed) {
|
|
906
|
+
const dash = 0.2 * Math.abs(transform.a);
|
|
907
|
+
const gap = 0.1 * Math.abs(transform.a);
|
|
908
|
+
attributes["stroke-dasharray"] = `${dash} ${gap}`;
|
|
909
|
+
}
|
|
910
|
+
const svgObject = {
|
|
911
|
+
name: "line",
|
|
912
|
+
type: "element",
|
|
913
|
+
value: "",
|
|
914
|
+
attributes,
|
|
915
|
+
children: []
|
|
916
|
+
};
|
|
917
|
+
return [svgObject];
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-plated-hole.ts
|
|
921
|
+
import { applyToPoint as applyToPoint10 } from "transformation-matrix";
|
|
525
922
|
function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
526
923
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
527
|
-
const [x, y] =
|
|
924
|
+
const [x, y] = applyToPoint10(transform, [hole.x, hole.y]);
|
|
528
925
|
const copperLayer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
|
|
529
926
|
if (hole.shape === "pill") {
|
|
530
927
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
@@ -641,7 +1038,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
641
1038
|
const scaledRectPadHeight = hole.rect_pad_height * Math.abs(transform.a);
|
|
642
1039
|
const scaledRectBorderRadius = (hole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
643
1040
|
const holeRadius = scaledHoleDiameter / 2;
|
|
644
|
-
const [holeCx, holeCy] =
|
|
1041
|
+
const [holeCx, holeCy] = applyToPoint10(transform, [
|
|
645
1042
|
h.x + (h.hole_offset_x ?? 0),
|
|
646
1043
|
h.y + (h.hole_offset_y ?? 0)
|
|
647
1044
|
]);
|
|
@@ -706,7 +1103,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
706
1103
|
const pillHoleWithOffsets = pillHole;
|
|
707
1104
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
708
1105
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
709
|
-
const [holeCenterX, holeCenterY] =
|
|
1106
|
+
const [holeCenterX, holeCenterY] = applyToPoint10(transform, [
|
|
710
1107
|
pillHole.x + holeOffsetX,
|
|
711
1108
|
pillHole.y + holeOffsetY
|
|
712
1109
|
]);
|
|
@@ -775,7 +1172,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
775
1172
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
776
1173
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
777
1174
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
778
|
-
const [holeCenterX, holeCenterY] =
|
|
1175
|
+
const [holeCenterX, holeCenterY] = applyToPoint10(transform, [
|
|
779
1176
|
rotatedHole.x + holeOffsetX,
|
|
780
1177
|
rotatedHole.y + holeOffsetY
|
|
781
1178
|
]);
|
|
@@ -838,12 +1235,12 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
838
1235
|
}
|
|
839
1236
|
|
|
840
1237
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-path.ts
|
|
841
|
-
import { applyToPoint as
|
|
1238
|
+
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
842
1239
|
function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
|
|
843
1240
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
844
1241
|
if (!silkscreenPath.route || !Array.isArray(silkscreenPath.route)) return [];
|
|
845
1242
|
let path = silkscreenPath.route.map((point, index) => {
|
|
846
|
-
const [x, y] =
|
|
1243
|
+
const [x, y] = applyToPoint11(transform, [point.x, point.y]);
|
|
847
1244
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
848
1245
|
}).join(" ");
|
|
849
1246
|
const firstPoint = silkscreenPath.route[0];
|
|
@@ -879,7 +1276,7 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
|
|
|
879
1276
|
|
|
880
1277
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-text.ts
|
|
881
1278
|
import {
|
|
882
|
-
applyToPoint as
|
|
1279
|
+
applyToPoint as applyToPoint12,
|
|
883
1280
|
compose as compose2,
|
|
884
1281
|
rotate as rotate2,
|
|
885
1282
|
translate as translate2,
|
|
@@ -901,7 +1298,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
901
1298
|
console.error("Invalid anchor_position:", anchor_position);
|
|
902
1299
|
return [];
|
|
903
1300
|
}
|
|
904
|
-
const [transformedX, transformedY] =
|
|
1301
|
+
const [transformedX, transformedY] = applyToPoint12(transform, [
|
|
905
1302
|
anchor_position.x,
|
|
906
1303
|
anchor_position.y
|
|
907
1304
|
]);
|
|
@@ -1009,7 +1406,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
1009
1406
|
}
|
|
1010
1407
|
|
|
1011
1408
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-rect.ts
|
|
1012
|
-
import { applyToPoint as
|
|
1409
|
+
import { applyToPoint as applyToPoint13 } from "transformation-matrix";
|
|
1013
1410
|
function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
1014
1411
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1015
1412
|
const {
|
|
@@ -1028,7 +1425,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
1028
1425
|
console.error("Invalid rectangle data:", { center, width, height });
|
|
1029
1426
|
return [];
|
|
1030
1427
|
}
|
|
1031
|
-
const [transformedX, transformedY] =
|
|
1428
|
+
const [transformedX, transformedY] = applyToPoint13(transform, [
|
|
1032
1429
|
center.x,
|
|
1033
1430
|
center.y
|
|
1034
1431
|
]);
|
|
@@ -1075,7 +1472,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
1075
1472
|
}
|
|
1076
1473
|
|
|
1077
1474
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-circle.ts
|
|
1078
|
-
import { applyToPoint as
|
|
1475
|
+
import { applyToPoint as applyToPoint14 } from "transformation-matrix";
|
|
1079
1476
|
function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
1080
1477
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1081
1478
|
const {
|
|
@@ -1090,7 +1487,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
|
1090
1487
|
console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
|
|
1091
1488
|
return [];
|
|
1092
1489
|
}
|
|
1093
|
-
const [transformedX, transformedY] =
|
|
1490
|
+
const [transformedX, transformedY] = applyToPoint14(transform, [
|
|
1094
1491
|
center.x,
|
|
1095
1492
|
center.y
|
|
1096
1493
|
]);
|
|
@@ -1118,7 +1515,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
|
1118
1515
|
}
|
|
1119
1516
|
|
|
1120
1517
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-line.ts
|
|
1121
|
-
import { applyToPoint as
|
|
1518
|
+
import { applyToPoint as applyToPoint15 } from "transformation-matrix";
|
|
1122
1519
|
function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
1123
1520
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1124
1521
|
const {
|
|
@@ -1135,8 +1532,8 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
|
1135
1532
|
console.error("Invalid coordinates:", { x1, y1, x2, y2 });
|
|
1136
1533
|
return [];
|
|
1137
1534
|
}
|
|
1138
|
-
const [transformedX1, transformedY1] =
|
|
1139
|
-
const [transformedX2, transformedY2] =
|
|
1535
|
+
const [transformedX1, transformedY1] = applyToPoint15(transform, [x1, y1]);
|
|
1536
|
+
const [transformedX2, transformedY2] = applyToPoint15(transform, [x2, y2]);
|
|
1140
1537
|
const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
|
|
1141
1538
|
const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
|
|
1142
1539
|
return [
|
|
@@ -1171,7 +1568,7 @@ function pairs(arr) {
|
|
|
1171
1568
|
}
|
|
1172
1569
|
|
|
1173
1570
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
|
|
1174
|
-
import { applyToPoint as
|
|
1571
|
+
import { applyToPoint as applyToPoint16 } from "transformation-matrix";
|
|
1175
1572
|
|
|
1176
1573
|
// lib/pcb/colors.ts
|
|
1177
1574
|
var DEFAULT_PCB_COLOR_MAP = {
|
|
@@ -1227,8 +1624,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
1227
1624
|
const segments = pairs(trace.route);
|
|
1228
1625
|
const svgObjects = [];
|
|
1229
1626
|
for (const [start, end] of segments) {
|
|
1230
|
-
const startPoint =
|
|
1231
|
-
const endPoint =
|
|
1627
|
+
const startPoint = applyToPoint16(transform, [start.x, start.y]);
|
|
1628
|
+
const endPoint = applyToPoint16(transform, [end.x, end.y]);
|
|
1232
1629
|
const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
|
|
1233
1630
|
if (!layer) continue;
|
|
1234
1631
|
if (layerFilter && layer !== layerFilter) continue;
|
|
@@ -1300,7 +1697,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
1300
1697
|
}
|
|
1301
1698
|
|
|
1302
1699
|
// lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
|
|
1303
|
-
import { applyToPoint as
|
|
1700
|
+
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
1304
1701
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
1305
1702
|
const { transform, layer: layerFilter, colorMap: colorMap2, renderSolderMask } = ctx;
|
|
1306
1703
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
@@ -1310,7 +1707,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1310
1707
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
1311
1708
|
const width = pad.width * Math.abs(transform.a);
|
|
1312
1709
|
const height = pad.height * Math.abs(transform.d);
|
|
1313
|
-
const [x, y] =
|
|
1710
|
+
const [x, y] = applyToPoint17(transform, [pad.x, pad.y]);
|
|
1314
1711
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
1315
1712
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
1316
1713
|
const padElement2 = {
|
|
@@ -1392,7 +1789,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1392
1789
|
const width = pad.width * Math.abs(transform.a);
|
|
1393
1790
|
const height = pad.height * Math.abs(transform.d);
|
|
1394
1791
|
const radius = pad.radius * Math.abs(transform.a);
|
|
1395
|
-
const [x, y] =
|
|
1792
|
+
const [x, y] = applyToPoint17(transform, [pad.x, pad.y]);
|
|
1396
1793
|
const padElement = {
|
|
1397
1794
|
name: "rect",
|
|
1398
1795
|
type: "element",
|
|
@@ -1430,7 +1827,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1430
1827
|
}
|
|
1431
1828
|
if (pad.shape === "circle") {
|
|
1432
1829
|
const radius = pad.radius * Math.abs(transform.a);
|
|
1433
|
-
const [x, y] =
|
|
1830
|
+
const [x, y] = applyToPoint17(transform, [pad.x, pad.y]);
|
|
1434
1831
|
const padElement = {
|
|
1435
1832
|
name: "circle",
|
|
1436
1833
|
type: "element",
|
|
@@ -1465,7 +1862,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1465
1862
|
}
|
|
1466
1863
|
if (pad.shape === "polygon") {
|
|
1467
1864
|
const points = (pad.points ?? []).map(
|
|
1468
|
-
(point) =>
|
|
1865
|
+
(point) => applyToPoint17(transform, [point.x, point.y])
|
|
1469
1866
|
);
|
|
1470
1867
|
const padElement = {
|
|
1471
1868
|
name: "polygon",
|
|
@@ -1501,32 +1898,32 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1501
1898
|
}
|
|
1502
1899
|
|
|
1503
1900
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
|
|
1504
|
-
import { applyToPoint as
|
|
1901
|
+
import { applyToPoint as applyToPoint18 } from "transformation-matrix";
|
|
1505
1902
|
function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
1506
1903
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1507
1904
|
const { width, height, center, outline } = pcbBoard;
|
|
1508
1905
|
let path;
|
|
1509
1906
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
1510
1907
|
path = outline.map((point, index) => {
|
|
1511
|
-
const [x, y] =
|
|
1908
|
+
const [x, y] = applyToPoint18(transform, [point.x, point.y]);
|
|
1512
1909
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
1513
1910
|
}).join(" ");
|
|
1514
1911
|
} else {
|
|
1515
1912
|
const halfWidth = width / 2;
|
|
1516
1913
|
const halfHeight = height / 2;
|
|
1517
|
-
const topLeft =
|
|
1914
|
+
const topLeft = applyToPoint18(transform, [
|
|
1518
1915
|
center.x - halfWidth,
|
|
1519
1916
|
center.y - halfHeight
|
|
1520
1917
|
]);
|
|
1521
|
-
const topRight =
|
|
1918
|
+
const topRight = applyToPoint18(transform, [
|
|
1522
1919
|
center.x + halfWidth,
|
|
1523
1920
|
center.y - halfHeight
|
|
1524
1921
|
]);
|
|
1525
|
-
const bottomRight =
|
|
1922
|
+
const bottomRight = applyToPoint18(transform, [
|
|
1526
1923
|
center.x + halfWidth,
|
|
1527
1924
|
center.y + halfHeight
|
|
1528
1925
|
]);
|
|
1529
|
-
const bottomLeft =
|
|
1926
|
+
const bottomLeft = applyToPoint18(transform, [
|
|
1530
1927
|
center.x - halfWidth,
|
|
1531
1928
|
center.y + halfHeight
|
|
1532
1929
|
]);
|
|
@@ -1553,10 +1950,10 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
1553
1950
|
}
|
|
1554
1951
|
|
|
1555
1952
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
1556
|
-
import { applyToPoint as
|
|
1953
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
1557
1954
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
1558
1955
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1559
|
-
const [x, y] =
|
|
1956
|
+
const [x, y] = applyToPoint19(transform, [hole.x, hole.y]);
|
|
1560
1957
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
1561
1958
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
1562
1959
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -1602,10 +1999,10 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
1602
1999
|
}
|
|
1603
2000
|
|
|
1604
2001
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
1605
|
-
import { applyToPoint as
|
|
2002
|
+
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
1606
2003
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
1607
2004
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1608
|
-
const [x, y] =
|
|
2005
|
+
const [x, y] = applyToPoint20(transform, [hole.x, hole.y]);
|
|
1609
2006
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
1610
2007
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
1611
2008
|
const radius = scaledDiameter / 2;
|
|
@@ -1679,7 +2076,7 @@ import {
|
|
|
1679
2076
|
getFullConnectivityMapFromCircuitJson
|
|
1680
2077
|
} from "circuit-json-to-connectivity-map";
|
|
1681
2078
|
import "svgson";
|
|
1682
|
-
import { applyToPoint as
|
|
2079
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
1683
2080
|
|
|
1684
2081
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
1685
2082
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -1759,11 +2156,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
1759
2156
|
});
|
|
1760
2157
|
const svgObjects = [];
|
|
1761
2158
|
for (const line of ratsNestLines) {
|
|
1762
|
-
const transformedStart =
|
|
2159
|
+
const transformedStart = applyToPoint21(transform, [
|
|
1763
2160
|
line.startPoint.x,
|
|
1764
2161
|
line.startPoint.y
|
|
1765
2162
|
]);
|
|
1766
|
-
const transformedEnd =
|
|
2163
|
+
const transformedEnd = applyToPoint21(transform, [
|
|
1767
2164
|
line.endPoint.x,
|
|
1768
2165
|
line.endPoint.y
|
|
1769
2166
|
]);
|
|
@@ -1791,7 +2188,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
1791
2188
|
|
|
1792
2189
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
1793
2190
|
import {
|
|
1794
|
-
applyToPoint as
|
|
2191
|
+
applyToPoint as applyToPoint22,
|
|
1795
2192
|
compose as compose3,
|
|
1796
2193
|
rotate as rotate3,
|
|
1797
2194
|
translate as translate3,
|
|
@@ -1801,7 +2198,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1801
2198
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1802
2199
|
if (cutout.shape === "rect") {
|
|
1803
2200
|
const rectCutout = cutout;
|
|
1804
|
-
const [cx, cy] =
|
|
2201
|
+
const [cx, cy] = applyToPoint22(transform, [
|
|
1805
2202
|
rectCutout.center.x,
|
|
1806
2203
|
rectCutout.center.y
|
|
1807
2204
|
]);
|
|
@@ -1832,7 +2229,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1832
2229
|
}
|
|
1833
2230
|
if (cutout.shape === "circle") {
|
|
1834
2231
|
const circleCutout = cutout;
|
|
1835
|
-
const [cx, cy] =
|
|
2232
|
+
const [cx, cy] = applyToPoint22(transform, [
|
|
1836
2233
|
circleCutout.center.x,
|
|
1837
2234
|
circleCutout.center.y
|
|
1838
2235
|
]);
|
|
@@ -1859,7 +2256,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1859
2256
|
const polygonCutout = cutout;
|
|
1860
2257
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
1861
2258
|
const transformedPoints = polygonCutout.points.map(
|
|
1862
|
-
(p) =>
|
|
2259
|
+
(p) => applyToPoint22(transform, [p.x, p.y])
|
|
1863
2260
|
);
|
|
1864
2261
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
1865
2262
|
return [
|
|
@@ -1883,7 +2280,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1883
2280
|
|
|
1884
2281
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
1885
2282
|
import {
|
|
1886
|
-
applyToPoint as
|
|
2283
|
+
applyToPoint as applyToPoint24,
|
|
1887
2284
|
compose as compose4,
|
|
1888
2285
|
rotate as rotate4,
|
|
1889
2286
|
toString as matrixToString7,
|
|
@@ -1891,11 +2288,11 @@ import {
|
|
|
1891
2288
|
} from "transformation-matrix";
|
|
1892
2289
|
|
|
1893
2290
|
// lib/utils/ring-to-path-d.ts
|
|
1894
|
-
import { applyToPoint as
|
|
2291
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
1895
2292
|
function ringToPathD(vertices, transform) {
|
|
1896
2293
|
if (vertices.length === 0) return "";
|
|
1897
2294
|
const transformedVertices = vertices.map((v) => {
|
|
1898
|
-
const [x, y] =
|
|
2295
|
+
const [x, y] = applyToPoint23(transform, [v.x, v.y]);
|
|
1899
2296
|
return { ...v, x, y };
|
|
1900
2297
|
});
|
|
1901
2298
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -1928,7 +2325,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
1928
2325
|
const color = layerNameToColor(layer, colorMap2);
|
|
1929
2326
|
const opacity = "0.5";
|
|
1930
2327
|
if (pour.shape === "rect") {
|
|
1931
|
-
const [cx, cy] =
|
|
2328
|
+
const [cx, cy] = applyToPoint24(transform, [pour.center.x, pour.center.y]);
|
|
1932
2329
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
1933
2330
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
1934
2331
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -1958,7 +2355,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
1958
2355
|
if (pour.shape === "polygon") {
|
|
1959
2356
|
if (!pour.points || pour.points.length === 0) return [];
|
|
1960
2357
|
const transformedPoints = pour.points.map(
|
|
1961
|
-
(p) =>
|
|
2358
|
+
(p) => applyToPoint24(transform, [p.x, p.y])
|
|
1962
2359
|
);
|
|
1963
2360
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
1964
2361
|
return [
|
|
@@ -2143,11 +2540,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
2143
2540
|
}
|
|
2144
2541
|
|
|
2145
2542
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
2146
|
-
import { applyToPoint as
|
|
2543
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
2147
2544
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
2148
2545
|
const { transform } = ctx;
|
|
2149
2546
|
const { center, width, height, rotation = 0 } = component;
|
|
2150
|
-
const [x, y] =
|
|
2547
|
+
const [x, y] = applyToPoint25(transform, [center.x, center.y]);
|
|
2151
2548
|
const scaledWidth = width * Math.abs(transform.a);
|
|
2152
2549
|
const scaledHeight = height * Math.abs(transform.d);
|
|
2153
2550
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -2197,7 +2594,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
2197
2594
|
var package_default = {
|
|
2198
2595
|
name: "circuit-to-svg",
|
|
2199
2596
|
type: "module",
|
|
2200
|
-
version: "0.0.
|
|
2597
|
+
version: "0.0.231",
|
|
2201
2598
|
description: "Convert Circuit JSON to SVG",
|
|
2202
2599
|
main: "dist/index.js",
|
|
2203
2600
|
files: [
|
|
@@ -2221,7 +2618,7 @@ var package_default = {
|
|
|
2221
2618
|
"bun-match-svg": "^0.0.12",
|
|
2222
2619
|
esbuild: "^0.20.2",
|
|
2223
2620
|
"performance-now": "^2.1.0",
|
|
2224
|
-
"circuit-json": "^0.0.
|
|
2621
|
+
"circuit-json": "^0.0.277",
|
|
2225
2622
|
react: "19.1.0",
|
|
2226
2623
|
"react-cosmos": "7.0.0",
|
|
2227
2624
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -2266,6 +2663,11 @@ var TYPE_PRIORITY = {
|
|
|
2266
2663
|
pcb_component: 60,
|
|
2267
2664
|
pcb_fabrication_note_text: 70,
|
|
2268
2665
|
pcb_fabrication_note_path: 70,
|
|
2666
|
+
pcb_note_dimension: 70,
|
|
2667
|
+
pcb_note_text: 70,
|
|
2668
|
+
pcb_note_rect: 70,
|
|
2669
|
+
pcb_note_path: 70,
|
|
2670
|
+
pcb_note_line: 70,
|
|
2269
2671
|
pcb_trace_error: 80,
|
|
2270
2672
|
pcb_rats_nest: 85
|
|
2271
2673
|
};
|
|
@@ -2640,6 +3042,16 @@ function createSvgObjects({
|
|
|
2640
3042
|
return createSvgObjectsFromPcbFabricationNotePath(elm, ctx);
|
|
2641
3043
|
case "pcb_fabrication_note_text":
|
|
2642
3044
|
return createSvgObjectsFromPcbFabricationNoteText(elm, ctx);
|
|
3045
|
+
case "pcb_note_dimension":
|
|
3046
|
+
return createSvgObjectsFromPcbNoteDimension(elm, ctx);
|
|
3047
|
+
case "pcb_note_text":
|
|
3048
|
+
return createSvgObjectsFromPcbNoteText(elm, ctx);
|
|
3049
|
+
case "pcb_note_rect":
|
|
3050
|
+
return createSvgObjectsFromPcbNoteRect(elm, ctx);
|
|
3051
|
+
case "pcb_note_path":
|
|
3052
|
+
return createSvgObjectsFromPcbNotePath(elm, ctx);
|
|
3053
|
+
case "pcb_note_line":
|
|
3054
|
+
return createSvgObjectsFromPcbNoteLine(elm, ctx);
|
|
2643
3055
|
case "pcb_silkscreen_path":
|
|
2644
3056
|
return createSvgObjectsFromPcbSilkscreenPath(elm, ctx);
|
|
2645
3057
|
case "pcb_board":
|
|
@@ -2653,8 +3065,8 @@ function createSvgObjects({
|
|
|
2653
3065
|
}
|
|
2654
3066
|
}
|
|
2655
3067
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
2656
|
-
const [x1, y1] =
|
|
2657
|
-
const [x2, y2] =
|
|
3068
|
+
const [x1, y1] = applyToPoint26(transform, [minX, minY]);
|
|
3069
|
+
const [x2, y2] = applyToPoint26(transform, [maxX, maxY]);
|
|
2658
3070
|
const width = Math.abs(x2 - x1);
|
|
2659
3071
|
const height = Math.abs(y2 - y1);
|
|
2660
3072
|
const x = Math.min(x1, x2);
|
|
@@ -2684,14 +3096,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
2684
3096
|
import { stringify as stringify2 } from "svgson";
|
|
2685
3097
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
2686
3098
|
import {
|
|
2687
|
-
applyToPoint as
|
|
3099
|
+
applyToPoint as applyToPoint33,
|
|
2688
3100
|
compose as compose6,
|
|
2689
3101
|
scale as scale3,
|
|
2690
3102
|
translate as translate6
|
|
2691
3103
|
} from "transformation-matrix";
|
|
2692
3104
|
|
|
2693
3105
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
2694
|
-
import { applyToPoint as
|
|
3106
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
2695
3107
|
var DEFAULT_BOARD_STYLE = {
|
|
2696
3108
|
fill: "none",
|
|
2697
3109
|
stroke: "rgb(0,0,0)",
|
|
@@ -2703,25 +3115,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
2703
3115
|
let path;
|
|
2704
3116
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
2705
3117
|
path = outline.map((point, index) => {
|
|
2706
|
-
const [x, y] =
|
|
3118
|
+
const [x, y] = applyToPoint27(transform, [point.x, point.y]);
|
|
2707
3119
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
2708
3120
|
}).join(" ");
|
|
2709
3121
|
} else {
|
|
2710
3122
|
const halfWidth = width / 2;
|
|
2711
3123
|
const halfHeight = height / 2;
|
|
2712
|
-
const topLeft =
|
|
3124
|
+
const topLeft = applyToPoint27(transform, [
|
|
2713
3125
|
center.x - halfWidth,
|
|
2714
3126
|
center.y - halfHeight
|
|
2715
3127
|
]);
|
|
2716
|
-
const topRight =
|
|
3128
|
+
const topRight = applyToPoint27(transform, [
|
|
2717
3129
|
center.x + halfWidth,
|
|
2718
3130
|
center.y - halfHeight
|
|
2719
3131
|
]);
|
|
2720
|
-
const bottomRight =
|
|
3132
|
+
const bottomRight = applyToPoint27(transform, [
|
|
2721
3133
|
center.x + halfWidth,
|
|
2722
3134
|
center.y + halfHeight
|
|
2723
3135
|
]);
|
|
2724
|
-
const bottomLeft =
|
|
3136
|
+
const bottomLeft = applyToPoint27(transform, [
|
|
2725
3137
|
center.x - halfWidth,
|
|
2726
3138
|
center.y + halfHeight
|
|
2727
3139
|
]);
|
|
@@ -2747,7 +3159,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
2747
3159
|
}
|
|
2748
3160
|
|
|
2749
3161
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
2750
|
-
import { applyToPoint as
|
|
3162
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
2751
3163
|
|
|
2752
3164
|
// lib/utils/get-sch-font-size.ts
|
|
2753
3165
|
import "transformation-matrix";
|
|
@@ -2773,8 +3185,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
2773
3185
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
2774
3186
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
2775
3187
|
return null;
|
|
2776
|
-
const [x, y] =
|
|
2777
|
-
const [pinX, pinY] =
|
|
3188
|
+
const [x, y] = applyToPoint29(transform, [center.x, center.y]);
|
|
3189
|
+
const [pinX, pinY] = applyToPoint29(transform, [portPosition.x, portPosition.y]);
|
|
2778
3190
|
const scaledWidth = width * Math.abs(transform.a);
|
|
2779
3191
|
const scaledHeight = height * Math.abs(transform.d);
|
|
2780
3192
|
const isTopLayer = layer === "top";
|
|
@@ -2936,11 +3348,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
2936
3348
|
}
|
|
2937
3349
|
|
|
2938
3350
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
2939
|
-
import { applyToPoint as
|
|
3351
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
2940
3352
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
2941
3353
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
2942
3354
|
const { transform } = ctx;
|
|
2943
|
-
const [x, y] =
|
|
3355
|
+
const [x, y] = applyToPoint30(transform, [hole.x, hole.y]);
|
|
2944
3356
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
2945
3357
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
2946
3358
|
const radius = scaledDiameter / 2;
|
|
@@ -3004,12 +3416,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
3004
3416
|
}
|
|
3005
3417
|
|
|
3006
3418
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
3007
|
-
import { applyToPoint as
|
|
3419
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
3008
3420
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
3009
3421
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
3010
3422
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
3011
3423
|
const { transform } = ctx;
|
|
3012
|
-
const [x, y] =
|
|
3424
|
+
const [x, y] = applyToPoint31(transform, [hole.x, hole.y]);
|
|
3013
3425
|
if (hole.shape === "pill") {
|
|
3014
3426
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
3015
3427
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -3104,7 +3516,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3104
3516
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
3105
3517
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
3106
3518
|
const holeRadius = scaledHoleDiameter / 2;
|
|
3107
|
-
const [holeCx, holeCy] =
|
|
3519
|
+
const [holeCx, holeCy] = applyToPoint31(transform, [
|
|
3108
3520
|
circularHole.x + circularHole.hole_offset_x,
|
|
3109
3521
|
circularHole.y + circularHole.hole_offset_y
|
|
3110
3522
|
]);
|
|
@@ -3162,7 +3574,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3162
3574
|
const pillHoleWithOffsets = pillHole;
|
|
3163
3575
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
3164
3576
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
3165
|
-
const [holeCenterX, holeCenterY] =
|
|
3577
|
+
const [holeCenterX, holeCenterY] = applyToPoint31(transform, [
|
|
3166
3578
|
pillHole.x + holeOffsetX,
|
|
3167
3579
|
pillHole.y + holeOffsetY
|
|
3168
3580
|
]);
|
|
@@ -3224,7 +3636,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3224
3636
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
3225
3637
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
3226
3638
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
3227
|
-
const [holeCenterX, holeCenterY] =
|
|
3639
|
+
const [holeCenterX, holeCenterY] = applyToPoint31(transform, [
|
|
3228
3640
|
rotatedHole.x + holeOffsetX,
|
|
3229
3641
|
rotatedHole.y + holeOffsetY
|
|
3230
3642
|
]);
|
|
@@ -3280,14 +3692,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3280
3692
|
}
|
|
3281
3693
|
|
|
3282
3694
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
3283
|
-
import { applyToPoint as
|
|
3695
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
3284
3696
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
3285
3697
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
3286
3698
|
const { transform } = ctx;
|
|
3287
3699
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
3288
3700
|
const width = pad.width * Math.abs(transform.a);
|
|
3289
3701
|
const height = pad.height * Math.abs(transform.d);
|
|
3290
|
-
const [x, y] =
|
|
3702
|
+
const [x, y] = applyToPoint32(transform, [pad.x, pad.y]);
|
|
3291
3703
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
3292
3704
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
3293
3705
|
return [
|
|
@@ -3339,7 +3751,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3339
3751
|
const width = pad.width * Math.abs(transform.a);
|
|
3340
3752
|
const height = pad.height * Math.abs(transform.d);
|
|
3341
3753
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3342
|
-
const [x, y] =
|
|
3754
|
+
const [x, y] = applyToPoint32(transform, [pad.x, pad.y]);
|
|
3343
3755
|
return [
|
|
3344
3756
|
{
|
|
3345
3757
|
name: "rect",
|
|
@@ -3362,7 +3774,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3362
3774
|
}
|
|
3363
3775
|
if (pad.shape === "circle") {
|
|
3364
3776
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3365
|
-
const [x, y] =
|
|
3777
|
+
const [x, y] = applyToPoint32(transform, [pad.x, pad.y]);
|
|
3366
3778
|
return [
|
|
3367
3779
|
{
|
|
3368
3780
|
name: "circle",
|
|
@@ -3382,7 +3794,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3382
3794
|
}
|
|
3383
3795
|
if (pad.shape === "polygon") {
|
|
3384
3796
|
const points = (pad.points ?? []).map(
|
|
3385
|
-
(point) =>
|
|
3797
|
+
(point) => applyToPoint32(transform, [point.x, point.y])
|
|
3386
3798
|
);
|
|
3387
3799
|
return [
|
|
3388
3800
|
{
|
|
@@ -3559,8 +3971,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
3559
3971
|
}
|
|
3560
3972
|
}
|
|
3561
3973
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
3562
|
-
const [x1, y1] =
|
|
3563
|
-
const [x2, y2] =
|
|
3974
|
+
const [x1, y1] = applyToPoint33(transform, [minX, minY]);
|
|
3975
|
+
const [x2, y2] = applyToPoint33(transform, [maxX, maxY]);
|
|
3564
3976
|
const width = Math.abs(x2 - x1);
|
|
3565
3977
|
const height = Math.abs(y2 - y1);
|
|
3566
3978
|
const x = Math.min(x1, x2);
|
|
@@ -3589,7 +4001,7 @@ import {
|
|
|
3589
4001
|
} from "transformation-matrix";
|
|
3590
4002
|
|
|
3591
4003
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
3592
|
-
import { applyToPoint as
|
|
4004
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
3593
4005
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
3594
4006
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
3595
4007
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -3599,25 +4011,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3599
4011
|
let path;
|
|
3600
4012
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
3601
4013
|
path = outline.map((point, index) => {
|
|
3602
|
-
const [x, y] =
|
|
4014
|
+
const [x, y] = applyToPoint34(transform, [point.x, point.y]);
|
|
3603
4015
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3604
4016
|
}).join(" ");
|
|
3605
4017
|
} else {
|
|
3606
4018
|
const halfWidth = width / 2;
|
|
3607
4019
|
const halfHeight = height / 2;
|
|
3608
|
-
const topLeft =
|
|
4020
|
+
const topLeft = applyToPoint34(transform, [
|
|
3609
4021
|
center.x - halfWidth,
|
|
3610
4022
|
center.y - halfHeight
|
|
3611
4023
|
]);
|
|
3612
|
-
const topRight =
|
|
4024
|
+
const topRight = applyToPoint34(transform, [
|
|
3613
4025
|
center.x + halfWidth,
|
|
3614
4026
|
center.y - halfHeight
|
|
3615
4027
|
]);
|
|
3616
|
-
const bottomRight =
|
|
4028
|
+
const bottomRight = applyToPoint34(transform, [
|
|
3617
4029
|
center.x + halfWidth,
|
|
3618
4030
|
center.y + halfHeight
|
|
3619
4031
|
]);
|
|
3620
|
-
const bottomLeft =
|
|
4032
|
+
const bottomLeft = applyToPoint34(transform, [
|
|
3621
4033
|
center.x - halfWidth,
|
|
3622
4034
|
center.y + halfHeight
|
|
3623
4035
|
]);
|
|
@@ -3635,10 +4047,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3635
4047
|
const halfWidth = width2 / 2;
|
|
3636
4048
|
const halfHeight = height2 / 2;
|
|
3637
4049
|
const [tl, tr, br, bl] = [
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
4050
|
+
applyToPoint34(transform, [x - halfWidth, y - halfHeight]),
|
|
4051
|
+
applyToPoint34(transform, [x + halfWidth, y - halfHeight]),
|
|
4052
|
+
applyToPoint34(transform, [x + halfWidth, y + halfHeight]),
|
|
4053
|
+
applyToPoint34(transform, [x - halfWidth, y + halfHeight])
|
|
3642
4054
|
];
|
|
3643
4055
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
3644
4056
|
} else if (cutout.shape === "circle") {
|
|
@@ -3665,7 +4077,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3665
4077
|
|
|
3666
4078
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
3667
4079
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
3668
|
-
import { applyToPoint as
|
|
4080
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
3669
4081
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
3670
4082
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
3671
4083
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -3675,7 +4087,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
3675
4087
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
3676
4088
|
return [];
|
|
3677
4089
|
}
|
|
3678
|
-
const [x, y] =
|
|
4090
|
+
const [x, y] = applyToPoint35(transform, [center.x, center.y]);
|
|
3679
4091
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3680
4092
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3681
4093
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -3736,11 +4148,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
3736
4148
|
}
|
|
3737
4149
|
|
|
3738
4150
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
3739
|
-
import { applyToPoint as
|
|
4151
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
3740
4152
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
3741
4153
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
3742
4154
|
const { transform } = ctx;
|
|
3743
|
-
const [x, y] =
|
|
4155
|
+
const [x, y] = applyToPoint36(transform, [hole.x, hole.y]);
|
|
3744
4156
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
3745
4157
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
3746
4158
|
const radius = scaledDiameter / 2;
|
|
@@ -3804,12 +4216,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
3804
4216
|
}
|
|
3805
4217
|
|
|
3806
4218
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
3807
|
-
import { applyToPoint as
|
|
4219
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
3808
4220
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
3809
4221
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
3810
4222
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
3811
4223
|
const { transform } = ctx;
|
|
3812
|
-
const [x, y] =
|
|
4224
|
+
const [x, y] = applyToPoint37(transform, [hole.x, hole.y]);
|
|
3813
4225
|
if (hole.shape === "pill") {
|
|
3814
4226
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
3815
4227
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -4044,14 +4456,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
4044
4456
|
}
|
|
4045
4457
|
|
|
4046
4458
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
4047
|
-
import { applyToPoint as
|
|
4459
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
4048
4460
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
4049
4461
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
4050
4462
|
const { transform } = ctx;
|
|
4051
4463
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
4052
4464
|
const width = pad.width * Math.abs(transform.a);
|
|
4053
4465
|
const height = pad.height * Math.abs(transform.d);
|
|
4054
|
-
const [x, y] =
|
|
4466
|
+
const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
|
|
4055
4467
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
4056
4468
|
return [
|
|
4057
4469
|
{
|
|
@@ -4094,7 +4506,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4094
4506
|
const width = pad.width * Math.abs(transform.a);
|
|
4095
4507
|
const height = pad.height * Math.abs(transform.d);
|
|
4096
4508
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4097
|
-
const [x, y] =
|
|
4509
|
+
const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
|
|
4098
4510
|
return [
|
|
4099
4511
|
{
|
|
4100
4512
|
name: "rect",
|
|
@@ -4117,7 +4529,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4117
4529
|
}
|
|
4118
4530
|
if (pad.shape === "circle") {
|
|
4119
4531
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4120
|
-
const [x, y] =
|
|
4532
|
+
const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
|
|
4121
4533
|
return [
|
|
4122
4534
|
{
|
|
4123
4535
|
name: "circle",
|
|
@@ -4137,7 +4549,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4137
4549
|
}
|
|
4138
4550
|
if (pad.shape === "polygon") {
|
|
4139
4551
|
const points = (pad.points ?? []).map(
|
|
4140
|
-
(point) =>
|
|
4552
|
+
(point) => applyToPoint38(transform, [point.x, point.y])
|
|
4141
4553
|
);
|
|
4142
4554
|
return [
|
|
4143
4555
|
{
|
|
@@ -4158,7 +4570,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4158
4570
|
}
|
|
4159
4571
|
|
|
4160
4572
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
4161
|
-
import { applyToPoint as
|
|
4573
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
4162
4574
|
import { calculateElbow } from "calculate-elbow";
|
|
4163
4575
|
|
|
4164
4576
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -4235,7 +4647,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
4235
4647
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
4236
4648
|
if (!label_info) return [];
|
|
4237
4649
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
4238
|
-
const [port_x, port_y] =
|
|
4650
|
+
const [port_x, port_y] = applyToPoint39(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
4239
4651
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
4240
4652
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
4241
4653
|
const elbow_path = calculateElbow(
|
|
@@ -4376,7 +4788,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
4376
4788
|
}
|
|
4377
4789
|
|
|
4378
4790
|
// lib/pinout/calculate-label-positions.ts
|
|
4379
|
-
import { applyToPoint as
|
|
4791
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
4380
4792
|
|
|
4381
4793
|
// lib/pinout/constants.ts
|
|
4382
4794
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -4414,7 +4826,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4414
4826
|
);
|
|
4415
4827
|
const mapToEdgePort = (pinout_label) => ({
|
|
4416
4828
|
pcb_port: pinout_label.pcb_port,
|
|
4417
|
-
y:
|
|
4829
|
+
y: applyToPoint40(transform, [
|
|
4418
4830
|
pinout_label.pcb_port.x,
|
|
4419
4831
|
pinout_label.pcb_port.y
|
|
4420
4832
|
])[1],
|
|
@@ -4429,7 +4841,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4429
4841
|
} else {
|
|
4430
4842
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
4431
4843
|
pcb_port: pinout_label.pcb_port,
|
|
4432
|
-
y:
|
|
4844
|
+
y: applyToPoint40(transform, [
|
|
4433
4845
|
pinout_label.pcb_port.x,
|
|
4434
4846
|
pinout_label.pcb_port.y
|
|
4435
4847
|
])[1],
|
|
@@ -4437,7 +4849,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4437
4849
|
})).sort((a, b) => a.y - b.y);
|
|
4438
4850
|
}
|
|
4439
4851
|
if (edge_ports.length === 0) return;
|
|
4440
|
-
const board_edge_x =
|
|
4852
|
+
const board_edge_x = applyToPoint40(transform, [
|
|
4441
4853
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
4442
4854
|
0
|
|
4443
4855
|
])[0];
|
|
@@ -5086,14 +5498,14 @@ import {
|
|
|
5086
5498
|
} from "transformation-matrix";
|
|
5087
5499
|
|
|
5088
5500
|
// lib/sch/draw-schematic-grid.ts
|
|
5089
|
-
import { applyToPoint as
|
|
5501
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
5090
5502
|
function drawSchematicGrid(params) {
|
|
5091
5503
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
5092
5504
|
const cellSize = params.cellSize ?? 1;
|
|
5093
5505
|
const labelCells = params.labelCells ?? false;
|
|
5094
5506
|
const gridLines = [];
|
|
5095
5507
|
const transformPoint = (x, y) => {
|
|
5096
|
-
const [transformedX, transformedY] =
|
|
5508
|
+
const [transformedX, transformedY] = applyToPoint41(params.transform, [x, y]);
|
|
5097
5509
|
return { x: transformedX, y: transformedY };
|
|
5098
5510
|
};
|
|
5099
5511
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -5174,15 +5586,15 @@ function drawSchematicGrid(params) {
|
|
|
5174
5586
|
}
|
|
5175
5587
|
|
|
5176
5588
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
5177
|
-
import { applyToPoint as
|
|
5589
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
5178
5590
|
function drawSchematicLabeledPoints(params) {
|
|
5179
5591
|
const { points, transform } = params;
|
|
5180
5592
|
const labeledPointsGroup = [];
|
|
5181
5593
|
for (const point of points) {
|
|
5182
|
-
const [x1, y1] =
|
|
5183
|
-
const [x2, y2] =
|
|
5184
|
-
const [x3, y3] =
|
|
5185
|
-
const [x4, y4] =
|
|
5594
|
+
const [x1, y1] = applyToPoint42(transform, [point.x - 0.1, point.y - 0.1]);
|
|
5595
|
+
const [x2, y2] = applyToPoint42(transform, [point.x + 0.1, point.y + 0.1]);
|
|
5596
|
+
const [x3, y3] = applyToPoint42(transform, [point.x - 0.1, point.y + 0.1]);
|
|
5597
|
+
const [x4, y4] = applyToPoint42(transform, [point.x + 0.1, point.y - 0.1]);
|
|
5186
5598
|
labeledPointsGroup.push({
|
|
5187
5599
|
name: "path",
|
|
5188
5600
|
type: "element",
|
|
@@ -5193,7 +5605,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
5193
5605
|
"stroke-opacity": "0.7"
|
|
5194
5606
|
}
|
|
5195
5607
|
});
|
|
5196
|
-
const [labelX, labelY] =
|
|
5608
|
+
const [labelX, labelY] = applyToPoint42(transform, [
|
|
5197
5609
|
point.x + 0.15,
|
|
5198
5610
|
point.y - 0.15
|
|
5199
5611
|
]);
|
|
@@ -6287,7 +6699,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
6287
6699
|
import { symbols } from "schematic-symbols";
|
|
6288
6700
|
import "svgson";
|
|
6289
6701
|
import {
|
|
6290
|
-
applyToPoint as
|
|
6702
|
+
applyToPoint as applyToPoint44,
|
|
6291
6703
|
compose as compose9
|
|
6292
6704
|
} from "transformation-matrix";
|
|
6293
6705
|
|
|
@@ -6371,13 +6783,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
6371
6783
|
}
|
|
6372
6784
|
|
|
6373
6785
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
6374
|
-
import { applyToPoint as
|
|
6786
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
6375
6787
|
var createSvgSchErrorText = ({
|
|
6376
6788
|
text,
|
|
6377
6789
|
realCenter,
|
|
6378
6790
|
realToScreenTransform
|
|
6379
6791
|
}) => {
|
|
6380
|
-
const screenCenter =
|
|
6792
|
+
const screenCenter = applyToPoint43(realToScreenTransform, realCenter);
|
|
6381
6793
|
return {
|
|
6382
6794
|
type: "element",
|
|
6383
6795
|
name: "text",
|
|
@@ -6486,11 +6898,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6486
6898
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
6487
6899
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
6488
6900
|
};
|
|
6489
|
-
const [screenMinX, screenMinY] =
|
|
6901
|
+
const [screenMinX, screenMinY] = applyToPoint44(
|
|
6490
6902
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6491
6903
|
[bounds.minX, bounds.minY]
|
|
6492
6904
|
);
|
|
6493
|
-
const [screenMaxX, screenMaxY] =
|
|
6905
|
+
const [screenMaxX, screenMaxY] = applyToPoint44(
|
|
6494
6906
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6495
6907
|
[bounds.maxX, bounds.maxY]
|
|
6496
6908
|
);
|
|
@@ -6519,7 +6931,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6519
6931
|
name: "path",
|
|
6520
6932
|
attributes: {
|
|
6521
6933
|
d: points.map((p, i) => {
|
|
6522
|
-
const [x, y] =
|
|
6934
|
+
const [x, y] = applyToPoint44(
|
|
6523
6935
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6524
6936
|
[p.x, p.y]
|
|
6525
6937
|
);
|
|
@@ -6535,7 +6947,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6535
6947
|
});
|
|
6536
6948
|
}
|
|
6537
6949
|
for (const text of texts) {
|
|
6538
|
-
const screenTextPos =
|
|
6950
|
+
const screenTextPos = applyToPoint44(
|
|
6539
6951
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6540
6952
|
text
|
|
6541
6953
|
);
|
|
@@ -6587,7 +6999,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6587
6999
|
});
|
|
6588
7000
|
}
|
|
6589
7001
|
for (const box of boxes) {
|
|
6590
|
-
const screenBoxPos =
|
|
7002
|
+
const screenBoxPos = applyToPoint44(
|
|
6591
7003
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6592
7004
|
box
|
|
6593
7005
|
);
|
|
@@ -6611,7 +7023,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6611
7023
|
}
|
|
6612
7024
|
for (const port of symbol.ports) {
|
|
6613
7025
|
if (connectedSymbolPorts.has(port)) continue;
|
|
6614
|
-
const screenPortPos =
|
|
7026
|
+
const screenPortPos = applyToPoint44(
|
|
6615
7027
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6616
7028
|
port
|
|
6617
7029
|
);
|
|
@@ -6631,7 +7043,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6631
7043
|
});
|
|
6632
7044
|
}
|
|
6633
7045
|
for (const circle of circles) {
|
|
6634
|
-
const screenCirclePos =
|
|
7046
|
+
const screenCirclePos = applyToPoint44(
|
|
6635
7047
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6636
7048
|
circle
|
|
6637
7049
|
);
|
|
@@ -6658,14 +7070,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6658
7070
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
6659
7071
|
import "schematic-symbols";
|
|
6660
7072
|
import "svgson";
|
|
6661
|
-
import { applyToPoint as
|
|
7073
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
6662
7074
|
|
|
6663
7075
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
6664
7076
|
import "transformation-matrix";
|
|
6665
7077
|
import "@tscircuit/circuit-json-util";
|
|
6666
7078
|
|
|
6667
7079
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
6668
|
-
import { applyToPoint as
|
|
7080
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
6669
7081
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
6670
7082
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
6671
7083
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -6718,8 +7130,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
6718
7130
|
realEdgePos.y += realPinLineLength;
|
|
6719
7131
|
break;
|
|
6720
7132
|
}
|
|
6721
|
-
const screenSchPortPos =
|
|
6722
|
-
const screenRealEdgePos =
|
|
7133
|
+
const screenSchPortPos = applyToPoint45(transform, schPort.center);
|
|
7134
|
+
const screenRealEdgePos = applyToPoint45(transform, realEdgePos);
|
|
6723
7135
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
6724
7136
|
const realLineEnd = { ...schPort.center };
|
|
6725
7137
|
if (!isConnected) {
|
|
@@ -6738,7 +7150,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
6738
7150
|
break;
|
|
6739
7151
|
}
|
|
6740
7152
|
}
|
|
6741
|
-
const screenLineEnd =
|
|
7153
|
+
const screenLineEnd = applyToPoint45(transform, realLineEnd);
|
|
6742
7154
|
svgObjects.push({
|
|
6743
7155
|
name: "line",
|
|
6744
7156
|
type: "element",
|
|
@@ -6859,7 +7271,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
6859
7271
|
};
|
|
6860
7272
|
|
|
6861
7273
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
6862
|
-
import { applyToPoint as
|
|
7274
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
6863
7275
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
6864
7276
|
const svgObjects = [];
|
|
6865
7277
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -6877,7 +7289,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
6877
7289
|
} else {
|
|
6878
7290
|
realPinNumberPos.y += 0.02;
|
|
6879
7291
|
}
|
|
6880
|
-
const screenPinNumberTextPos =
|
|
7292
|
+
const screenPinNumberTextPos = applyToPoint46(transform, realPinNumberPos);
|
|
6881
7293
|
svgObjects.push({
|
|
6882
7294
|
name: "text",
|
|
6883
7295
|
type: "element",
|
|
@@ -6907,7 +7319,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
6907
7319
|
};
|
|
6908
7320
|
|
|
6909
7321
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
6910
|
-
import { applyToPoint as
|
|
7322
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
6911
7323
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
6912
7324
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
6913
7325
|
const svgObjects = [];
|
|
@@ -6921,7 +7333,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
6921
7333
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
6922
7334
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
6923
7335
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
6924
|
-
const screenPinNumberTextPos =
|
|
7336
|
+
const screenPinNumberTextPos = applyToPoint47(transform, realPinNumberPos);
|
|
6925
7337
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
6926
7338
|
if (!label) return [];
|
|
6927
7339
|
const isNegated = label.startsWith("N_");
|
|
@@ -6969,13 +7381,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
6969
7381
|
};
|
|
6970
7382
|
|
|
6971
7383
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
6972
|
-
import { applyToPoint as
|
|
7384
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
6973
7385
|
var createSvgSchText = ({
|
|
6974
7386
|
elm,
|
|
6975
7387
|
transform,
|
|
6976
7388
|
colorMap: colorMap2
|
|
6977
7389
|
}) => {
|
|
6978
|
-
const center =
|
|
7390
|
+
const center = applyToPoint49(transform, elm.position);
|
|
6979
7391
|
const textAnchorMap = {
|
|
6980
7392
|
center: "middle",
|
|
6981
7393
|
center_right: "end",
|
|
@@ -7059,11 +7471,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
7059
7471
|
colorMap: colorMap2
|
|
7060
7472
|
}) => {
|
|
7061
7473
|
const svgObjects = [];
|
|
7062
|
-
const componentScreenTopLeft =
|
|
7474
|
+
const componentScreenTopLeft = applyToPoint50(transform, {
|
|
7063
7475
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
7064
7476
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
7065
7477
|
});
|
|
7066
|
-
const componentScreenBottomRight =
|
|
7478
|
+
const componentScreenBottomRight = applyToPoint50(transform, {
|
|
7067
7479
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
7068
7480
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
7069
7481
|
});
|
|
@@ -7149,13 +7561,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
7149
7561
|
}
|
|
7150
7562
|
|
|
7151
7563
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
7152
|
-
import { applyToPoint as
|
|
7564
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
7153
7565
|
function createSvgObjectsFromSchVoltageProbe({
|
|
7154
7566
|
probe,
|
|
7155
7567
|
transform,
|
|
7156
7568
|
colorMap: colorMap2
|
|
7157
7569
|
}) {
|
|
7158
|
-
const [screenX, screenY] =
|
|
7570
|
+
const [screenX, screenY] = applyToPoint51(transform, [
|
|
7159
7571
|
probe.position.x,
|
|
7160
7572
|
probe.position.y
|
|
7161
7573
|
]);
|
|
@@ -7215,17 +7627,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
7215
7627
|
}
|
|
7216
7628
|
|
|
7217
7629
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
7218
|
-
import { applyToPoint as
|
|
7630
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
7219
7631
|
function createSvgObjectsFromSchDebugObject({
|
|
7220
7632
|
debugObject,
|
|
7221
7633
|
transform
|
|
7222
7634
|
}) {
|
|
7223
7635
|
if (debugObject.shape === "rect") {
|
|
7224
|
-
let [screenLeft, screenTop] =
|
|
7636
|
+
let [screenLeft, screenTop] = applyToPoint52(transform, [
|
|
7225
7637
|
debugObject.center.x - debugObject.size.width / 2,
|
|
7226
7638
|
debugObject.center.y - debugObject.size.height / 2
|
|
7227
7639
|
]);
|
|
7228
|
-
let [screenRight, screenBottom] =
|
|
7640
|
+
let [screenRight, screenBottom] = applyToPoint52(transform, [
|
|
7229
7641
|
debugObject.center.x + debugObject.size.width / 2,
|
|
7230
7642
|
debugObject.center.y + debugObject.size.height / 2
|
|
7231
7643
|
]);
|
|
@@ -7235,7 +7647,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7235
7647
|
];
|
|
7236
7648
|
const width = Math.abs(screenRight - screenLeft);
|
|
7237
7649
|
const height = Math.abs(screenBottom - screenTop);
|
|
7238
|
-
const [screenCenterX, screenCenterY] =
|
|
7650
|
+
const [screenCenterX, screenCenterY] = applyToPoint52(transform, [
|
|
7239
7651
|
debugObject.center.x,
|
|
7240
7652
|
debugObject.center.y
|
|
7241
7653
|
]);
|
|
@@ -7281,11 +7693,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7281
7693
|
];
|
|
7282
7694
|
}
|
|
7283
7695
|
if (debugObject.shape === "line") {
|
|
7284
|
-
const [screenStartX, screenStartY] =
|
|
7696
|
+
const [screenStartX, screenStartY] = applyToPoint52(transform, [
|
|
7285
7697
|
debugObject.start.x,
|
|
7286
7698
|
debugObject.start.y
|
|
7287
7699
|
]);
|
|
7288
|
-
const [screenEndX, screenEndY] =
|
|
7700
|
+
const [screenEndX, screenEndY] = applyToPoint52(transform, [
|
|
7289
7701
|
debugObject.end.x,
|
|
7290
7702
|
debugObject.end.y
|
|
7291
7703
|
]);
|
|
@@ -7335,7 +7747,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7335
7747
|
}
|
|
7336
7748
|
|
|
7337
7749
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
7338
|
-
import { applyToPoint as
|
|
7750
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
7339
7751
|
function createSchematicTrace({
|
|
7340
7752
|
trace,
|
|
7341
7753
|
transform,
|
|
@@ -7349,11 +7761,11 @@ function createSchematicTrace({
|
|
|
7349
7761
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
7350
7762
|
const edge = edges[edgeIndex];
|
|
7351
7763
|
if (edge.is_crossing) continue;
|
|
7352
|
-
const [screenFromX, screenFromY] =
|
|
7764
|
+
const [screenFromX, screenFromY] = applyToPoint53(transform, [
|
|
7353
7765
|
edge.from.x,
|
|
7354
7766
|
edge.from.y
|
|
7355
7767
|
]);
|
|
7356
|
-
const [screenToX, screenToY] =
|
|
7768
|
+
const [screenToX, screenToY] = applyToPoint53(transform, [
|
|
7357
7769
|
edge.to.x,
|
|
7358
7770
|
edge.to.y
|
|
7359
7771
|
]);
|
|
@@ -7397,11 +7809,11 @@ function createSchematicTrace({
|
|
|
7397
7809
|
}
|
|
7398
7810
|
for (const edge of edges) {
|
|
7399
7811
|
if (!edge.is_crossing) continue;
|
|
7400
|
-
const [screenFromX, screenFromY] =
|
|
7812
|
+
const [screenFromX, screenFromY] = applyToPoint53(transform, [
|
|
7401
7813
|
edge.from.x,
|
|
7402
7814
|
edge.from.y
|
|
7403
7815
|
]);
|
|
7404
|
-
const [screenToX, screenToY] =
|
|
7816
|
+
const [screenToX, screenToY] = applyToPoint53(transform, [
|
|
7405
7817
|
edge.to.x,
|
|
7406
7818
|
edge.to.y
|
|
7407
7819
|
]);
|
|
@@ -7445,7 +7857,7 @@ function createSchematicTrace({
|
|
|
7445
7857
|
}
|
|
7446
7858
|
if (trace.junctions) {
|
|
7447
7859
|
for (const junction of trace.junctions) {
|
|
7448
|
-
const [screenX, screenY] =
|
|
7860
|
+
const [screenX, screenY] = applyToPoint53(transform, [
|
|
7449
7861
|
junction.x,
|
|
7450
7862
|
junction.y
|
|
7451
7863
|
]);
|
|
@@ -7500,7 +7912,7 @@ function createSchematicTrace({
|
|
|
7500
7912
|
|
|
7501
7913
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
7502
7914
|
import {
|
|
7503
|
-
applyToPoint as
|
|
7915
|
+
applyToPoint as applyToPoint55,
|
|
7504
7916
|
compose as compose11,
|
|
7505
7917
|
rotate as rotate6,
|
|
7506
7918
|
scale as scale6,
|
|
@@ -7509,7 +7921,7 @@ import {
|
|
|
7509
7921
|
|
|
7510
7922
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
7511
7923
|
import {
|
|
7512
|
-
applyToPoint as
|
|
7924
|
+
applyToPoint as applyToPoint54,
|
|
7513
7925
|
compose as compose10,
|
|
7514
7926
|
rotate as rotate5,
|
|
7515
7927
|
scale as scale5,
|
|
@@ -7584,7 +7996,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7584
7996
|
x: symbolBounds.minX,
|
|
7585
7997
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
7586
7998
|
};
|
|
7587
|
-
const rotatedSymbolEnd =
|
|
7999
|
+
const rotatedSymbolEnd = applyToPoint54(rotationMatrix, symbolEndPoint);
|
|
7588
8000
|
const symbolToRealTransform = compose10(
|
|
7589
8001
|
translate10(
|
|
7590
8002
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -7594,11 +8006,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7594
8006
|
scale5(1)
|
|
7595
8007
|
// Use full symbol size
|
|
7596
8008
|
);
|
|
7597
|
-
const [screenMinX, screenMinY] =
|
|
8009
|
+
const [screenMinX, screenMinY] = applyToPoint54(
|
|
7598
8010
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7599
8011
|
[bounds.minX, bounds.minY]
|
|
7600
8012
|
);
|
|
7601
|
-
const [screenMaxX, screenMaxY] =
|
|
8013
|
+
const [screenMaxX, screenMaxY] = applyToPoint54(
|
|
7602
8014
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7603
8015
|
[bounds.maxX, bounds.maxY]
|
|
7604
8016
|
);
|
|
@@ -7622,7 +8034,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7622
8034
|
});
|
|
7623
8035
|
for (const path of symbolPaths) {
|
|
7624
8036
|
const symbolPath = path.points.map((p, i) => {
|
|
7625
|
-
const [x, y] =
|
|
8037
|
+
const [x, y] = applyToPoint54(
|
|
7626
8038
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7627
8039
|
[p.x, p.y]
|
|
7628
8040
|
);
|
|
@@ -7643,7 +8055,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7643
8055
|
});
|
|
7644
8056
|
}
|
|
7645
8057
|
for (const text of symbolTexts) {
|
|
7646
|
-
const screenTextPos =
|
|
8058
|
+
const screenTextPos = applyToPoint54(
|
|
7647
8059
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7648
8060
|
text
|
|
7649
8061
|
);
|
|
@@ -7685,7 +8097,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7685
8097
|
});
|
|
7686
8098
|
}
|
|
7687
8099
|
for (const box of symbolBoxes) {
|
|
7688
|
-
const screenBoxPos =
|
|
8100
|
+
const screenBoxPos = applyToPoint54(
|
|
7689
8101
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7690
8102
|
box
|
|
7691
8103
|
);
|
|
@@ -7708,7 +8120,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7708
8120
|
});
|
|
7709
8121
|
}
|
|
7710
8122
|
for (const circle of symbolCircles) {
|
|
7711
|
-
const screenCirclePos =
|
|
8123
|
+
const screenCirclePos = applyToPoint54(
|
|
7712
8124
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7713
8125
|
circle
|
|
7714
8126
|
);
|
|
@@ -7753,14 +8165,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
7753
8165
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
7754
8166
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
7755
8167
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
7756
|
-
const screenCenter =
|
|
8168
|
+
const screenCenter = applyToPoint55(realToScreenTransform, schNetLabel.center);
|
|
7757
8169
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
7758
8170
|
schNetLabel.anchor_side
|
|
7759
8171
|
);
|
|
7760
8172
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
7761
8173
|
screenTextGrowthVec.y *= -1;
|
|
7762
8174
|
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 ?
|
|
8175
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint55(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
7764
8176
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
7765
8177
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
7766
8178
|
};
|
|
@@ -7801,7 +8213,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
7801
8213
|
y: -0.6
|
|
7802
8214
|
}
|
|
7803
8215
|
].map(
|
|
7804
|
-
(fontRelativePoint) =>
|
|
8216
|
+
(fontRelativePoint) => applyToPoint55(
|
|
7805
8217
|
compose11(
|
|
7806
8218
|
realToScreenTransform,
|
|
7807
8219
|
translate11(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -7878,17 +8290,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
7878
8290
|
};
|
|
7879
8291
|
|
|
7880
8292
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
7881
|
-
import { applyToPoint as
|
|
8293
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
7882
8294
|
var createSvgObjectsFromSchematicBox = ({
|
|
7883
8295
|
schematicBox,
|
|
7884
8296
|
transform,
|
|
7885
8297
|
colorMap: colorMap2
|
|
7886
8298
|
}) => {
|
|
7887
|
-
const topLeft =
|
|
8299
|
+
const topLeft = applyToPoint56(transform, {
|
|
7888
8300
|
x: schematicBox.x,
|
|
7889
8301
|
y: schematicBox.y
|
|
7890
8302
|
});
|
|
7891
|
-
const bottomRight =
|
|
8303
|
+
const bottomRight = applyToPoint56(transform, {
|
|
7892
8304
|
x: schematicBox.x + schematicBox.width,
|
|
7893
8305
|
y: schematicBox.y + schematicBox.height
|
|
7894
8306
|
});
|
|
@@ -7924,7 +8336,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
7924
8336
|
};
|
|
7925
8337
|
|
|
7926
8338
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
7927
|
-
import { applyToPoint as
|
|
8339
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
7928
8340
|
var createSvgObjectsFromSchematicTable = ({
|
|
7929
8341
|
schematicTable,
|
|
7930
8342
|
transform,
|
|
@@ -7957,11 +8369,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
7957
8369
|
const svgObjects = [];
|
|
7958
8370
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
7959
8371
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
7960
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
8372
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint57(transform, [
|
|
7961
8373
|
topLeftX,
|
|
7962
8374
|
topLeftY
|
|
7963
8375
|
]);
|
|
7964
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
8376
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint57(transform, [
|
|
7965
8377
|
topLeftX + totalWidth,
|
|
7966
8378
|
topLeftY - totalHeight
|
|
7967
8379
|
]);
|
|
@@ -7993,8 +8405,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
7993
8405
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
7994
8406
|
);
|
|
7995
8407
|
if (!isMerged) {
|
|
7996
|
-
const start =
|
|
7997
|
-
const end =
|
|
8408
|
+
const start = applyToPoint57(transform, { x: currentX, y: segmentStartY });
|
|
8409
|
+
const end = applyToPoint57(transform, { x: currentX, y: segmentEndY });
|
|
7998
8410
|
svgObjects.push({
|
|
7999
8411
|
name: "line",
|
|
8000
8412
|
type: "element",
|
|
@@ -8023,11 +8435,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8023
8435
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
8024
8436
|
);
|
|
8025
8437
|
if (!isMerged) {
|
|
8026
|
-
const start =
|
|
8438
|
+
const start = applyToPoint57(transform, {
|
|
8027
8439
|
x: segmentStartX,
|
|
8028
8440
|
y: currentY
|
|
8029
8441
|
});
|
|
8030
|
-
const end =
|
|
8442
|
+
const end = applyToPoint57(transform, { x: segmentEndX, y: currentY });
|
|
8031
8443
|
svgObjects.push({
|
|
8032
8444
|
name: "line",
|
|
8033
8445
|
type: "element",
|
|
@@ -8069,7 +8481,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8069
8481
|
} else if (vertical_align === "bottom") {
|
|
8070
8482
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
8071
8483
|
}
|
|
8072
|
-
const screenTextAnchorPos =
|
|
8484
|
+
const screenTextAnchorPos = applyToPoint57(transform, realTextAnchorPos);
|
|
8073
8485
|
const fontSize = getSchScreenFontSize(
|
|
8074
8486
|
transform,
|
|
8075
8487
|
"reference_designator",
|
|
@@ -8125,13 +8537,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8125
8537
|
|
|
8126
8538
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
8127
8539
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
8128
|
-
import { applyToPoint as
|
|
8540
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
8129
8541
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
8130
8542
|
var createSvgObjectsForSchPortHover = ({
|
|
8131
8543
|
schPort,
|
|
8132
8544
|
transform
|
|
8133
8545
|
}) => {
|
|
8134
|
-
const screenSchPortPos =
|
|
8546
|
+
const screenSchPortPos = applyToPoint58(transform, schPort.center);
|
|
8135
8547
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
8136
8548
|
return [
|
|
8137
8549
|
{
|
|
@@ -8176,14 +8588,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
8176
8588
|
};
|
|
8177
8589
|
|
|
8178
8590
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
8179
|
-
import { applyToPoint as
|
|
8591
|
+
import { applyToPoint as applyToPoint59 } from "transformation-matrix";
|
|
8180
8592
|
function createSvgObjectsFromSchematicLine({
|
|
8181
8593
|
schLine,
|
|
8182
8594
|
transform,
|
|
8183
8595
|
colorMap: colorMap2
|
|
8184
8596
|
}) {
|
|
8185
|
-
const p1 =
|
|
8186
|
-
const p2 =
|
|
8597
|
+
const p1 = applyToPoint59(transform, { x: schLine.x1, y: schLine.y1 });
|
|
8598
|
+
const p2 = applyToPoint59(transform, { x: schLine.x2, y: schLine.y2 });
|
|
8187
8599
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
8188
8600
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
8189
8601
|
return [
|
|
@@ -8212,13 +8624,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
8212
8624
|
}
|
|
8213
8625
|
|
|
8214
8626
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
8215
|
-
import { applyToPoint as
|
|
8627
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
8216
8628
|
function createSvgObjectsFromSchematicCircle({
|
|
8217
8629
|
schCircle,
|
|
8218
8630
|
transform,
|
|
8219
8631
|
colorMap: colorMap2
|
|
8220
8632
|
}) {
|
|
8221
|
-
const center =
|
|
8633
|
+
const center = applyToPoint60(transform, schCircle.center);
|
|
8222
8634
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
8223
8635
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
8224
8636
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -8248,13 +8660,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
8248
8660
|
}
|
|
8249
8661
|
|
|
8250
8662
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
8251
|
-
import { applyToPoint as
|
|
8663
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
8252
8664
|
function createSvgObjectsFromSchematicRect({
|
|
8253
8665
|
schRect,
|
|
8254
8666
|
transform,
|
|
8255
8667
|
colorMap: colorMap2
|
|
8256
8668
|
}) {
|
|
8257
|
-
const center =
|
|
8669
|
+
const center = applyToPoint61(transform, schRect.center);
|
|
8258
8670
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
8259
8671
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
8260
8672
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -8290,13 +8702,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
8290
8702
|
}
|
|
8291
8703
|
|
|
8292
8704
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
8293
|
-
import { applyToPoint as
|
|
8705
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
8294
8706
|
function createSvgObjectsFromSchematicArc({
|
|
8295
8707
|
schArc,
|
|
8296
8708
|
transform,
|
|
8297
8709
|
colorMap: colorMap2
|
|
8298
8710
|
}) {
|
|
8299
|
-
const center =
|
|
8711
|
+
const center = applyToPoint62(transform, schArc.center);
|
|
8300
8712
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
8301
8713
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
8302
8714
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -9328,18 +9740,18 @@ function formatNumber2(value) {
|
|
|
9328
9740
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
9329
9741
|
import { stringify as stringify7 } from "svgson";
|
|
9330
9742
|
import {
|
|
9331
|
-
applyToPoint as
|
|
9743
|
+
applyToPoint as applyToPoint65,
|
|
9332
9744
|
compose as compose14,
|
|
9333
9745
|
scale as scale8,
|
|
9334
9746
|
translate as translate14
|
|
9335
9747
|
} from "transformation-matrix";
|
|
9336
9748
|
|
|
9337
9749
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
9338
|
-
import { applyToPoint as
|
|
9750
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
9339
9751
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
9340
9752
|
const { transform, layer: layerFilter } = ctx;
|
|
9341
9753
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
9342
|
-
const [x, y] =
|
|
9754
|
+
const [x, y] = applyToPoint64(transform, [solderPaste.x, solderPaste.y]);
|
|
9343
9755
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
9344
9756
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
9345
9757
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -9550,8 +9962,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
9550
9962
|
}
|
|
9551
9963
|
}
|
|
9552
9964
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
9553
|
-
const [x1, y1] =
|
|
9554
|
-
const [x2, y2] =
|
|
9965
|
+
const [x1, y1] = applyToPoint65(transform, [minX, minY]);
|
|
9966
|
+
const [x2, y2] = applyToPoint65(transform, [maxX, maxY]);
|
|
9555
9967
|
const width = Math.abs(x2 - x1);
|
|
9556
9968
|
const height = Math.abs(y2 - y1);
|
|
9557
9969
|
const x = Math.min(x1, x2);
|