circuit-to-svg 0.0.231 → 0.0.233
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 +535 -192
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 applyToPoint27,
|
|
5
5
|
compose as compose5,
|
|
6
6
|
scale as scale2,
|
|
7
7
|
translate as translate5
|
|
@@ -520,8 +520,93 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
|
|
|
520
520
|
return [svgObject];
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-
|
|
523
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-fabrication-note-rect.ts
|
|
524
524
|
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
525
|
+
var DEFAULT_OVERLAY_STROKE_COLOR = "rgba(255,255,255,0.5)";
|
|
526
|
+
var DEFAULT_OVERLAY_FILL_COLOR = "rgba(255,255,255,0.2)";
|
|
527
|
+
function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
528
|
+
const { transform, layer: layerFilter } = ctx;
|
|
529
|
+
const {
|
|
530
|
+
center,
|
|
531
|
+
width,
|
|
532
|
+
height,
|
|
533
|
+
stroke_width,
|
|
534
|
+
is_filled,
|
|
535
|
+
has_stroke,
|
|
536
|
+
is_stroke_dashed,
|
|
537
|
+
color,
|
|
538
|
+
layer = "top",
|
|
539
|
+
pcb_component_id,
|
|
540
|
+
pcb_fabrication_note_rect_id
|
|
541
|
+
} = fabricationNoteRect;
|
|
542
|
+
if (layerFilter && layer !== layerFilter) return [];
|
|
543
|
+
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
544
|
+
console.error("Invalid pcb_fabrication_note_rect data", {
|
|
545
|
+
center,
|
|
546
|
+
width,
|
|
547
|
+
height
|
|
548
|
+
});
|
|
549
|
+
return [];
|
|
550
|
+
}
|
|
551
|
+
const halfWidth = width / 2;
|
|
552
|
+
const halfHeight = height / 2;
|
|
553
|
+
const [topLeftX, topLeftY] = applyToPoint5(transform, [
|
|
554
|
+
center.x - halfWidth,
|
|
555
|
+
center.y + halfHeight
|
|
556
|
+
]);
|
|
557
|
+
const [bottomRightX, bottomRightY] = applyToPoint5(transform, [
|
|
558
|
+
center.x + halfWidth,
|
|
559
|
+
center.y - halfHeight
|
|
560
|
+
]);
|
|
561
|
+
const rectX = Math.min(topLeftX, bottomRightX);
|
|
562
|
+
const rectY = Math.min(topLeftY, bottomRightY);
|
|
563
|
+
const rectWidth = Math.abs(bottomRightX - topLeftX);
|
|
564
|
+
const rectHeight = Math.abs(bottomRightY - topLeftY);
|
|
565
|
+
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
566
|
+
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
567
|
+
const overlayStrokeColor = color ?? DEFAULT_OVERLAY_STROKE_COLOR;
|
|
568
|
+
const attributes = {
|
|
569
|
+
x: rectX.toString(),
|
|
570
|
+
y: rectY.toString(),
|
|
571
|
+
width: rectWidth.toString(),
|
|
572
|
+
height: rectHeight.toString(),
|
|
573
|
+
class: "pcb-fabrication-note-rect",
|
|
574
|
+
"data-type": "pcb_fabrication_note_rect",
|
|
575
|
+
"data-pcb-fabrication-note-rect-id": pcb_fabrication_note_rect_id,
|
|
576
|
+
"data-pcb-layer": "overlay"
|
|
577
|
+
};
|
|
578
|
+
if (pcb_component_id !== void 0) {
|
|
579
|
+
attributes["data-pcb-component-id"] = pcb_component_id;
|
|
580
|
+
}
|
|
581
|
+
if (is_filled) {
|
|
582
|
+
attributes.fill = color ?? DEFAULT_OVERLAY_FILL_COLOR;
|
|
583
|
+
} else {
|
|
584
|
+
attributes.fill = "none";
|
|
585
|
+
}
|
|
586
|
+
const shouldDrawStroke = has_stroke ?? transformedStrokeWidth > 0;
|
|
587
|
+
if (shouldDrawStroke) {
|
|
588
|
+
attributes.stroke = overlayStrokeColor;
|
|
589
|
+
attributes["stroke-width"] = transformedStrokeWidth.toString();
|
|
590
|
+
if (is_stroke_dashed) {
|
|
591
|
+
const dash = 0.2 * Math.abs(transform.a);
|
|
592
|
+
const gap = 0.1 * Math.abs(transform.a);
|
|
593
|
+
attributes["stroke-dasharray"] = `${dash} ${gap}`;
|
|
594
|
+
}
|
|
595
|
+
} else {
|
|
596
|
+
attributes.stroke = "none";
|
|
597
|
+
}
|
|
598
|
+
const svgObject = {
|
|
599
|
+
name: "rect",
|
|
600
|
+
type: "element",
|
|
601
|
+
value: "",
|
|
602
|
+
attributes,
|
|
603
|
+
children: []
|
|
604
|
+
};
|
|
605
|
+
return [svgObject];
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-dimension.ts
|
|
609
|
+
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
525
610
|
function normalize(vector) {
|
|
526
611
|
const length = Math.hypot(vector.x, vector.y) || 1;
|
|
527
612
|
return { x: vector.x / length, y: vector.y / length };
|
|
@@ -578,11 +663,11 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
578
663
|
y: toBase.y - perpendicular.y * arrowHalfWidth
|
|
579
664
|
})
|
|
580
665
|
];
|
|
581
|
-
const [lineStartX, lineStartY] =
|
|
666
|
+
const [lineStartX, lineStartY] = applyToPoint6(transform, [
|
|
582
667
|
fromBase.x,
|
|
583
668
|
fromBase.y
|
|
584
669
|
]);
|
|
585
|
-
const [lineEndX, lineEndY] =
|
|
670
|
+
const [lineEndX, lineEndY] = applyToPoint6(transform, [toBase.x, toBase.y]);
|
|
586
671
|
const strokeWidth = arrow_size / 5 * Math.abs(transform.a);
|
|
587
672
|
const lineColor = color || "rgba(255,255,255,0.5)";
|
|
588
673
|
const midPoint = {
|
|
@@ -594,7 +679,7 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
594
679
|
x: midPoint.x + perpendicular.x * textOffset,
|
|
595
680
|
y: midPoint.y + perpendicular.y * textOffset
|
|
596
681
|
};
|
|
597
|
-
const [textX, textY] =
|
|
682
|
+
const [textX, textY] = applyToPoint6(transform, [textPoint.x, textPoint.y]);
|
|
598
683
|
const transformedFontSize = font_size * Math.abs(transform.a);
|
|
599
684
|
const children = [
|
|
600
685
|
{
|
|
@@ -675,16 +760,253 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
675
760
|
}
|
|
676
761
|
];
|
|
677
762
|
function toScreen(point) {
|
|
678
|
-
const [x, y] =
|
|
763
|
+
const [x, y] = applyToPoint6(transform, [point.x, point.y]);
|
|
679
764
|
return { x, y };
|
|
680
765
|
}
|
|
681
766
|
}
|
|
682
767
|
|
|
768
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-text.ts
|
|
769
|
+
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
770
|
+
var DEFAULT_OVERLAY_COLOR = "rgba(255,255,255,0.5)";
|
|
771
|
+
function createSvgObjectsFromPcbNoteText(note, ctx) {
|
|
772
|
+
const { transform } = ctx;
|
|
773
|
+
const {
|
|
774
|
+
anchor_position,
|
|
775
|
+
text,
|
|
776
|
+
font_size = 1,
|
|
777
|
+
anchor_alignment = "center",
|
|
778
|
+
color
|
|
779
|
+
} = note;
|
|
780
|
+
if (!anchor_position || typeof anchor_position.x !== "number" || typeof anchor_position.y !== "number") {
|
|
781
|
+
console.error("Invalid pcb_note_text anchor_position", anchor_position);
|
|
782
|
+
return [];
|
|
783
|
+
}
|
|
784
|
+
if (typeof text !== "string" || text.length === 0) {
|
|
785
|
+
console.error("Invalid pcb_note_text text", text);
|
|
786
|
+
return [];
|
|
787
|
+
}
|
|
788
|
+
const [x, y] = applyToPoint7(transform, [anchor_position.x, anchor_position.y]);
|
|
789
|
+
const transformedFontSize = font_size * Math.abs(transform.a);
|
|
790
|
+
let textAnchor = "middle";
|
|
791
|
+
let dominantBaseline = "central";
|
|
792
|
+
switch (anchor_alignment) {
|
|
793
|
+
case "top_left":
|
|
794
|
+
textAnchor = "start";
|
|
795
|
+
dominantBaseline = "text-before-edge";
|
|
796
|
+
break;
|
|
797
|
+
case "top_right":
|
|
798
|
+
textAnchor = "end";
|
|
799
|
+
dominantBaseline = "text-before-edge";
|
|
800
|
+
break;
|
|
801
|
+
case "bottom_left":
|
|
802
|
+
textAnchor = "start";
|
|
803
|
+
dominantBaseline = "text-after-edge";
|
|
804
|
+
break;
|
|
805
|
+
case "bottom_right":
|
|
806
|
+
textAnchor = "end";
|
|
807
|
+
dominantBaseline = "text-after-edge";
|
|
808
|
+
break;
|
|
809
|
+
case "center":
|
|
810
|
+
default:
|
|
811
|
+
textAnchor = "middle";
|
|
812
|
+
dominantBaseline = "central";
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
815
|
+
const svgObject = {
|
|
816
|
+
name: "text",
|
|
817
|
+
type: "element",
|
|
818
|
+
value: "",
|
|
819
|
+
attributes: {
|
|
820
|
+
x: x.toString(),
|
|
821
|
+
y: y.toString(),
|
|
822
|
+
fill: color ?? DEFAULT_OVERLAY_COLOR,
|
|
823
|
+
"font-family": "Arial, sans-serif",
|
|
824
|
+
"font-size": transformedFontSize.toString(),
|
|
825
|
+
"text-anchor": textAnchor,
|
|
826
|
+
"dominant-baseline": dominantBaseline,
|
|
827
|
+
class: "pcb-note-text",
|
|
828
|
+
"data-type": "pcb_note_text",
|
|
829
|
+
"data-pcb-note-text-id": note.pcb_note_text_id,
|
|
830
|
+
"data-pcb-layer": "overlay"
|
|
831
|
+
},
|
|
832
|
+
children: [
|
|
833
|
+
{
|
|
834
|
+
type: "text",
|
|
835
|
+
name: "",
|
|
836
|
+
value: text,
|
|
837
|
+
attributes: {},
|
|
838
|
+
children: []
|
|
839
|
+
}
|
|
840
|
+
]
|
|
841
|
+
};
|
|
842
|
+
return [svgObject];
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-rect.ts
|
|
846
|
+
import { applyToPoint as applyToPoint8 } from "transformation-matrix";
|
|
847
|
+
var DEFAULT_OVERLAY_COLOR2 = "rgba(255,255,255,0.5)";
|
|
848
|
+
var DEFAULT_FILL_COLOR = "rgba(255,255,255,0.2)";
|
|
849
|
+
function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
850
|
+
const { transform } = ctx;
|
|
851
|
+
const {
|
|
852
|
+
center,
|
|
853
|
+
width,
|
|
854
|
+
height,
|
|
855
|
+
stroke_width,
|
|
856
|
+
is_filled,
|
|
857
|
+
has_stroke,
|
|
858
|
+
is_stroke_dashed,
|
|
859
|
+
color
|
|
860
|
+
} = noteRect;
|
|
861
|
+
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
862
|
+
console.error("Invalid pcb_note_rect data", { center, width, height });
|
|
863
|
+
return [];
|
|
864
|
+
}
|
|
865
|
+
const halfWidth = width / 2;
|
|
866
|
+
const halfHeight = height / 2;
|
|
867
|
+
const [topLeftX, topLeftY] = applyToPoint8(transform, [
|
|
868
|
+
center.x - halfWidth,
|
|
869
|
+
center.y + halfHeight
|
|
870
|
+
]);
|
|
871
|
+
const [bottomRightX, bottomRightY] = applyToPoint8(transform, [
|
|
872
|
+
center.x + halfWidth,
|
|
873
|
+
center.y - halfHeight
|
|
874
|
+
]);
|
|
875
|
+
const rectX = Math.min(topLeftX, bottomRightX);
|
|
876
|
+
const rectY = Math.min(topLeftY, bottomRightY);
|
|
877
|
+
const rectWidth = Math.abs(bottomRightX - topLeftX);
|
|
878
|
+
const rectHeight = Math.abs(bottomRightY - topLeftY);
|
|
879
|
+
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
880
|
+
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
881
|
+
const overlayColor = color ?? DEFAULT_OVERLAY_COLOR2;
|
|
882
|
+
const attributes = {
|
|
883
|
+
x: rectX.toString(),
|
|
884
|
+
y: rectY.toString(),
|
|
885
|
+
width: rectWidth.toString(),
|
|
886
|
+
height: rectHeight.toString(),
|
|
887
|
+
class: "pcb-note-rect",
|
|
888
|
+
"data-type": "pcb_note_rect",
|
|
889
|
+
"data-pcb-note-rect-id": noteRect.pcb_note_rect_id,
|
|
890
|
+
"data-pcb-layer": "overlay"
|
|
891
|
+
};
|
|
892
|
+
if (is_filled) {
|
|
893
|
+
attributes.fill = color ?? DEFAULT_FILL_COLOR;
|
|
894
|
+
} else {
|
|
895
|
+
attributes.fill = "none";
|
|
896
|
+
}
|
|
897
|
+
const shouldDrawStroke = has_stroke ?? transformedStrokeWidth > 0;
|
|
898
|
+
if (shouldDrawStroke) {
|
|
899
|
+
attributes.stroke = overlayColor;
|
|
900
|
+
attributes["stroke-width"] = transformedStrokeWidth.toString();
|
|
901
|
+
if (is_stroke_dashed) {
|
|
902
|
+
const dash = 0.2 * Math.abs(transform.a);
|
|
903
|
+
const gap = 0.1 * Math.abs(transform.a);
|
|
904
|
+
attributes["stroke-dasharray"] = `${dash} ${gap}`;
|
|
905
|
+
}
|
|
906
|
+
} else {
|
|
907
|
+
attributes.stroke = "none";
|
|
908
|
+
}
|
|
909
|
+
const svgObject = {
|
|
910
|
+
name: "rect",
|
|
911
|
+
type: "element",
|
|
912
|
+
value: "",
|
|
913
|
+
attributes,
|
|
914
|
+
children: []
|
|
915
|
+
};
|
|
916
|
+
return [svgObject];
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-path.ts
|
|
920
|
+
import { applyToPoint as applyToPoint9 } from "transformation-matrix";
|
|
921
|
+
var DEFAULT_OVERLAY_COLOR3 = "rgba(255,255,255,0.5)";
|
|
922
|
+
function createSvgObjectsFromPcbNotePath(notePath, ctx) {
|
|
923
|
+
const { transform } = ctx;
|
|
924
|
+
if (!Array.isArray(notePath.route) || notePath.route.length === 0) {
|
|
925
|
+
console.error("Invalid pcb_note_path route", notePath.route);
|
|
926
|
+
return [];
|
|
927
|
+
}
|
|
928
|
+
for (const point of notePath.route) {
|
|
929
|
+
if (typeof point.x !== "number" || typeof point.y !== "number") {
|
|
930
|
+
console.error("Invalid point in pcb_note_path", point);
|
|
931
|
+
return [];
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
const pathD = notePath.route.map((point, index) => {
|
|
935
|
+
const [x, y] = applyToPoint9(transform, [point.x, point.y]);
|
|
936
|
+
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
937
|
+
}).join(" ");
|
|
938
|
+
const strokeWidth = notePath.stroke_width * Math.abs(transform.a);
|
|
939
|
+
const svgObject = {
|
|
940
|
+
name: "path",
|
|
941
|
+
type: "element",
|
|
942
|
+
value: "",
|
|
943
|
+
attributes: {
|
|
944
|
+
d: pathD,
|
|
945
|
+
stroke: notePath.color ?? DEFAULT_OVERLAY_COLOR3,
|
|
946
|
+
fill: "none",
|
|
947
|
+
"stroke-width": strokeWidth.toString(),
|
|
948
|
+
class: "pcb-note-path",
|
|
949
|
+
"data-type": "pcb_note_path",
|
|
950
|
+
"data-pcb-note-path-id": notePath.pcb_note_path_id,
|
|
951
|
+
"data-pcb-layer": "overlay"
|
|
952
|
+
},
|
|
953
|
+
children: []
|
|
954
|
+
};
|
|
955
|
+
return [svgObject];
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-note-line.ts
|
|
959
|
+
import { applyToPoint as applyToPoint10 } from "transformation-matrix";
|
|
960
|
+
var DEFAULT_OVERLAY_COLOR4 = "rgba(255,255,255,0.5)";
|
|
961
|
+
function createSvgObjectsFromPcbNoteLine(noteLine, ctx) {
|
|
962
|
+
const { transform } = ctx;
|
|
963
|
+
const { x1, y1, x2, y2, stroke_width, color, is_dashed } = noteLine;
|
|
964
|
+
if (typeof x1 !== "number" || typeof y1 !== "number" || typeof x2 !== "number" || typeof y2 !== "number") {
|
|
965
|
+
console.error("Invalid pcb_note_line coordinates", {
|
|
966
|
+
x1,
|
|
967
|
+
y1,
|
|
968
|
+
x2,
|
|
969
|
+
y2
|
|
970
|
+
});
|
|
971
|
+
return [];
|
|
972
|
+
}
|
|
973
|
+
const [startX, startY] = applyToPoint10(transform, [x1, y1]);
|
|
974
|
+
const [endX, endY] = applyToPoint10(transform, [x2, y2]);
|
|
975
|
+
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
976
|
+
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
977
|
+
const attributes = {
|
|
978
|
+
x1: startX.toString(),
|
|
979
|
+
y1: startY.toString(),
|
|
980
|
+
x2: endX.toString(),
|
|
981
|
+
y2: endY.toString(),
|
|
982
|
+
stroke: color ?? DEFAULT_OVERLAY_COLOR4,
|
|
983
|
+
"stroke-width": transformedStrokeWidth.toString(),
|
|
984
|
+
"stroke-linecap": "round",
|
|
985
|
+
class: "pcb-note-line",
|
|
986
|
+
"data-type": "pcb_note_line",
|
|
987
|
+
"data-pcb-note-line-id": noteLine.pcb_note_line_id,
|
|
988
|
+
"data-pcb-layer": "overlay"
|
|
989
|
+
};
|
|
990
|
+
if (is_dashed) {
|
|
991
|
+
const dash = 0.2 * Math.abs(transform.a);
|
|
992
|
+
const gap = 0.1 * Math.abs(transform.a);
|
|
993
|
+
attributes["stroke-dasharray"] = `${dash} ${gap}`;
|
|
994
|
+
}
|
|
995
|
+
const svgObject = {
|
|
996
|
+
name: "line",
|
|
997
|
+
type: "element",
|
|
998
|
+
value: "",
|
|
999
|
+
attributes,
|
|
1000
|
+
children: []
|
|
1001
|
+
};
|
|
1002
|
+
return [svgObject];
|
|
1003
|
+
}
|
|
1004
|
+
|
|
683
1005
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-plated-hole.ts
|
|
684
|
-
import { applyToPoint as
|
|
1006
|
+
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
685
1007
|
function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
686
1008
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
687
|
-
const [x, y] =
|
|
1009
|
+
const [x, y] = applyToPoint11(transform, [hole.x, hole.y]);
|
|
688
1010
|
const copperLayer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
|
|
689
1011
|
if (hole.shape === "pill") {
|
|
690
1012
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
@@ -801,7 +1123,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
801
1123
|
const scaledRectPadHeight = hole.rect_pad_height * Math.abs(transform.a);
|
|
802
1124
|
const scaledRectBorderRadius = (hole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
803
1125
|
const holeRadius = scaledHoleDiameter / 2;
|
|
804
|
-
const [holeCx, holeCy] =
|
|
1126
|
+
const [holeCx, holeCy] = applyToPoint11(transform, [
|
|
805
1127
|
h.x + (h.hole_offset_x ?? 0),
|
|
806
1128
|
h.y + (h.hole_offset_y ?? 0)
|
|
807
1129
|
]);
|
|
@@ -866,7 +1188,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
866
1188
|
const pillHoleWithOffsets = pillHole;
|
|
867
1189
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
868
1190
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
869
|
-
const [holeCenterX, holeCenterY] =
|
|
1191
|
+
const [holeCenterX, holeCenterY] = applyToPoint11(transform, [
|
|
870
1192
|
pillHole.x + holeOffsetX,
|
|
871
1193
|
pillHole.y + holeOffsetY
|
|
872
1194
|
]);
|
|
@@ -935,7 +1257,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
935
1257
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
936
1258
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
937
1259
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
938
|
-
const [holeCenterX, holeCenterY] =
|
|
1260
|
+
const [holeCenterX, holeCenterY] = applyToPoint11(transform, [
|
|
939
1261
|
rotatedHole.x + holeOffsetX,
|
|
940
1262
|
rotatedHole.y + holeOffsetY
|
|
941
1263
|
]);
|
|
@@ -998,12 +1320,12 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
998
1320
|
}
|
|
999
1321
|
|
|
1000
1322
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-path.ts
|
|
1001
|
-
import { applyToPoint as
|
|
1323
|
+
import { applyToPoint as applyToPoint12 } from "transformation-matrix";
|
|
1002
1324
|
function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
|
|
1003
1325
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1004
1326
|
if (!silkscreenPath.route || !Array.isArray(silkscreenPath.route)) return [];
|
|
1005
1327
|
let path = silkscreenPath.route.map((point, index) => {
|
|
1006
|
-
const [x, y] =
|
|
1328
|
+
const [x, y] = applyToPoint12(transform, [point.x, point.y]);
|
|
1007
1329
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
1008
1330
|
}).join(" ");
|
|
1009
1331
|
const firstPoint = silkscreenPath.route[0];
|
|
@@ -1039,7 +1361,7 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
|
|
|
1039
1361
|
|
|
1040
1362
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-text.ts
|
|
1041
1363
|
import {
|
|
1042
|
-
applyToPoint as
|
|
1364
|
+
applyToPoint as applyToPoint13,
|
|
1043
1365
|
compose as compose2,
|
|
1044
1366
|
rotate as rotate2,
|
|
1045
1367
|
translate as translate2,
|
|
@@ -1061,7 +1383,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
1061
1383
|
console.error("Invalid anchor_position:", anchor_position);
|
|
1062
1384
|
return [];
|
|
1063
1385
|
}
|
|
1064
|
-
const [transformedX, transformedY] =
|
|
1386
|
+
const [transformedX, transformedY] = applyToPoint13(transform, [
|
|
1065
1387
|
anchor_position.x,
|
|
1066
1388
|
anchor_position.y
|
|
1067
1389
|
]);
|
|
@@ -1169,7 +1491,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
1169
1491
|
}
|
|
1170
1492
|
|
|
1171
1493
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-rect.ts
|
|
1172
|
-
import { applyToPoint as
|
|
1494
|
+
import { applyToPoint as applyToPoint14 } from "transformation-matrix";
|
|
1173
1495
|
function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
1174
1496
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1175
1497
|
const {
|
|
@@ -1188,7 +1510,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
1188
1510
|
console.error("Invalid rectangle data:", { center, width, height });
|
|
1189
1511
|
return [];
|
|
1190
1512
|
}
|
|
1191
|
-
const [transformedX, transformedY] =
|
|
1513
|
+
const [transformedX, transformedY] = applyToPoint14(transform, [
|
|
1192
1514
|
center.x,
|
|
1193
1515
|
center.y
|
|
1194
1516
|
]);
|
|
@@ -1235,7 +1557,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
1235
1557
|
}
|
|
1236
1558
|
|
|
1237
1559
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-circle.ts
|
|
1238
|
-
import { applyToPoint as
|
|
1560
|
+
import { applyToPoint as applyToPoint15 } from "transformation-matrix";
|
|
1239
1561
|
function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
1240
1562
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1241
1563
|
const {
|
|
@@ -1250,7 +1572,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
|
1250
1572
|
console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
|
|
1251
1573
|
return [];
|
|
1252
1574
|
}
|
|
1253
|
-
const [transformedX, transformedY] =
|
|
1575
|
+
const [transformedX, transformedY] = applyToPoint15(transform, [
|
|
1254
1576
|
center.x,
|
|
1255
1577
|
center.y
|
|
1256
1578
|
]);
|
|
@@ -1278,7 +1600,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
|
1278
1600
|
}
|
|
1279
1601
|
|
|
1280
1602
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-line.ts
|
|
1281
|
-
import { applyToPoint as
|
|
1603
|
+
import { applyToPoint as applyToPoint16 } from "transformation-matrix";
|
|
1282
1604
|
function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
1283
1605
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1284
1606
|
const {
|
|
@@ -1295,8 +1617,8 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
|
1295
1617
|
console.error("Invalid coordinates:", { x1, y1, x2, y2 });
|
|
1296
1618
|
return [];
|
|
1297
1619
|
}
|
|
1298
|
-
const [transformedX1, transformedY1] =
|
|
1299
|
-
const [transformedX2, transformedY2] =
|
|
1620
|
+
const [transformedX1, transformedY1] = applyToPoint16(transform, [x1, y1]);
|
|
1621
|
+
const [transformedX2, transformedY2] = applyToPoint16(transform, [x2, y2]);
|
|
1300
1622
|
const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
|
|
1301
1623
|
const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
|
|
1302
1624
|
return [
|
|
@@ -1331,7 +1653,7 @@ function pairs(arr) {
|
|
|
1331
1653
|
}
|
|
1332
1654
|
|
|
1333
1655
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
|
|
1334
|
-
import { applyToPoint as
|
|
1656
|
+
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
1335
1657
|
|
|
1336
1658
|
// lib/pcb/colors.ts
|
|
1337
1659
|
var DEFAULT_PCB_COLOR_MAP = {
|
|
@@ -1387,8 +1709,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
1387
1709
|
const segments = pairs(trace.route);
|
|
1388
1710
|
const svgObjects = [];
|
|
1389
1711
|
for (const [start, end] of segments) {
|
|
1390
|
-
const startPoint =
|
|
1391
|
-
const endPoint =
|
|
1712
|
+
const startPoint = applyToPoint17(transform, [start.x, start.y]);
|
|
1713
|
+
const endPoint = applyToPoint17(transform, [end.x, end.y]);
|
|
1392
1714
|
const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
|
|
1393
1715
|
if (!layer) continue;
|
|
1394
1716
|
if (layerFilter && layer !== layerFilter) continue;
|
|
@@ -1460,7 +1782,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
1460
1782
|
}
|
|
1461
1783
|
|
|
1462
1784
|
// lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
|
|
1463
|
-
import { applyToPoint as
|
|
1785
|
+
import { applyToPoint as applyToPoint18 } from "transformation-matrix";
|
|
1464
1786
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
1465
1787
|
const { transform, layer: layerFilter, colorMap: colorMap2, renderSolderMask } = ctx;
|
|
1466
1788
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
@@ -1470,7 +1792,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1470
1792
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
1471
1793
|
const width = pad.width * Math.abs(transform.a);
|
|
1472
1794
|
const height = pad.height * Math.abs(transform.d);
|
|
1473
|
-
const [x, y] =
|
|
1795
|
+
const [x, y] = applyToPoint18(transform, [pad.x, pad.y]);
|
|
1474
1796
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
1475
1797
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
1476
1798
|
const padElement2 = {
|
|
@@ -1552,7 +1874,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1552
1874
|
const width = pad.width * Math.abs(transform.a);
|
|
1553
1875
|
const height = pad.height * Math.abs(transform.d);
|
|
1554
1876
|
const radius = pad.radius * Math.abs(transform.a);
|
|
1555
|
-
const [x, y] =
|
|
1877
|
+
const [x, y] = applyToPoint18(transform, [pad.x, pad.y]);
|
|
1556
1878
|
const padElement = {
|
|
1557
1879
|
name: "rect",
|
|
1558
1880
|
type: "element",
|
|
@@ -1590,7 +1912,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1590
1912
|
}
|
|
1591
1913
|
if (pad.shape === "circle") {
|
|
1592
1914
|
const radius = pad.radius * Math.abs(transform.a);
|
|
1593
|
-
const [x, y] =
|
|
1915
|
+
const [x, y] = applyToPoint18(transform, [pad.x, pad.y]);
|
|
1594
1916
|
const padElement = {
|
|
1595
1917
|
name: "circle",
|
|
1596
1918
|
type: "element",
|
|
@@ -1625,7 +1947,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1625
1947
|
}
|
|
1626
1948
|
if (pad.shape === "polygon") {
|
|
1627
1949
|
const points = (pad.points ?? []).map(
|
|
1628
|
-
(point) =>
|
|
1950
|
+
(point) => applyToPoint18(transform, [point.x, point.y])
|
|
1629
1951
|
);
|
|
1630
1952
|
const padElement = {
|
|
1631
1953
|
name: "polygon",
|
|
@@ -1661,32 +1983,32 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1661
1983
|
}
|
|
1662
1984
|
|
|
1663
1985
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
|
|
1664
|
-
import { applyToPoint as
|
|
1986
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
1665
1987
|
function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
1666
1988
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1667
1989
|
const { width, height, center, outline } = pcbBoard;
|
|
1668
1990
|
let path;
|
|
1669
1991
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
1670
1992
|
path = outline.map((point, index) => {
|
|
1671
|
-
const [x, y] =
|
|
1993
|
+
const [x, y] = applyToPoint19(transform, [point.x, point.y]);
|
|
1672
1994
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
1673
1995
|
}).join(" ");
|
|
1674
1996
|
} else {
|
|
1675
1997
|
const halfWidth = width / 2;
|
|
1676
1998
|
const halfHeight = height / 2;
|
|
1677
|
-
const topLeft =
|
|
1999
|
+
const topLeft = applyToPoint19(transform, [
|
|
1678
2000
|
center.x - halfWidth,
|
|
1679
2001
|
center.y - halfHeight
|
|
1680
2002
|
]);
|
|
1681
|
-
const topRight =
|
|
2003
|
+
const topRight = applyToPoint19(transform, [
|
|
1682
2004
|
center.x + halfWidth,
|
|
1683
2005
|
center.y - halfHeight
|
|
1684
2006
|
]);
|
|
1685
|
-
const bottomRight =
|
|
2007
|
+
const bottomRight = applyToPoint19(transform, [
|
|
1686
2008
|
center.x + halfWidth,
|
|
1687
2009
|
center.y + halfHeight
|
|
1688
2010
|
]);
|
|
1689
|
-
const bottomLeft =
|
|
2011
|
+
const bottomLeft = applyToPoint19(transform, [
|
|
1690
2012
|
center.x - halfWidth,
|
|
1691
2013
|
center.y + halfHeight
|
|
1692
2014
|
]);
|
|
@@ -1713,10 +2035,10 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
1713
2035
|
}
|
|
1714
2036
|
|
|
1715
2037
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
1716
|
-
import { applyToPoint as
|
|
2038
|
+
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
1717
2039
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
1718
2040
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1719
|
-
const [x, y] =
|
|
2041
|
+
const [x, y] = applyToPoint20(transform, [hole.x, hole.y]);
|
|
1720
2042
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
1721
2043
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
1722
2044
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -1762,10 +2084,10 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
1762
2084
|
}
|
|
1763
2085
|
|
|
1764
2086
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
1765
|
-
import { applyToPoint as
|
|
2087
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
1766
2088
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
1767
2089
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1768
|
-
const [x, y] =
|
|
2090
|
+
const [x, y] = applyToPoint21(transform, [hole.x, hole.y]);
|
|
1769
2091
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
1770
2092
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
1771
2093
|
const radius = scaledDiameter / 2;
|
|
@@ -1839,7 +2161,7 @@ import {
|
|
|
1839
2161
|
getFullConnectivityMapFromCircuitJson
|
|
1840
2162
|
} from "circuit-json-to-connectivity-map";
|
|
1841
2163
|
import "svgson";
|
|
1842
|
-
import { applyToPoint as
|
|
2164
|
+
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
1843
2165
|
|
|
1844
2166
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
1845
2167
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -1919,11 +2241,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
1919
2241
|
});
|
|
1920
2242
|
const svgObjects = [];
|
|
1921
2243
|
for (const line of ratsNestLines) {
|
|
1922
|
-
const transformedStart =
|
|
2244
|
+
const transformedStart = applyToPoint22(transform, [
|
|
1923
2245
|
line.startPoint.x,
|
|
1924
2246
|
line.startPoint.y
|
|
1925
2247
|
]);
|
|
1926
|
-
const transformedEnd =
|
|
2248
|
+
const transformedEnd = applyToPoint22(transform, [
|
|
1927
2249
|
line.endPoint.x,
|
|
1928
2250
|
line.endPoint.y
|
|
1929
2251
|
]);
|
|
@@ -1951,7 +2273,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
1951
2273
|
|
|
1952
2274
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
1953
2275
|
import {
|
|
1954
|
-
applyToPoint as
|
|
2276
|
+
applyToPoint as applyToPoint23,
|
|
1955
2277
|
compose as compose3,
|
|
1956
2278
|
rotate as rotate3,
|
|
1957
2279
|
translate as translate3,
|
|
@@ -1961,7 +2283,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1961
2283
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
1962
2284
|
if (cutout.shape === "rect") {
|
|
1963
2285
|
const rectCutout = cutout;
|
|
1964
|
-
const [cx, cy] =
|
|
2286
|
+
const [cx, cy] = applyToPoint23(transform, [
|
|
1965
2287
|
rectCutout.center.x,
|
|
1966
2288
|
rectCutout.center.y
|
|
1967
2289
|
]);
|
|
@@ -1992,7 +2314,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1992
2314
|
}
|
|
1993
2315
|
if (cutout.shape === "circle") {
|
|
1994
2316
|
const circleCutout = cutout;
|
|
1995
|
-
const [cx, cy] =
|
|
2317
|
+
const [cx, cy] = applyToPoint23(transform, [
|
|
1996
2318
|
circleCutout.center.x,
|
|
1997
2319
|
circleCutout.center.y
|
|
1998
2320
|
]);
|
|
@@ -2019,7 +2341,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2019
2341
|
const polygonCutout = cutout;
|
|
2020
2342
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
2021
2343
|
const transformedPoints = polygonCutout.points.map(
|
|
2022
|
-
(p) =>
|
|
2344
|
+
(p) => applyToPoint23(transform, [p.x, p.y])
|
|
2023
2345
|
);
|
|
2024
2346
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
2025
2347
|
return [
|
|
@@ -2043,7 +2365,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2043
2365
|
|
|
2044
2366
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
2045
2367
|
import {
|
|
2046
|
-
applyToPoint as
|
|
2368
|
+
applyToPoint as applyToPoint25,
|
|
2047
2369
|
compose as compose4,
|
|
2048
2370
|
rotate as rotate4,
|
|
2049
2371
|
toString as matrixToString7,
|
|
@@ -2051,11 +2373,11 @@ import {
|
|
|
2051
2373
|
} from "transformation-matrix";
|
|
2052
2374
|
|
|
2053
2375
|
// lib/utils/ring-to-path-d.ts
|
|
2054
|
-
import { applyToPoint as
|
|
2376
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
2055
2377
|
function ringToPathD(vertices, transform) {
|
|
2056
2378
|
if (vertices.length === 0) return "";
|
|
2057
2379
|
const transformedVertices = vertices.map((v) => {
|
|
2058
|
-
const [x, y] =
|
|
2380
|
+
const [x, y] = applyToPoint24(transform, [v.x, v.y]);
|
|
2059
2381
|
return { ...v, x, y };
|
|
2060
2382
|
});
|
|
2061
2383
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -2088,7 +2410,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
2088
2410
|
const color = layerNameToColor(layer, colorMap2);
|
|
2089
2411
|
const opacity = "0.5";
|
|
2090
2412
|
if (pour.shape === "rect") {
|
|
2091
|
-
const [cx, cy] =
|
|
2413
|
+
const [cx, cy] = applyToPoint25(transform, [pour.center.x, pour.center.y]);
|
|
2092
2414
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
2093
2415
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
2094
2416
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -2118,7 +2440,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
2118
2440
|
if (pour.shape === "polygon") {
|
|
2119
2441
|
if (!pour.points || pour.points.length === 0) return [];
|
|
2120
2442
|
const transformedPoints = pour.points.map(
|
|
2121
|
-
(p) =>
|
|
2443
|
+
(p) => applyToPoint25(transform, [p.x, p.y])
|
|
2122
2444
|
);
|
|
2123
2445
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
2124
2446
|
return [
|
|
@@ -2303,11 +2625,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
2303
2625
|
}
|
|
2304
2626
|
|
|
2305
2627
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
2306
|
-
import { applyToPoint as
|
|
2628
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
2307
2629
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
2308
2630
|
const { transform } = ctx;
|
|
2309
2631
|
const { center, width, height, rotation = 0 } = component;
|
|
2310
|
-
const [x, y] =
|
|
2632
|
+
const [x, y] = applyToPoint26(transform, [center.x, center.y]);
|
|
2311
2633
|
const scaledWidth = width * Math.abs(transform.a);
|
|
2312
2634
|
const scaledHeight = height * Math.abs(transform.d);
|
|
2313
2635
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -2357,7 +2679,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
2357
2679
|
var package_default = {
|
|
2358
2680
|
name: "circuit-to-svg",
|
|
2359
2681
|
type: "module",
|
|
2360
|
-
version: "0.0.
|
|
2682
|
+
version: "0.0.232",
|
|
2361
2683
|
description: "Convert Circuit JSON to SVG",
|
|
2362
2684
|
main: "dist/index.js",
|
|
2363
2685
|
files: [
|
|
@@ -2426,7 +2748,12 @@ var TYPE_PRIORITY = {
|
|
|
2426
2748
|
pcb_component: 60,
|
|
2427
2749
|
pcb_fabrication_note_text: 70,
|
|
2428
2750
|
pcb_fabrication_note_path: 70,
|
|
2751
|
+
pcb_fabrication_note_rect: 70,
|
|
2429
2752
|
pcb_note_dimension: 70,
|
|
2753
|
+
pcb_note_text: 70,
|
|
2754
|
+
pcb_note_rect: 70,
|
|
2755
|
+
pcb_note_path: 70,
|
|
2756
|
+
pcb_note_line: 70,
|
|
2430
2757
|
pcb_trace_error: 80,
|
|
2431
2758
|
pcb_rats_nest: 85
|
|
2432
2759
|
};
|
|
@@ -2543,6 +2870,12 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
2543
2870
|
}
|
|
2544
2871
|
} else if ("route" in circuitJsonElm) {
|
|
2545
2872
|
updateTraceBounds(circuitJsonElm.route);
|
|
2873
|
+
} else if (circuitJsonElm.type === "pcb_note_rect" || circuitJsonElm.type === "pcb_fabrication_note_rect") {
|
|
2874
|
+
updateBounds(
|
|
2875
|
+
circuitJsonElm.center,
|
|
2876
|
+
circuitJsonElm.width,
|
|
2877
|
+
circuitJsonElm.height
|
|
2878
|
+
);
|
|
2546
2879
|
} else if (circuitJsonElm.type === "pcb_silkscreen_text" || circuitJsonElm.type === "pcb_silkscreen_rect" || circuitJsonElm.type === "pcb_silkscreen_circle" || circuitJsonElm.type === "pcb_silkscreen_line") {
|
|
2547
2880
|
updateSilkscreenBounds(circuitJsonElm);
|
|
2548
2881
|
} else if (circuitJsonElm.type === "pcb_copper_pour") {
|
|
@@ -2801,8 +3134,18 @@ function createSvgObjects({
|
|
|
2801
3134
|
return createSvgObjectsFromPcbFabricationNotePath(elm, ctx);
|
|
2802
3135
|
case "pcb_fabrication_note_text":
|
|
2803
3136
|
return createSvgObjectsFromPcbFabricationNoteText(elm, ctx);
|
|
3137
|
+
case "pcb_fabrication_note_rect":
|
|
3138
|
+
return createSvgObjectsFromPcbFabricationNoteRect(elm, ctx);
|
|
2804
3139
|
case "pcb_note_dimension":
|
|
2805
3140
|
return createSvgObjectsFromPcbNoteDimension(elm, ctx);
|
|
3141
|
+
case "pcb_note_text":
|
|
3142
|
+
return createSvgObjectsFromPcbNoteText(elm, ctx);
|
|
3143
|
+
case "pcb_note_rect":
|
|
3144
|
+
return createSvgObjectsFromPcbNoteRect(elm, ctx);
|
|
3145
|
+
case "pcb_note_path":
|
|
3146
|
+
return createSvgObjectsFromPcbNotePath(elm, ctx);
|
|
3147
|
+
case "pcb_note_line":
|
|
3148
|
+
return createSvgObjectsFromPcbNoteLine(elm, ctx);
|
|
2806
3149
|
case "pcb_silkscreen_path":
|
|
2807
3150
|
return createSvgObjectsFromPcbSilkscreenPath(elm, ctx);
|
|
2808
3151
|
case "pcb_board":
|
|
@@ -2816,8 +3159,8 @@ function createSvgObjects({
|
|
|
2816
3159
|
}
|
|
2817
3160
|
}
|
|
2818
3161
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
2819
|
-
const [x1, y1] =
|
|
2820
|
-
const [x2, y2] =
|
|
3162
|
+
const [x1, y1] = applyToPoint27(transform, [minX, minY]);
|
|
3163
|
+
const [x2, y2] = applyToPoint27(transform, [maxX, maxY]);
|
|
2821
3164
|
const width = Math.abs(x2 - x1);
|
|
2822
3165
|
const height = Math.abs(y2 - y1);
|
|
2823
3166
|
const x = Math.min(x1, x2);
|
|
@@ -2847,14 +3190,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
2847
3190
|
import { stringify as stringify2 } from "svgson";
|
|
2848
3191
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
2849
3192
|
import {
|
|
2850
|
-
applyToPoint as
|
|
3193
|
+
applyToPoint as applyToPoint34,
|
|
2851
3194
|
compose as compose6,
|
|
2852
3195
|
scale as scale3,
|
|
2853
3196
|
translate as translate6
|
|
2854
3197
|
} from "transformation-matrix";
|
|
2855
3198
|
|
|
2856
3199
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
2857
|
-
import { applyToPoint as
|
|
3200
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
2858
3201
|
var DEFAULT_BOARD_STYLE = {
|
|
2859
3202
|
fill: "none",
|
|
2860
3203
|
stroke: "rgb(0,0,0)",
|
|
@@ -2866,25 +3209,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
2866
3209
|
let path;
|
|
2867
3210
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
2868
3211
|
path = outline.map((point, index) => {
|
|
2869
|
-
const [x, y] =
|
|
3212
|
+
const [x, y] = applyToPoint28(transform, [point.x, point.y]);
|
|
2870
3213
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
2871
3214
|
}).join(" ");
|
|
2872
3215
|
} else {
|
|
2873
3216
|
const halfWidth = width / 2;
|
|
2874
3217
|
const halfHeight = height / 2;
|
|
2875
|
-
const topLeft =
|
|
3218
|
+
const topLeft = applyToPoint28(transform, [
|
|
2876
3219
|
center.x - halfWidth,
|
|
2877
3220
|
center.y - halfHeight
|
|
2878
3221
|
]);
|
|
2879
|
-
const topRight =
|
|
3222
|
+
const topRight = applyToPoint28(transform, [
|
|
2880
3223
|
center.x + halfWidth,
|
|
2881
3224
|
center.y - halfHeight
|
|
2882
3225
|
]);
|
|
2883
|
-
const bottomRight =
|
|
3226
|
+
const bottomRight = applyToPoint28(transform, [
|
|
2884
3227
|
center.x + halfWidth,
|
|
2885
3228
|
center.y + halfHeight
|
|
2886
3229
|
]);
|
|
2887
|
-
const bottomLeft =
|
|
3230
|
+
const bottomLeft = applyToPoint28(transform, [
|
|
2888
3231
|
center.x - halfWidth,
|
|
2889
3232
|
center.y + halfHeight
|
|
2890
3233
|
]);
|
|
@@ -2910,7 +3253,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
2910
3253
|
}
|
|
2911
3254
|
|
|
2912
3255
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
2913
|
-
import { applyToPoint as
|
|
3256
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
2914
3257
|
|
|
2915
3258
|
// lib/utils/get-sch-font-size.ts
|
|
2916
3259
|
import "transformation-matrix";
|
|
@@ -2936,8 +3279,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
2936
3279
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
2937
3280
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
2938
3281
|
return null;
|
|
2939
|
-
const [x, y] =
|
|
2940
|
-
const [pinX, pinY] =
|
|
3282
|
+
const [x, y] = applyToPoint30(transform, [center.x, center.y]);
|
|
3283
|
+
const [pinX, pinY] = applyToPoint30(transform, [portPosition.x, portPosition.y]);
|
|
2941
3284
|
const scaledWidth = width * Math.abs(transform.a);
|
|
2942
3285
|
const scaledHeight = height * Math.abs(transform.d);
|
|
2943
3286
|
const isTopLayer = layer === "top";
|
|
@@ -3099,11 +3442,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
3099
3442
|
}
|
|
3100
3443
|
|
|
3101
3444
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
3102
|
-
import { applyToPoint as
|
|
3445
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
3103
3446
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
3104
3447
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
3105
3448
|
const { transform } = ctx;
|
|
3106
|
-
const [x, y] =
|
|
3449
|
+
const [x, y] = applyToPoint31(transform, [hole.x, hole.y]);
|
|
3107
3450
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
3108
3451
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
3109
3452
|
const radius = scaledDiameter / 2;
|
|
@@ -3167,12 +3510,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
3167
3510
|
}
|
|
3168
3511
|
|
|
3169
3512
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
3170
|
-
import { applyToPoint as
|
|
3513
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
3171
3514
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
3172
3515
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
3173
3516
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
3174
3517
|
const { transform } = ctx;
|
|
3175
|
-
const [x, y] =
|
|
3518
|
+
const [x, y] = applyToPoint32(transform, [hole.x, hole.y]);
|
|
3176
3519
|
if (hole.shape === "pill") {
|
|
3177
3520
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
3178
3521
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -3267,7 +3610,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3267
3610
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
3268
3611
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
3269
3612
|
const holeRadius = scaledHoleDiameter / 2;
|
|
3270
|
-
const [holeCx, holeCy] =
|
|
3613
|
+
const [holeCx, holeCy] = applyToPoint32(transform, [
|
|
3271
3614
|
circularHole.x + circularHole.hole_offset_x,
|
|
3272
3615
|
circularHole.y + circularHole.hole_offset_y
|
|
3273
3616
|
]);
|
|
@@ -3325,7 +3668,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3325
3668
|
const pillHoleWithOffsets = pillHole;
|
|
3326
3669
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
3327
3670
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
3328
|
-
const [holeCenterX, holeCenterY] =
|
|
3671
|
+
const [holeCenterX, holeCenterY] = applyToPoint32(transform, [
|
|
3329
3672
|
pillHole.x + holeOffsetX,
|
|
3330
3673
|
pillHole.y + holeOffsetY
|
|
3331
3674
|
]);
|
|
@@ -3387,7 +3730,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3387
3730
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
3388
3731
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
3389
3732
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
3390
|
-
const [holeCenterX, holeCenterY] =
|
|
3733
|
+
const [holeCenterX, holeCenterY] = applyToPoint32(transform, [
|
|
3391
3734
|
rotatedHole.x + holeOffsetX,
|
|
3392
3735
|
rotatedHole.y + holeOffsetY
|
|
3393
3736
|
]);
|
|
@@ -3443,14 +3786,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
3443
3786
|
}
|
|
3444
3787
|
|
|
3445
3788
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
3446
|
-
import { applyToPoint as
|
|
3789
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
3447
3790
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
3448
3791
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
3449
3792
|
const { transform } = ctx;
|
|
3450
3793
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
3451
3794
|
const width = pad.width * Math.abs(transform.a);
|
|
3452
3795
|
const height = pad.height * Math.abs(transform.d);
|
|
3453
|
-
const [x, y] =
|
|
3796
|
+
const [x, y] = applyToPoint33(transform, [pad.x, pad.y]);
|
|
3454
3797
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
3455
3798
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
3456
3799
|
return [
|
|
@@ -3502,7 +3845,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3502
3845
|
const width = pad.width * Math.abs(transform.a);
|
|
3503
3846
|
const height = pad.height * Math.abs(transform.d);
|
|
3504
3847
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3505
|
-
const [x, y] =
|
|
3848
|
+
const [x, y] = applyToPoint33(transform, [pad.x, pad.y]);
|
|
3506
3849
|
return [
|
|
3507
3850
|
{
|
|
3508
3851
|
name: "rect",
|
|
@@ -3525,7 +3868,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3525
3868
|
}
|
|
3526
3869
|
if (pad.shape === "circle") {
|
|
3527
3870
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3528
|
-
const [x, y] =
|
|
3871
|
+
const [x, y] = applyToPoint33(transform, [pad.x, pad.y]);
|
|
3529
3872
|
return [
|
|
3530
3873
|
{
|
|
3531
3874
|
name: "circle",
|
|
@@ -3545,7 +3888,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
3545
3888
|
}
|
|
3546
3889
|
if (pad.shape === "polygon") {
|
|
3547
3890
|
const points = (pad.points ?? []).map(
|
|
3548
|
-
(point) =>
|
|
3891
|
+
(point) => applyToPoint33(transform, [point.x, point.y])
|
|
3549
3892
|
);
|
|
3550
3893
|
return [
|
|
3551
3894
|
{
|
|
@@ -3722,8 +4065,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
3722
4065
|
}
|
|
3723
4066
|
}
|
|
3724
4067
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
3725
|
-
const [x1, y1] =
|
|
3726
|
-
const [x2, y2] =
|
|
4068
|
+
const [x1, y1] = applyToPoint34(transform, [minX, minY]);
|
|
4069
|
+
const [x2, y2] = applyToPoint34(transform, [maxX, maxY]);
|
|
3727
4070
|
const width = Math.abs(x2 - x1);
|
|
3728
4071
|
const height = Math.abs(y2 - y1);
|
|
3729
4072
|
const x = Math.min(x1, x2);
|
|
@@ -3752,7 +4095,7 @@ import {
|
|
|
3752
4095
|
} from "transformation-matrix";
|
|
3753
4096
|
|
|
3754
4097
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
3755
|
-
import { applyToPoint as
|
|
4098
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
3756
4099
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
3757
4100
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
3758
4101
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -3762,25 +4105,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3762
4105
|
let path;
|
|
3763
4106
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
3764
4107
|
path = outline.map((point, index) => {
|
|
3765
|
-
const [x, y] =
|
|
4108
|
+
const [x, y] = applyToPoint35(transform, [point.x, point.y]);
|
|
3766
4109
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3767
4110
|
}).join(" ");
|
|
3768
4111
|
} else {
|
|
3769
4112
|
const halfWidth = width / 2;
|
|
3770
4113
|
const halfHeight = height / 2;
|
|
3771
|
-
const topLeft =
|
|
4114
|
+
const topLeft = applyToPoint35(transform, [
|
|
3772
4115
|
center.x - halfWidth,
|
|
3773
4116
|
center.y - halfHeight
|
|
3774
4117
|
]);
|
|
3775
|
-
const topRight =
|
|
4118
|
+
const topRight = applyToPoint35(transform, [
|
|
3776
4119
|
center.x + halfWidth,
|
|
3777
4120
|
center.y - halfHeight
|
|
3778
4121
|
]);
|
|
3779
|
-
const bottomRight =
|
|
4122
|
+
const bottomRight = applyToPoint35(transform, [
|
|
3780
4123
|
center.x + halfWidth,
|
|
3781
4124
|
center.y + halfHeight
|
|
3782
4125
|
]);
|
|
3783
|
-
const bottomLeft =
|
|
4126
|
+
const bottomLeft = applyToPoint35(transform, [
|
|
3784
4127
|
center.x - halfWidth,
|
|
3785
4128
|
center.y + halfHeight
|
|
3786
4129
|
]);
|
|
@@ -3798,10 +4141,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3798
4141
|
const halfWidth = width2 / 2;
|
|
3799
4142
|
const halfHeight = height2 / 2;
|
|
3800
4143
|
const [tl, tr, br, bl] = [
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
4144
|
+
applyToPoint35(transform, [x - halfWidth, y - halfHeight]),
|
|
4145
|
+
applyToPoint35(transform, [x + halfWidth, y - halfHeight]),
|
|
4146
|
+
applyToPoint35(transform, [x + halfWidth, y + halfHeight]),
|
|
4147
|
+
applyToPoint35(transform, [x - halfWidth, y + halfHeight])
|
|
3805
4148
|
];
|
|
3806
4149
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
3807
4150
|
} else if (cutout.shape === "circle") {
|
|
@@ -3828,7 +4171,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
3828
4171
|
|
|
3829
4172
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
3830
4173
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
3831
|
-
import { applyToPoint as
|
|
4174
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
3832
4175
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
3833
4176
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
3834
4177
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -3838,7 +4181,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
3838
4181
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
3839
4182
|
return [];
|
|
3840
4183
|
}
|
|
3841
|
-
const [x, y] =
|
|
4184
|
+
const [x, y] = applyToPoint36(transform, [center.x, center.y]);
|
|
3842
4185
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3843
4186
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3844
4187
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -3899,11 +4242,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
3899
4242
|
}
|
|
3900
4243
|
|
|
3901
4244
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
3902
|
-
import { applyToPoint as
|
|
4245
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
3903
4246
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
3904
4247
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
3905
4248
|
const { transform } = ctx;
|
|
3906
|
-
const [x, y] =
|
|
4249
|
+
const [x, y] = applyToPoint37(transform, [hole.x, hole.y]);
|
|
3907
4250
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
3908
4251
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
3909
4252
|
const radius = scaledDiameter / 2;
|
|
@@ -3967,12 +4310,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
3967
4310
|
}
|
|
3968
4311
|
|
|
3969
4312
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
3970
|
-
import { applyToPoint as
|
|
4313
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
3971
4314
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
3972
4315
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
3973
4316
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
3974
4317
|
const { transform } = ctx;
|
|
3975
|
-
const [x, y] =
|
|
4318
|
+
const [x, y] = applyToPoint38(transform, [hole.x, hole.y]);
|
|
3976
4319
|
if (hole.shape === "pill") {
|
|
3977
4320
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
3978
4321
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -4207,14 +4550,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
4207
4550
|
}
|
|
4208
4551
|
|
|
4209
4552
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
4210
|
-
import { applyToPoint as
|
|
4553
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
4211
4554
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
4212
4555
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
4213
4556
|
const { transform } = ctx;
|
|
4214
4557
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
4215
4558
|
const width = pad.width * Math.abs(transform.a);
|
|
4216
4559
|
const height = pad.height * Math.abs(transform.d);
|
|
4217
|
-
const [x, y] =
|
|
4560
|
+
const [x, y] = applyToPoint39(transform, [pad.x, pad.y]);
|
|
4218
4561
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
4219
4562
|
return [
|
|
4220
4563
|
{
|
|
@@ -4257,7 +4600,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4257
4600
|
const width = pad.width * Math.abs(transform.a);
|
|
4258
4601
|
const height = pad.height * Math.abs(transform.d);
|
|
4259
4602
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4260
|
-
const [x, y] =
|
|
4603
|
+
const [x, y] = applyToPoint39(transform, [pad.x, pad.y]);
|
|
4261
4604
|
return [
|
|
4262
4605
|
{
|
|
4263
4606
|
name: "rect",
|
|
@@ -4280,7 +4623,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4280
4623
|
}
|
|
4281
4624
|
if (pad.shape === "circle") {
|
|
4282
4625
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4283
|
-
const [x, y] =
|
|
4626
|
+
const [x, y] = applyToPoint39(transform, [pad.x, pad.y]);
|
|
4284
4627
|
return [
|
|
4285
4628
|
{
|
|
4286
4629
|
name: "circle",
|
|
@@ -4300,7 +4643,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4300
4643
|
}
|
|
4301
4644
|
if (pad.shape === "polygon") {
|
|
4302
4645
|
const points = (pad.points ?? []).map(
|
|
4303
|
-
(point) =>
|
|
4646
|
+
(point) => applyToPoint39(transform, [point.x, point.y])
|
|
4304
4647
|
);
|
|
4305
4648
|
return [
|
|
4306
4649
|
{
|
|
@@ -4321,7 +4664,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
4321
4664
|
}
|
|
4322
4665
|
|
|
4323
4666
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
4324
|
-
import { applyToPoint as
|
|
4667
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
4325
4668
|
import { calculateElbow } from "calculate-elbow";
|
|
4326
4669
|
|
|
4327
4670
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -4398,7 +4741,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
4398
4741
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
4399
4742
|
if (!label_info) return [];
|
|
4400
4743
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
4401
|
-
const [port_x, port_y] =
|
|
4744
|
+
const [port_x, port_y] = applyToPoint40(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
4402
4745
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
4403
4746
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
4404
4747
|
const elbow_path = calculateElbow(
|
|
@@ -4539,7 +4882,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
4539
4882
|
}
|
|
4540
4883
|
|
|
4541
4884
|
// lib/pinout/calculate-label-positions.ts
|
|
4542
|
-
import { applyToPoint as
|
|
4885
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
4543
4886
|
|
|
4544
4887
|
// lib/pinout/constants.ts
|
|
4545
4888
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -4577,7 +4920,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4577
4920
|
);
|
|
4578
4921
|
const mapToEdgePort = (pinout_label) => ({
|
|
4579
4922
|
pcb_port: pinout_label.pcb_port,
|
|
4580
|
-
y:
|
|
4923
|
+
y: applyToPoint41(transform, [
|
|
4581
4924
|
pinout_label.pcb_port.x,
|
|
4582
4925
|
pinout_label.pcb_port.y
|
|
4583
4926
|
])[1],
|
|
@@ -4592,7 +4935,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4592
4935
|
} else {
|
|
4593
4936
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
4594
4937
|
pcb_port: pinout_label.pcb_port,
|
|
4595
|
-
y:
|
|
4938
|
+
y: applyToPoint41(transform, [
|
|
4596
4939
|
pinout_label.pcb_port.x,
|
|
4597
4940
|
pinout_label.pcb_port.y
|
|
4598
4941
|
])[1],
|
|
@@ -4600,7 +4943,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
4600
4943
|
})).sort((a, b) => a.y - b.y);
|
|
4601
4944
|
}
|
|
4602
4945
|
if (edge_ports.length === 0) return;
|
|
4603
|
-
const board_edge_x =
|
|
4946
|
+
const board_edge_x = applyToPoint41(transform, [
|
|
4604
4947
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
4605
4948
|
0
|
|
4606
4949
|
])[0];
|
|
@@ -5249,14 +5592,14 @@ import {
|
|
|
5249
5592
|
} from "transformation-matrix";
|
|
5250
5593
|
|
|
5251
5594
|
// lib/sch/draw-schematic-grid.ts
|
|
5252
|
-
import { applyToPoint as
|
|
5595
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
5253
5596
|
function drawSchematicGrid(params) {
|
|
5254
5597
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
5255
5598
|
const cellSize = params.cellSize ?? 1;
|
|
5256
5599
|
const labelCells = params.labelCells ?? false;
|
|
5257
5600
|
const gridLines = [];
|
|
5258
5601
|
const transformPoint = (x, y) => {
|
|
5259
|
-
const [transformedX, transformedY] =
|
|
5602
|
+
const [transformedX, transformedY] = applyToPoint42(params.transform, [x, y]);
|
|
5260
5603
|
return { x: transformedX, y: transformedY };
|
|
5261
5604
|
};
|
|
5262
5605
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -5337,15 +5680,15 @@ function drawSchematicGrid(params) {
|
|
|
5337
5680
|
}
|
|
5338
5681
|
|
|
5339
5682
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
5340
|
-
import { applyToPoint as
|
|
5683
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
5341
5684
|
function drawSchematicLabeledPoints(params) {
|
|
5342
5685
|
const { points, transform } = params;
|
|
5343
5686
|
const labeledPointsGroup = [];
|
|
5344
5687
|
for (const point of points) {
|
|
5345
|
-
const [x1, y1] =
|
|
5346
|
-
const [x2, y2] =
|
|
5347
|
-
const [x3, y3] =
|
|
5348
|
-
const [x4, y4] =
|
|
5688
|
+
const [x1, y1] = applyToPoint43(transform, [point.x - 0.1, point.y - 0.1]);
|
|
5689
|
+
const [x2, y2] = applyToPoint43(transform, [point.x + 0.1, point.y + 0.1]);
|
|
5690
|
+
const [x3, y3] = applyToPoint43(transform, [point.x - 0.1, point.y + 0.1]);
|
|
5691
|
+
const [x4, y4] = applyToPoint43(transform, [point.x + 0.1, point.y - 0.1]);
|
|
5349
5692
|
labeledPointsGroup.push({
|
|
5350
5693
|
name: "path",
|
|
5351
5694
|
type: "element",
|
|
@@ -5356,7 +5699,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
5356
5699
|
"stroke-opacity": "0.7"
|
|
5357
5700
|
}
|
|
5358
5701
|
});
|
|
5359
|
-
const [labelX, labelY] =
|
|
5702
|
+
const [labelX, labelY] = applyToPoint43(transform, [
|
|
5360
5703
|
point.x + 0.15,
|
|
5361
5704
|
point.y - 0.15
|
|
5362
5705
|
]);
|
|
@@ -6450,7 +6793,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
6450
6793
|
import { symbols } from "schematic-symbols";
|
|
6451
6794
|
import "svgson";
|
|
6452
6795
|
import {
|
|
6453
|
-
applyToPoint as
|
|
6796
|
+
applyToPoint as applyToPoint45,
|
|
6454
6797
|
compose as compose9
|
|
6455
6798
|
} from "transformation-matrix";
|
|
6456
6799
|
|
|
@@ -6534,13 +6877,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
6534
6877
|
}
|
|
6535
6878
|
|
|
6536
6879
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
6537
|
-
import { applyToPoint as
|
|
6880
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
6538
6881
|
var createSvgSchErrorText = ({
|
|
6539
6882
|
text,
|
|
6540
6883
|
realCenter,
|
|
6541
6884
|
realToScreenTransform
|
|
6542
6885
|
}) => {
|
|
6543
|
-
const screenCenter =
|
|
6886
|
+
const screenCenter = applyToPoint44(realToScreenTransform, realCenter);
|
|
6544
6887
|
return {
|
|
6545
6888
|
type: "element",
|
|
6546
6889
|
name: "text",
|
|
@@ -6649,11 +6992,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6649
6992
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
6650
6993
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
6651
6994
|
};
|
|
6652
|
-
const [screenMinX, screenMinY] =
|
|
6995
|
+
const [screenMinX, screenMinY] = applyToPoint45(
|
|
6653
6996
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6654
6997
|
[bounds.minX, bounds.minY]
|
|
6655
6998
|
);
|
|
6656
|
-
const [screenMaxX, screenMaxY] =
|
|
6999
|
+
const [screenMaxX, screenMaxY] = applyToPoint45(
|
|
6657
7000
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6658
7001
|
[bounds.maxX, bounds.maxY]
|
|
6659
7002
|
);
|
|
@@ -6682,7 +7025,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6682
7025
|
name: "path",
|
|
6683
7026
|
attributes: {
|
|
6684
7027
|
d: points.map((p, i) => {
|
|
6685
|
-
const [x, y] =
|
|
7028
|
+
const [x, y] = applyToPoint45(
|
|
6686
7029
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6687
7030
|
[p.x, p.y]
|
|
6688
7031
|
);
|
|
@@ -6698,7 +7041,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6698
7041
|
});
|
|
6699
7042
|
}
|
|
6700
7043
|
for (const text of texts) {
|
|
6701
|
-
const screenTextPos =
|
|
7044
|
+
const screenTextPos = applyToPoint45(
|
|
6702
7045
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6703
7046
|
text
|
|
6704
7047
|
);
|
|
@@ -6750,7 +7093,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6750
7093
|
});
|
|
6751
7094
|
}
|
|
6752
7095
|
for (const box of boxes) {
|
|
6753
|
-
const screenBoxPos =
|
|
7096
|
+
const screenBoxPos = applyToPoint45(
|
|
6754
7097
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6755
7098
|
box
|
|
6756
7099
|
);
|
|
@@ -6774,7 +7117,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6774
7117
|
}
|
|
6775
7118
|
for (const port of symbol.ports) {
|
|
6776
7119
|
if (connectedSymbolPorts.has(port)) continue;
|
|
6777
|
-
const screenPortPos =
|
|
7120
|
+
const screenPortPos = applyToPoint45(
|
|
6778
7121
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6779
7122
|
port
|
|
6780
7123
|
);
|
|
@@ -6794,7 +7137,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6794
7137
|
});
|
|
6795
7138
|
}
|
|
6796
7139
|
for (const circle of circles) {
|
|
6797
|
-
const screenCirclePos =
|
|
7140
|
+
const screenCirclePos = applyToPoint45(
|
|
6798
7141
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
6799
7142
|
circle
|
|
6800
7143
|
);
|
|
@@ -6821,14 +7164,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
6821
7164
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
6822
7165
|
import "schematic-symbols";
|
|
6823
7166
|
import "svgson";
|
|
6824
|
-
import { applyToPoint as
|
|
7167
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
6825
7168
|
|
|
6826
7169
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
6827
7170
|
import "transformation-matrix";
|
|
6828
7171
|
import "@tscircuit/circuit-json-util";
|
|
6829
7172
|
|
|
6830
7173
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
6831
|
-
import { applyToPoint as
|
|
7174
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
6832
7175
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
6833
7176
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
6834
7177
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -6881,8 +7224,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
6881
7224
|
realEdgePos.y += realPinLineLength;
|
|
6882
7225
|
break;
|
|
6883
7226
|
}
|
|
6884
|
-
const screenSchPortPos =
|
|
6885
|
-
const screenRealEdgePos =
|
|
7227
|
+
const screenSchPortPos = applyToPoint46(transform, schPort.center);
|
|
7228
|
+
const screenRealEdgePos = applyToPoint46(transform, realEdgePos);
|
|
6886
7229
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
6887
7230
|
const realLineEnd = { ...schPort.center };
|
|
6888
7231
|
if (!isConnected) {
|
|
@@ -6901,7 +7244,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
6901
7244
|
break;
|
|
6902
7245
|
}
|
|
6903
7246
|
}
|
|
6904
|
-
const screenLineEnd =
|
|
7247
|
+
const screenLineEnd = applyToPoint46(transform, realLineEnd);
|
|
6905
7248
|
svgObjects.push({
|
|
6906
7249
|
name: "line",
|
|
6907
7250
|
type: "element",
|
|
@@ -7022,7 +7365,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7022
7365
|
};
|
|
7023
7366
|
|
|
7024
7367
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
7025
|
-
import { applyToPoint as
|
|
7368
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7026
7369
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
7027
7370
|
const svgObjects = [];
|
|
7028
7371
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -7040,7 +7383,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7040
7383
|
} else {
|
|
7041
7384
|
realPinNumberPos.y += 0.02;
|
|
7042
7385
|
}
|
|
7043
|
-
const screenPinNumberTextPos =
|
|
7386
|
+
const screenPinNumberTextPos = applyToPoint47(transform, realPinNumberPos);
|
|
7044
7387
|
svgObjects.push({
|
|
7045
7388
|
name: "text",
|
|
7046
7389
|
type: "element",
|
|
@@ -7070,7 +7413,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7070
7413
|
};
|
|
7071
7414
|
|
|
7072
7415
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
7073
|
-
import { applyToPoint as
|
|
7416
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7074
7417
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
7075
7418
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
7076
7419
|
const svgObjects = [];
|
|
@@ -7084,7 +7427,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
7084
7427
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
7085
7428
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7086
7429
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7087
|
-
const screenPinNumberTextPos =
|
|
7430
|
+
const screenPinNumberTextPos = applyToPoint48(transform, realPinNumberPos);
|
|
7088
7431
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
7089
7432
|
if (!label) return [];
|
|
7090
7433
|
const isNegated = label.startsWith("N_");
|
|
@@ -7132,13 +7475,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
7132
7475
|
};
|
|
7133
7476
|
|
|
7134
7477
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
7135
|
-
import { applyToPoint as
|
|
7478
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
7136
7479
|
var createSvgSchText = ({
|
|
7137
7480
|
elm,
|
|
7138
7481
|
transform,
|
|
7139
7482
|
colorMap: colorMap2
|
|
7140
7483
|
}) => {
|
|
7141
|
-
const center =
|
|
7484
|
+
const center = applyToPoint50(transform, elm.position);
|
|
7142
7485
|
const textAnchorMap = {
|
|
7143
7486
|
center: "middle",
|
|
7144
7487
|
center_right: "end",
|
|
@@ -7222,11 +7565,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
7222
7565
|
colorMap: colorMap2
|
|
7223
7566
|
}) => {
|
|
7224
7567
|
const svgObjects = [];
|
|
7225
|
-
const componentScreenTopLeft =
|
|
7568
|
+
const componentScreenTopLeft = applyToPoint51(transform, {
|
|
7226
7569
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
7227
7570
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
7228
7571
|
});
|
|
7229
|
-
const componentScreenBottomRight =
|
|
7572
|
+
const componentScreenBottomRight = applyToPoint51(transform, {
|
|
7230
7573
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
7231
7574
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
7232
7575
|
});
|
|
@@ -7312,13 +7655,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
7312
7655
|
}
|
|
7313
7656
|
|
|
7314
7657
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
7315
|
-
import { applyToPoint as
|
|
7658
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
7316
7659
|
function createSvgObjectsFromSchVoltageProbe({
|
|
7317
7660
|
probe,
|
|
7318
7661
|
transform,
|
|
7319
7662
|
colorMap: colorMap2
|
|
7320
7663
|
}) {
|
|
7321
|
-
const [screenX, screenY] =
|
|
7664
|
+
const [screenX, screenY] = applyToPoint52(transform, [
|
|
7322
7665
|
probe.position.x,
|
|
7323
7666
|
probe.position.y
|
|
7324
7667
|
]);
|
|
@@ -7378,17 +7721,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
7378
7721
|
}
|
|
7379
7722
|
|
|
7380
7723
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
7381
|
-
import { applyToPoint as
|
|
7724
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
7382
7725
|
function createSvgObjectsFromSchDebugObject({
|
|
7383
7726
|
debugObject,
|
|
7384
7727
|
transform
|
|
7385
7728
|
}) {
|
|
7386
7729
|
if (debugObject.shape === "rect") {
|
|
7387
|
-
let [screenLeft, screenTop] =
|
|
7730
|
+
let [screenLeft, screenTop] = applyToPoint53(transform, [
|
|
7388
7731
|
debugObject.center.x - debugObject.size.width / 2,
|
|
7389
7732
|
debugObject.center.y - debugObject.size.height / 2
|
|
7390
7733
|
]);
|
|
7391
|
-
let [screenRight, screenBottom] =
|
|
7734
|
+
let [screenRight, screenBottom] = applyToPoint53(transform, [
|
|
7392
7735
|
debugObject.center.x + debugObject.size.width / 2,
|
|
7393
7736
|
debugObject.center.y + debugObject.size.height / 2
|
|
7394
7737
|
]);
|
|
@@ -7398,7 +7741,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7398
7741
|
];
|
|
7399
7742
|
const width = Math.abs(screenRight - screenLeft);
|
|
7400
7743
|
const height = Math.abs(screenBottom - screenTop);
|
|
7401
|
-
const [screenCenterX, screenCenterY] =
|
|
7744
|
+
const [screenCenterX, screenCenterY] = applyToPoint53(transform, [
|
|
7402
7745
|
debugObject.center.x,
|
|
7403
7746
|
debugObject.center.y
|
|
7404
7747
|
]);
|
|
@@ -7444,11 +7787,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7444
7787
|
];
|
|
7445
7788
|
}
|
|
7446
7789
|
if (debugObject.shape === "line") {
|
|
7447
|
-
const [screenStartX, screenStartY] =
|
|
7790
|
+
const [screenStartX, screenStartY] = applyToPoint53(transform, [
|
|
7448
7791
|
debugObject.start.x,
|
|
7449
7792
|
debugObject.start.y
|
|
7450
7793
|
]);
|
|
7451
|
-
const [screenEndX, screenEndY] =
|
|
7794
|
+
const [screenEndX, screenEndY] = applyToPoint53(transform, [
|
|
7452
7795
|
debugObject.end.x,
|
|
7453
7796
|
debugObject.end.y
|
|
7454
7797
|
]);
|
|
@@ -7498,7 +7841,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
7498
7841
|
}
|
|
7499
7842
|
|
|
7500
7843
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
7501
|
-
import { applyToPoint as
|
|
7844
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
7502
7845
|
function createSchematicTrace({
|
|
7503
7846
|
trace,
|
|
7504
7847
|
transform,
|
|
@@ -7512,11 +7855,11 @@ function createSchematicTrace({
|
|
|
7512
7855
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
7513
7856
|
const edge = edges[edgeIndex];
|
|
7514
7857
|
if (edge.is_crossing) continue;
|
|
7515
|
-
const [screenFromX, screenFromY] =
|
|
7858
|
+
const [screenFromX, screenFromY] = applyToPoint54(transform, [
|
|
7516
7859
|
edge.from.x,
|
|
7517
7860
|
edge.from.y
|
|
7518
7861
|
]);
|
|
7519
|
-
const [screenToX, screenToY] =
|
|
7862
|
+
const [screenToX, screenToY] = applyToPoint54(transform, [
|
|
7520
7863
|
edge.to.x,
|
|
7521
7864
|
edge.to.y
|
|
7522
7865
|
]);
|
|
@@ -7560,11 +7903,11 @@ function createSchematicTrace({
|
|
|
7560
7903
|
}
|
|
7561
7904
|
for (const edge of edges) {
|
|
7562
7905
|
if (!edge.is_crossing) continue;
|
|
7563
|
-
const [screenFromX, screenFromY] =
|
|
7906
|
+
const [screenFromX, screenFromY] = applyToPoint54(transform, [
|
|
7564
7907
|
edge.from.x,
|
|
7565
7908
|
edge.from.y
|
|
7566
7909
|
]);
|
|
7567
|
-
const [screenToX, screenToY] =
|
|
7910
|
+
const [screenToX, screenToY] = applyToPoint54(transform, [
|
|
7568
7911
|
edge.to.x,
|
|
7569
7912
|
edge.to.y
|
|
7570
7913
|
]);
|
|
@@ -7608,7 +7951,7 @@ function createSchematicTrace({
|
|
|
7608
7951
|
}
|
|
7609
7952
|
if (trace.junctions) {
|
|
7610
7953
|
for (const junction of trace.junctions) {
|
|
7611
|
-
const [screenX, screenY] =
|
|
7954
|
+
const [screenX, screenY] = applyToPoint54(transform, [
|
|
7612
7955
|
junction.x,
|
|
7613
7956
|
junction.y
|
|
7614
7957
|
]);
|
|
@@ -7663,7 +8006,7 @@ function createSchematicTrace({
|
|
|
7663
8006
|
|
|
7664
8007
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
7665
8008
|
import {
|
|
7666
|
-
applyToPoint as
|
|
8009
|
+
applyToPoint as applyToPoint56,
|
|
7667
8010
|
compose as compose11,
|
|
7668
8011
|
rotate as rotate6,
|
|
7669
8012
|
scale as scale6,
|
|
@@ -7672,7 +8015,7 @@ import {
|
|
|
7672
8015
|
|
|
7673
8016
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
7674
8017
|
import {
|
|
7675
|
-
applyToPoint as
|
|
8018
|
+
applyToPoint as applyToPoint55,
|
|
7676
8019
|
compose as compose10,
|
|
7677
8020
|
rotate as rotate5,
|
|
7678
8021
|
scale as scale5,
|
|
@@ -7747,7 +8090,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7747
8090
|
x: symbolBounds.minX,
|
|
7748
8091
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
7749
8092
|
};
|
|
7750
|
-
const rotatedSymbolEnd =
|
|
8093
|
+
const rotatedSymbolEnd = applyToPoint55(rotationMatrix, symbolEndPoint);
|
|
7751
8094
|
const symbolToRealTransform = compose10(
|
|
7752
8095
|
translate10(
|
|
7753
8096
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -7757,11 +8100,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7757
8100
|
scale5(1)
|
|
7758
8101
|
// Use full symbol size
|
|
7759
8102
|
);
|
|
7760
|
-
const [screenMinX, screenMinY] =
|
|
8103
|
+
const [screenMinX, screenMinY] = applyToPoint55(
|
|
7761
8104
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7762
8105
|
[bounds.minX, bounds.minY]
|
|
7763
8106
|
);
|
|
7764
|
-
const [screenMaxX, screenMaxY] =
|
|
8107
|
+
const [screenMaxX, screenMaxY] = applyToPoint55(
|
|
7765
8108
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7766
8109
|
[bounds.maxX, bounds.maxY]
|
|
7767
8110
|
);
|
|
@@ -7785,7 +8128,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7785
8128
|
});
|
|
7786
8129
|
for (const path of symbolPaths) {
|
|
7787
8130
|
const symbolPath = path.points.map((p, i) => {
|
|
7788
|
-
const [x, y] =
|
|
8131
|
+
const [x, y] = applyToPoint55(
|
|
7789
8132
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7790
8133
|
[p.x, p.y]
|
|
7791
8134
|
);
|
|
@@ -7806,7 +8149,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7806
8149
|
});
|
|
7807
8150
|
}
|
|
7808
8151
|
for (const text of symbolTexts) {
|
|
7809
|
-
const screenTextPos =
|
|
8152
|
+
const screenTextPos = applyToPoint55(
|
|
7810
8153
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7811
8154
|
text
|
|
7812
8155
|
);
|
|
@@ -7848,7 +8191,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7848
8191
|
});
|
|
7849
8192
|
}
|
|
7850
8193
|
for (const box of symbolBoxes) {
|
|
7851
|
-
const screenBoxPos =
|
|
8194
|
+
const screenBoxPos = applyToPoint55(
|
|
7852
8195
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7853
8196
|
box
|
|
7854
8197
|
);
|
|
@@ -7871,7 +8214,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
7871
8214
|
});
|
|
7872
8215
|
}
|
|
7873
8216
|
for (const circle of symbolCircles) {
|
|
7874
|
-
const screenCirclePos =
|
|
8217
|
+
const screenCirclePos = applyToPoint55(
|
|
7875
8218
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
7876
8219
|
circle
|
|
7877
8220
|
);
|
|
@@ -7916,14 +8259,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
7916
8259
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
7917
8260
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
7918
8261
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
7919
|
-
const screenCenter =
|
|
8262
|
+
const screenCenter = applyToPoint56(realToScreenTransform, schNetLabel.center);
|
|
7920
8263
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
7921
8264
|
schNetLabel.anchor_side
|
|
7922
8265
|
);
|
|
7923
8266
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
7924
8267
|
screenTextGrowthVec.y *= -1;
|
|
7925
8268
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
7926
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
8269
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint56(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
7927
8270
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
7928
8271
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
7929
8272
|
};
|
|
@@ -7964,7 +8307,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
7964
8307
|
y: -0.6
|
|
7965
8308
|
}
|
|
7966
8309
|
].map(
|
|
7967
|
-
(fontRelativePoint) =>
|
|
8310
|
+
(fontRelativePoint) => applyToPoint56(
|
|
7968
8311
|
compose11(
|
|
7969
8312
|
realToScreenTransform,
|
|
7970
8313
|
translate11(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -8041,17 +8384,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8041
8384
|
};
|
|
8042
8385
|
|
|
8043
8386
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
8044
|
-
import { applyToPoint as
|
|
8387
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
8045
8388
|
var createSvgObjectsFromSchematicBox = ({
|
|
8046
8389
|
schematicBox,
|
|
8047
8390
|
transform,
|
|
8048
8391
|
colorMap: colorMap2
|
|
8049
8392
|
}) => {
|
|
8050
|
-
const topLeft =
|
|
8393
|
+
const topLeft = applyToPoint57(transform, {
|
|
8051
8394
|
x: schematicBox.x,
|
|
8052
8395
|
y: schematicBox.y
|
|
8053
8396
|
});
|
|
8054
|
-
const bottomRight =
|
|
8397
|
+
const bottomRight = applyToPoint57(transform, {
|
|
8055
8398
|
x: schematicBox.x + schematicBox.width,
|
|
8056
8399
|
y: schematicBox.y + schematicBox.height
|
|
8057
8400
|
});
|
|
@@ -8087,7 +8430,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
8087
8430
|
};
|
|
8088
8431
|
|
|
8089
8432
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
8090
|
-
import { applyToPoint as
|
|
8433
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
8091
8434
|
var createSvgObjectsFromSchematicTable = ({
|
|
8092
8435
|
schematicTable,
|
|
8093
8436
|
transform,
|
|
@@ -8120,11 +8463,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8120
8463
|
const svgObjects = [];
|
|
8121
8464
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
8122
8465
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
8123
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
8466
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint58(transform, [
|
|
8124
8467
|
topLeftX,
|
|
8125
8468
|
topLeftY
|
|
8126
8469
|
]);
|
|
8127
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
8470
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint58(transform, [
|
|
8128
8471
|
topLeftX + totalWidth,
|
|
8129
8472
|
topLeftY - totalHeight
|
|
8130
8473
|
]);
|
|
@@ -8156,8 +8499,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8156
8499
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
8157
8500
|
);
|
|
8158
8501
|
if (!isMerged) {
|
|
8159
|
-
const start =
|
|
8160
|
-
const end =
|
|
8502
|
+
const start = applyToPoint58(transform, { x: currentX, y: segmentStartY });
|
|
8503
|
+
const end = applyToPoint58(transform, { x: currentX, y: segmentEndY });
|
|
8161
8504
|
svgObjects.push({
|
|
8162
8505
|
name: "line",
|
|
8163
8506
|
type: "element",
|
|
@@ -8186,11 +8529,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8186
8529
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
8187
8530
|
);
|
|
8188
8531
|
if (!isMerged) {
|
|
8189
|
-
const start =
|
|
8532
|
+
const start = applyToPoint58(transform, {
|
|
8190
8533
|
x: segmentStartX,
|
|
8191
8534
|
y: currentY
|
|
8192
8535
|
});
|
|
8193
|
-
const end =
|
|
8536
|
+
const end = applyToPoint58(transform, { x: segmentEndX, y: currentY });
|
|
8194
8537
|
svgObjects.push({
|
|
8195
8538
|
name: "line",
|
|
8196
8539
|
type: "element",
|
|
@@ -8232,7 +8575,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8232
8575
|
} else if (vertical_align === "bottom") {
|
|
8233
8576
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
8234
8577
|
}
|
|
8235
|
-
const screenTextAnchorPos =
|
|
8578
|
+
const screenTextAnchorPos = applyToPoint58(transform, realTextAnchorPos);
|
|
8236
8579
|
const fontSize = getSchScreenFontSize(
|
|
8237
8580
|
transform,
|
|
8238
8581
|
"reference_designator",
|
|
@@ -8288,13 +8631,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8288
8631
|
|
|
8289
8632
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
8290
8633
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
8291
|
-
import { applyToPoint as
|
|
8634
|
+
import { applyToPoint as applyToPoint59 } from "transformation-matrix";
|
|
8292
8635
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
8293
8636
|
var createSvgObjectsForSchPortHover = ({
|
|
8294
8637
|
schPort,
|
|
8295
8638
|
transform
|
|
8296
8639
|
}) => {
|
|
8297
|
-
const screenSchPortPos =
|
|
8640
|
+
const screenSchPortPos = applyToPoint59(transform, schPort.center);
|
|
8298
8641
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
8299
8642
|
return [
|
|
8300
8643
|
{
|
|
@@ -8339,14 +8682,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
8339
8682
|
};
|
|
8340
8683
|
|
|
8341
8684
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
8342
|
-
import { applyToPoint as
|
|
8685
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
8343
8686
|
function createSvgObjectsFromSchematicLine({
|
|
8344
8687
|
schLine,
|
|
8345
8688
|
transform,
|
|
8346
8689
|
colorMap: colorMap2
|
|
8347
8690
|
}) {
|
|
8348
|
-
const p1 =
|
|
8349
|
-
const p2 =
|
|
8691
|
+
const p1 = applyToPoint60(transform, { x: schLine.x1, y: schLine.y1 });
|
|
8692
|
+
const p2 = applyToPoint60(transform, { x: schLine.x2, y: schLine.y2 });
|
|
8350
8693
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
8351
8694
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
8352
8695
|
return [
|
|
@@ -8375,13 +8718,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
8375
8718
|
}
|
|
8376
8719
|
|
|
8377
8720
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
8378
|
-
import { applyToPoint as
|
|
8721
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
8379
8722
|
function createSvgObjectsFromSchematicCircle({
|
|
8380
8723
|
schCircle,
|
|
8381
8724
|
transform,
|
|
8382
8725
|
colorMap: colorMap2
|
|
8383
8726
|
}) {
|
|
8384
|
-
const center =
|
|
8727
|
+
const center = applyToPoint61(transform, schCircle.center);
|
|
8385
8728
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
8386
8729
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
8387
8730
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -8411,13 +8754,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
8411
8754
|
}
|
|
8412
8755
|
|
|
8413
8756
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
8414
|
-
import { applyToPoint as
|
|
8757
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
8415
8758
|
function createSvgObjectsFromSchematicRect({
|
|
8416
8759
|
schRect,
|
|
8417
8760
|
transform,
|
|
8418
8761
|
colorMap: colorMap2
|
|
8419
8762
|
}) {
|
|
8420
|
-
const center =
|
|
8763
|
+
const center = applyToPoint62(transform, schRect.center);
|
|
8421
8764
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
8422
8765
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
8423
8766
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -8453,13 +8796,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
8453
8796
|
}
|
|
8454
8797
|
|
|
8455
8798
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
8456
|
-
import { applyToPoint as
|
|
8799
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
8457
8800
|
function createSvgObjectsFromSchematicArc({
|
|
8458
8801
|
schArc,
|
|
8459
8802
|
transform,
|
|
8460
8803
|
colorMap: colorMap2
|
|
8461
8804
|
}) {
|
|
8462
|
-
const center =
|
|
8805
|
+
const center = applyToPoint63(transform, schArc.center);
|
|
8463
8806
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
8464
8807
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
8465
8808
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -9491,18 +9834,18 @@ function formatNumber2(value) {
|
|
|
9491
9834
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
9492
9835
|
import { stringify as stringify7 } from "svgson";
|
|
9493
9836
|
import {
|
|
9494
|
-
applyToPoint as
|
|
9837
|
+
applyToPoint as applyToPoint66,
|
|
9495
9838
|
compose as compose14,
|
|
9496
9839
|
scale as scale8,
|
|
9497
9840
|
translate as translate14
|
|
9498
9841
|
} from "transformation-matrix";
|
|
9499
9842
|
|
|
9500
9843
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
9501
|
-
import { applyToPoint as
|
|
9844
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
9502
9845
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
9503
9846
|
const { transform, layer: layerFilter } = ctx;
|
|
9504
9847
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
9505
|
-
const [x, y] =
|
|
9848
|
+
const [x, y] = applyToPoint65(transform, [solderPaste.x, solderPaste.y]);
|
|
9506
9849
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
9507
9850
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
9508
9851
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -9713,8 +10056,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
9713
10056
|
}
|
|
9714
10057
|
}
|
|
9715
10058
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
9716
|
-
const [x1, y1] =
|
|
9717
|
-
const [x2, y2] =
|
|
10059
|
+
const [x1, y1] = applyToPoint66(transform, [minX, minY]);
|
|
10060
|
+
const [x2, y2] = applyToPoint66(transform, [maxX, maxY]);
|
|
9718
10061
|
const width = Math.abs(x2 - x1);
|
|
9719
10062
|
const height = Math.abs(y2 - y1);
|
|
9720
10063
|
const x = Math.min(x1, x2);
|