circuit-to-svg 0.0.250 → 0.0.251
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.d.ts +4 -0
- package/dist/index.js +238 -181
- 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 applyToPoint31,
|
|
5
5
|
compose as compose5,
|
|
6
6
|
scale as scale2,
|
|
7
7
|
translate as translate5
|
|
@@ -2074,6 +2074,57 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
|
2074
2074
|
];
|
|
2075
2075
|
}
|
|
2076
2076
|
|
|
2077
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-courtyard-rect.ts
|
|
2078
|
+
import { applyToPoint as applyToPoint18 } from "transformation-matrix";
|
|
2079
|
+
function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
|
|
2080
|
+
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
2081
|
+
const {
|
|
2082
|
+
center,
|
|
2083
|
+
width,
|
|
2084
|
+
height,
|
|
2085
|
+
layer = "top",
|
|
2086
|
+
pcb_courtyard_rect_id
|
|
2087
|
+
} = pcbCourtyardRect;
|
|
2088
|
+
if (layerFilter && layer !== layerFilter) return [];
|
|
2089
|
+
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
2090
|
+
console.error("Invalid courtyard rectangle data:", {
|
|
2091
|
+
center,
|
|
2092
|
+
width,
|
|
2093
|
+
height
|
|
2094
|
+
});
|
|
2095
|
+
return [];
|
|
2096
|
+
}
|
|
2097
|
+
const [transformedX, transformedY] = applyToPoint18(transform, [
|
|
2098
|
+
center.x,
|
|
2099
|
+
center.y
|
|
2100
|
+
]);
|
|
2101
|
+
const transformedWidth = width * Math.abs(transform.a);
|
|
2102
|
+
const transformedHeight = height * Math.abs(transform.d);
|
|
2103
|
+
const transformedStrokeWidth = 0.05 * Math.abs(transform.a);
|
|
2104
|
+
const color = colorMap2.courtyard;
|
|
2105
|
+
const attributes = {
|
|
2106
|
+
x: (transformedX - transformedWidth / 2).toString(),
|
|
2107
|
+
y: (transformedY - transformedHeight / 2).toString(),
|
|
2108
|
+
width: transformedWidth.toString(),
|
|
2109
|
+
height: transformedHeight.toString(),
|
|
2110
|
+
class: `pcb-courtyard-rect pcb-courtyard-${layer}`,
|
|
2111
|
+
"data-pcb-courtyard-rect-id": pcb_courtyard_rect_id,
|
|
2112
|
+
"data-type": "pcb_courtyard_rect",
|
|
2113
|
+
"data-pcb-layer": layer
|
|
2114
|
+
};
|
|
2115
|
+
attributes.fill = "none";
|
|
2116
|
+
attributes.stroke = color;
|
|
2117
|
+
attributes["stroke-width"] = transformedStrokeWidth.toString();
|
|
2118
|
+
const svgObject = {
|
|
2119
|
+
name: "rect",
|
|
2120
|
+
type: "element",
|
|
2121
|
+
attributes,
|
|
2122
|
+
value: "",
|
|
2123
|
+
children: []
|
|
2124
|
+
};
|
|
2125
|
+
return [svgObject];
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2077
2128
|
// lib/utils/pairs.ts
|
|
2078
2129
|
function pairs(arr) {
|
|
2079
2130
|
const result = [];
|
|
@@ -2084,7 +2135,7 @@ function pairs(arr) {
|
|
|
2084
2135
|
}
|
|
2085
2136
|
|
|
2086
2137
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
|
|
2087
|
-
import { applyToPoint as
|
|
2138
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
2088
2139
|
|
|
2089
2140
|
// lib/pcb/colors.ts
|
|
2090
2141
|
var DEFAULT_PCB_COLOR_MAP = {
|
|
@@ -2108,6 +2159,7 @@ var DEFAULT_PCB_COLOR_MAP = {
|
|
|
2108
2159
|
bottom: "#5da9e9"
|
|
2109
2160
|
},
|
|
2110
2161
|
boardOutline: "rgba(255, 255, 255, 0.5)",
|
|
2162
|
+
courtyard: "#FF00FF",
|
|
2111
2163
|
debugComponent: {
|
|
2112
2164
|
fill: null,
|
|
2113
2165
|
stroke: null
|
|
@@ -2140,8 +2192,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
2140
2192
|
const segments = pairs(trace.route);
|
|
2141
2193
|
const svgObjects = [];
|
|
2142
2194
|
for (const [start, end] of segments) {
|
|
2143
|
-
const startPoint =
|
|
2144
|
-
const endPoint =
|
|
2195
|
+
const startPoint = applyToPoint19(transform, [start.x, start.y]);
|
|
2196
|
+
const endPoint = applyToPoint19(transform, [end.x, end.y]);
|
|
2145
2197
|
const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
|
|
2146
2198
|
if (!layer) continue;
|
|
2147
2199
|
if (layerFilter && layer !== layerFilter) continue;
|
|
@@ -2213,7 +2265,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
2213
2265
|
}
|
|
2214
2266
|
|
|
2215
2267
|
// lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
|
|
2216
|
-
import { applyToPoint as
|
|
2268
|
+
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
2217
2269
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
2218
2270
|
const { transform, layer: layerFilter, colorMap: colorMap2, renderSolderMask } = ctx;
|
|
2219
2271
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
@@ -2223,7 +2275,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2223
2275
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
2224
2276
|
const width = pad.width * Math.abs(transform.a);
|
|
2225
2277
|
const height = pad.height * Math.abs(transform.d);
|
|
2226
|
-
const [x, y] =
|
|
2278
|
+
const [x, y] = applyToPoint20(transform, [pad.x, pad.y]);
|
|
2227
2279
|
const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
|
|
2228
2280
|
const scaledBorderRadius = cornerRadiusValue * Math.abs(transform.a);
|
|
2229
2281
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
@@ -2306,7 +2358,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2306
2358
|
const width = pad.width * Math.abs(transform.a);
|
|
2307
2359
|
const height = pad.height * Math.abs(transform.d);
|
|
2308
2360
|
const radius = pad.radius * Math.abs(transform.a);
|
|
2309
|
-
const [x, y] =
|
|
2361
|
+
const [x, y] = applyToPoint20(transform, [pad.x, pad.y]);
|
|
2310
2362
|
const padElement = {
|
|
2311
2363
|
name: "rect",
|
|
2312
2364
|
type: "element",
|
|
@@ -2344,7 +2396,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2344
2396
|
}
|
|
2345
2397
|
if (pad.shape === "circle") {
|
|
2346
2398
|
const radius = pad.radius * Math.abs(transform.a);
|
|
2347
|
-
const [x, y] =
|
|
2399
|
+
const [x, y] = applyToPoint20(transform, [pad.x, pad.y]);
|
|
2348
2400
|
const padElement = {
|
|
2349
2401
|
name: "circle",
|
|
2350
2402
|
type: "element",
|
|
@@ -2379,7 +2431,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2379
2431
|
}
|
|
2380
2432
|
if (pad.shape === "polygon") {
|
|
2381
2433
|
const points = (pad.points ?? []).map(
|
|
2382
|
-
(point) =>
|
|
2434
|
+
(point) => applyToPoint20(transform, [point.x, point.y])
|
|
2383
2435
|
);
|
|
2384
2436
|
const padElement = {
|
|
2385
2437
|
name: "polygon",
|
|
@@ -2415,32 +2467,32 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
2415
2467
|
}
|
|
2416
2468
|
|
|
2417
2469
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
|
|
2418
|
-
import { applyToPoint as
|
|
2470
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
2419
2471
|
function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
2420
2472
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
2421
2473
|
const { width, height, center, outline } = pcbBoard;
|
|
2422
2474
|
let path;
|
|
2423
2475
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
2424
2476
|
path = outline.map((point, index) => {
|
|
2425
|
-
const [x, y] =
|
|
2477
|
+
const [x, y] = applyToPoint21(transform, [point.x, point.y]);
|
|
2426
2478
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
2427
2479
|
}).join(" ");
|
|
2428
2480
|
} else {
|
|
2429
2481
|
const halfWidth = width / 2;
|
|
2430
2482
|
const halfHeight = height / 2;
|
|
2431
|
-
const topLeft =
|
|
2483
|
+
const topLeft = applyToPoint21(transform, [
|
|
2432
2484
|
center.x - halfWidth,
|
|
2433
2485
|
center.y - halfHeight
|
|
2434
2486
|
]);
|
|
2435
|
-
const topRight =
|
|
2487
|
+
const topRight = applyToPoint21(transform, [
|
|
2436
2488
|
center.x + halfWidth,
|
|
2437
2489
|
center.y - halfHeight
|
|
2438
2490
|
]);
|
|
2439
|
-
const bottomRight =
|
|
2491
|
+
const bottomRight = applyToPoint21(transform, [
|
|
2440
2492
|
center.x + halfWidth,
|
|
2441
2493
|
center.y + halfHeight
|
|
2442
2494
|
]);
|
|
2443
|
-
const bottomLeft =
|
|
2495
|
+
const bottomLeft = applyToPoint21(transform, [
|
|
2444
2496
|
center.x - halfWidth,
|
|
2445
2497
|
center.y + halfHeight
|
|
2446
2498
|
]);
|
|
@@ -2467,15 +2519,15 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
2467
2519
|
}
|
|
2468
2520
|
|
|
2469
2521
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
|
|
2470
|
-
import { applyToPoint as
|
|
2522
|
+
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
2471
2523
|
function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
2472
2524
|
const { transform, colorMap: colorMap2, renderSolderMask } = ctx;
|
|
2473
2525
|
const width = Number(pcbPanel.width);
|
|
2474
2526
|
const height = Number(pcbPanel.height);
|
|
2475
|
-
const topLeft =
|
|
2476
|
-
const topRight =
|
|
2477
|
-
const bottomRight =
|
|
2478
|
-
const bottomLeft =
|
|
2527
|
+
const topLeft = applyToPoint22(transform, [0, 0]);
|
|
2528
|
+
const topRight = applyToPoint22(transform, [width, 0]);
|
|
2529
|
+
const bottomRight = applyToPoint22(transform, [width, height]);
|
|
2530
|
+
const bottomLeft = applyToPoint22(transform, [0, height]);
|
|
2479
2531
|
const path = `M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]} Z`;
|
|
2480
2532
|
const isCoveredWithSolderMask = pcbPanel.covered_with_solder_mask !== false;
|
|
2481
2533
|
const shouldRenderSolderMask = Boolean(
|
|
@@ -2501,10 +2553,10 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
2501
2553
|
}
|
|
2502
2554
|
|
|
2503
2555
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
2504
|
-
import { applyToPoint as
|
|
2556
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
2505
2557
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
2506
2558
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
2507
|
-
const [x, y] =
|
|
2559
|
+
const [x, y] = applyToPoint23(transform, [hole.x, hole.y]);
|
|
2508
2560
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
2509
2561
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
2510
2562
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -2550,10 +2602,10 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
2550
2602
|
}
|
|
2551
2603
|
|
|
2552
2604
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
2553
|
-
import { applyToPoint as
|
|
2605
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
2554
2606
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
2555
2607
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
2556
|
-
const [x, y] =
|
|
2608
|
+
const [x, y] = applyToPoint24(transform, [hole.x, hole.y]);
|
|
2557
2609
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
2558
2610
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
2559
2611
|
const radius = scaledDiameter / 2;
|
|
@@ -2691,7 +2743,7 @@ import {
|
|
|
2691
2743
|
getFullConnectivityMapFromCircuitJson
|
|
2692
2744
|
} from "circuit-json-to-connectivity-map";
|
|
2693
2745
|
import "svgson";
|
|
2694
|
-
import { applyToPoint as
|
|
2746
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
2695
2747
|
|
|
2696
2748
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
2697
2749
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -2771,11 +2823,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
2771
2823
|
});
|
|
2772
2824
|
const svgObjects = [];
|
|
2773
2825
|
for (const line of ratsNestLines) {
|
|
2774
|
-
const transformedStart =
|
|
2826
|
+
const transformedStart = applyToPoint25(transform, [
|
|
2775
2827
|
line.startPoint.x,
|
|
2776
2828
|
line.startPoint.y
|
|
2777
2829
|
]);
|
|
2778
|
-
const transformedEnd =
|
|
2830
|
+
const transformedEnd = applyToPoint25(transform, [
|
|
2779
2831
|
line.endPoint.x,
|
|
2780
2832
|
line.endPoint.y
|
|
2781
2833
|
]);
|
|
@@ -2803,7 +2855,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
2803
2855
|
|
|
2804
2856
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
2805
2857
|
import {
|
|
2806
|
-
applyToPoint as
|
|
2858
|
+
applyToPoint as applyToPoint26,
|
|
2807
2859
|
compose as compose3,
|
|
2808
2860
|
rotate as rotate3,
|
|
2809
2861
|
translate as translate3,
|
|
@@ -2813,7 +2865,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2813
2865
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
2814
2866
|
if (cutout.shape === "rect") {
|
|
2815
2867
|
const rectCutout = cutout;
|
|
2816
|
-
const [cx, cy] =
|
|
2868
|
+
const [cx, cy] = applyToPoint26(transform, [
|
|
2817
2869
|
rectCutout.center.x,
|
|
2818
2870
|
rectCutout.center.y
|
|
2819
2871
|
]);
|
|
@@ -2844,7 +2896,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2844
2896
|
}
|
|
2845
2897
|
if (cutout.shape === "circle") {
|
|
2846
2898
|
const circleCutout = cutout;
|
|
2847
|
-
const [cx, cy] =
|
|
2899
|
+
const [cx, cy] = applyToPoint26(transform, [
|
|
2848
2900
|
circleCutout.center.x,
|
|
2849
2901
|
circleCutout.center.y
|
|
2850
2902
|
]);
|
|
@@ -2871,7 +2923,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2871
2923
|
const polygonCutout = cutout;
|
|
2872
2924
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
2873
2925
|
const transformedPoints = polygonCutout.points.map(
|
|
2874
|
-
(p) =>
|
|
2926
|
+
(p) => applyToPoint26(transform, [p.x, p.y])
|
|
2875
2927
|
);
|
|
2876
2928
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
2877
2929
|
return [
|
|
@@ -2895,7 +2947,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2895
2947
|
|
|
2896
2948
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
2897
2949
|
import {
|
|
2898
|
-
applyToPoint as
|
|
2950
|
+
applyToPoint as applyToPoint28,
|
|
2899
2951
|
compose as compose4,
|
|
2900
2952
|
rotate as rotate4,
|
|
2901
2953
|
toString as matrixToString7,
|
|
@@ -2903,11 +2955,11 @@ import {
|
|
|
2903
2955
|
} from "transformation-matrix";
|
|
2904
2956
|
|
|
2905
2957
|
// lib/utils/ring-to-path-d.ts
|
|
2906
|
-
import { applyToPoint as
|
|
2958
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
2907
2959
|
function ringToPathD(vertices, transform) {
|
|
2908
2960
|
if (vertices.length === 0) return "";
|
|
2909
2961
|
const transformedVertices = vertices.map((v) => {
|
|
2910
|
-
const [x, y] =
|
|
2962
|
+
const [x, y] = applyToPoint27(transform, [v.x, v.y]);
|
|
2911
2963
|
return { ...v, x, y };
|
|
2912
2964
|
});
|
|
2913
2965
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -2940,7 +2992,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
2940
2992
|
const color = layerNameToColor(layer, colorMap2);
|
|
2941
2993
|
const opacity = "0.5";
|
|
2942
2994
|
if (pour.shape === "rect") {
|
|
2943
|
-
const [cx, cy] =
|
|
2995
|
+
const [cx, cy] = applyToPoint28(transform, [pour.center.x, pour.center.y]);
|
|
2944
2996
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
2945
2997
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
2946
2998
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -2970,7 +3022,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
2970
3022
|
if (pour.shape === "polygon") {
|
|
2971
3023
|
if (!pour.points || pour.points.length === 0) return [];
|
|
2972
3024
|
const transformedPoints = pour.points.map(
|
|
2973
|
-
(p) =>
|
|
3025
|
+
(p) => applyToPoint28(transform, [p.x, p.y])
|
|
2974
3026
|
);
|
|
2975
3027
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
2976
3028
|
return [
|
|
@@ -3155,11 +3207,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
3155
3207
|
}
|
|
3156
3208
|
|
|
3157
3209
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
3158
|
-
import { applyToPoint as
|
|
3210
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
3159
3211
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
3160
3212
|
const { transform } = ctx;
|
|
3161
3213
|
const { center, width, height, rotation = 0 } = component;
|
|
3162
|
-
const [x, y] =
|
|
3214
|
+
const [x, y] = applyToPoint29(transform, [center.x, center.y]);
|
|
3163
3215
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3164
3216
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3165
3217
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -3198,7 +3250,7 @@ function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
|
3198
3250
|
}
|
|
3199
3251
|
|
|
3200
3252
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
3201
|
-
import { applyToPoint as
|
|
3253
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
3202
3254
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
3203
3255
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
3204
3256
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -3225,7 +3277,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
3225
3277
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
3226
3278
|
)) {
|
|
3227
3279
|
const path = outline.map((point, index) => {
|
|
3228
|
-
const [x, y] =
|
|
3280
|
+
const [x, y] = applyToPoint30(transform, [point.x, point.y]);
|
|
3229
3281
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3230
3282
|
}).join(" ");
|
|
3231
3283
|
return [
|
|
@@ -3247,11 +3299,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
3247
3299
|
}
|
|
3248
3300
|
const halfWidth = width / 2;
|
|
3249
3301
|
const halfHeight = height / 2;
|
|
3250
|
-
const [topLeftX, topLeftY] =
|
|
3302
|
+
const [topLeftX, topLeftY] = applyToPoint30(transform, [
|
|
3251
3303
|
center.x - halfWidth,
|
|
3252
3304
|
center.y + halfHeight
|
|
3253
3305
|
]);
|
|
3254
|
-
const [bottomRightX, bottomRightY] =
|
|
3306
|
+
const [bottomRightX, bottomRightY] = applyToPoint30(transform, [
|
|
3255
3307
|
center.x + halfWidth,
|
|
3256
3308
|
center.y - halfHeight
|
|
3257
3309
|
]);
|
|
@@ -3287,7 +3339,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3287
3339
|
var package_default = {
|
|
3288
3340
|
name: "circuit-to-svg",
|
|
3289
3341
|
type: "module",
|
|
3290
|
-
version: "0.0.
|
|
3342
|
+
version: "0.0.250",
|
|
3291
3343
|
description: "Convert Circuit JSON to SVG",
|
|
3292
3344
|
main: "dist/index.js",
|
|
3293
3345
|
files: [
|
|
@@ -3311,7 +3363,7 @@ var package_default = {
|
|
|
3311
3363
|
"bun-match-svg": "^0.0.12",
|
|
3312
3364
|
esbuild: "^0.20.2",
|
|
3313
3365
|
"performance-now": "^2.1.0",
|
|
3314
|
-
"circuit-json": "^0.0.
|
|
3366
|
+
"circuit-json": "^0.0.288",
|
|
3315
3367
|
react: "19.1.0",
|
|
3316
3368
|
"react-cosmos": "7.0.0",
|
|
3317
3369
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -3437,6 +3489,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3437
3489
|
top: colorOverrides?.soldermask?.top ?? DEFAULT_PCB_COLOR_MAP.soldermask.top,
|
|
3438
3490
|
bottom: colorOverrides?.soldermask?.bottom ?? DEFAULT_PCB_COLOR_MAP.soldermask.bottom
|
|
3439
3491
|
},
|
|
3492
|
+
courtyard: colorOverrides?.courtyard ?? DEFAULT_PCB_COLOR_MAP.courtyard,
|
|
3440
3493
|
debugComponent: {
|
|
3441
3494
|
fill: colorOverrides?.debugComponent?.fill ?? DEFAULT_PCB_COLOR_MAP.debugComponent.fill,
|
|
3442
3495
|
stroke: colorOverrides?.debugComponent?.stroke ?? DEFAULT_PCB_COLOR_MAP.debugComponent.stroke
|
|
@@ -3562,6 +3615,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3562
3615
|
transform,
|
|
3563
3616
|
layer,
|
|
3564
3617
|
shouldDrawErrors: options?.shouldDrawErrors,
|
|
3618
|
+
showCourtyards: options?.showCourtyards,
|
|
3565
3619
|
showPcbGroups: options?.showPcbGroups,
|
|
3566
3620
|
drawPaddingOutsideBoard,
|
|
3567
3621
|
colorMap: colorMap2,
|
|
@@ -3757,6 +3811,9 @@ function createSvgObjects({
|
|
|
3757
3811
|
return createSvgObjectsFromPcbSilkscreenCircle(elm, ctx);
|
|
3758
3812
|
case "pcb_silkscreen_line":
|
|
3759
3813
|
return createSvgObjectsFromPcbSilkscreenLine(elm, ctx);
|
|
3814
|
+
case "pcb_courtyard_rect":
|
|
3815
|
+
if (!ctx.showCourtyards) return [];
|
|
3816
|
+
return createSvgObjectsFromPcbCourtyardRect(elm, ctx);
|
|
3760
3817
|
case "pcb_fabrication_note_path":
|
|
3761
3818
|
return createSvgObjectsFromPcbFabricationNotePath(elm, ctx);
|
|
3762
3819
|
case "pcb_fabrication_note_text":
|
|
@@ -3792,8 +3849,8 @@ function createSvgObjects({
|
|
|
3792
3849
|
}
|
|
3793
3850
|
}
|
|
3794
3851
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
3795
|
-
const [x1, y1] =
|
|
3796
|
-
const [x2, y2] =
|
|
3852
|
+
const [x1, y1] = applyToPoint31(transform, [minX, minY]);
|
|
3853
|
+
const [x2, y2] = applyToPoint31(transform, [maxX, maxY]);
|
|
3797
3854
|
const width = Math.abs(x2 - x1);
|
|
3798
3855
|
const height = Math.abs(y2 - y1);
|
|
3799
3856
|
const x = Math.min(x1, x2);
|
|
@@ -3823,14 +3880,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
3823
3880
|
import { stringify as stringify2 } from "svgson";
|
|
3824
3881
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
3825
3882
|
import {
|
|
3826
|
-
applyToPoint as
|
|
3883
|
+
applyToPoint as applyToPoint38,
|
|
3827
3884
|
compose as compose6,
|
|
3828
3885
|
scale as scale3,
|
|
3829
3886
|
translate as translate6
|
|
3830
3887
|
} from "transformation-matrix";
|
|
3831
3888
|
|
|
3832
3889
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
3833
|
-
import { applyToPoint as
|
|
3890
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
3834
3891
|
var DEFAULT_BOARD_STYLE = {
|
|
3835
3892
|
fill: "none",
|
|
3836
3893
|
stroke: "rgb(0,0,0)",
|
|
@@ -3842,25 +3899,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
3842
3899
|
let path;
|
|
3843
3900
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
3844
3901
|
path = outline.map((point, index) => {
|
|
3845
|
-
const [x, y] =
|
|
3902
|
+
const [x, y] = applyToPoint32(transform, [point.x, point.y]);
|
|
3846
3903
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3847
3904
|
}).join(" ");
|
|
3848
3905
|
} else {
|
|
3849
3906
|
const halfWidth = width / 2;
|
|
3850
3907
|
const halfHeight = height / 2;
|
|
3851
|
-
const topLeft =
|
|
3908
|
+
const topLeft = applyToPoint32(transform, [
|
|
3852
3909
|
center.x - halfWidth,
|
|
3853
3910
|
center.y - halfHeight
|
|
3854
3911
|
]);
|
|
3855
|
-
const topRight =
|
|
3912
|
+
const topRight = applyToPoint32(transform, [
|
|
3856
3913
|
center.x + halfWidth,
|
|
3857
3914
|
center.y - halfHeight
|
|
3858
3915
|
]);
|
|
3859
|
-
const bottomRight =
|
|
3916
|
+
const bottomRight = applyToPoint32(transform, [
|
|
3860
3917
|
center.x + halfWidth,
|
|
3861
3918
|
center.y + halfHeight
|
|
3862
3919
|
]);
|
|
3863
|
-
const bottomLeft =
|
|
3920
|
+
const bottomLeft = applyToPoint32(transform, [
|
|
3864
3921
|
center.x - halfWidth,
|
|
3865
3922
|
center.y + halfHeight
|
|
3866
3923
|
]);
|
|
@@ -3886,7 +3943,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
3886
3943
|
}
|
|
3887
3944
|
|
|
3888
3945
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
3889
|
-
import { applyToPoint as
|
|
3946
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
3890
3947
|
|
|
3891
3948
|
// lib/utils/get-sch-font-size.ts
|
|
3892
3949
|
import "transformation-matrix";
|
|
@@ -3912,8 +3969,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
3912
3969
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
3913
3970
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
3914
3971
|
return null;
|
|
3915
|
-
const [x, y] =
|
|
3916
|
-
const [pinX, pinY] =
|
|
3972
|
+
const [x, y] = applyToPoint34(transform, [center.x, center.y]);
|
|
3973
|
+
const [pinX, pinY] = applyToPoint34(transform, [portPosition.x, portPosition.y]);
|
|
3917
3974
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3918
3975
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3919
3976
|
const isTopLayer = layer === "top";
|
|
@@ -4075,11 +4132,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
4075
4132
|
}
|
|
4076
4133
|
|
|
4077
4134
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
4078
|
-
import { applyToPoint as
|
|
4135
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
4079
4136
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
4080
4137
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
4081
4138
|
const { transform } = ctx;
|
|
4082
|
-
const [x, y] =
|
|
4139
|
+
const [x, y] = applyToPoint35(transform, [hole.x, hole.y]);
|
|
4083
4140
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
4084
4141
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
4085
4142
|
const radius = scaledDiameter / 2;
|
|
@@ -4143,12 +4200,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
4143
4200
|
}
|
|
4144
4201
|
|
|
4145
4202
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
4146
|
-
import { applyToPoint as
|
|
4203
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
4147
4204
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
4148
4205
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
4149
4206
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
4150
4207
|
const { transform } = ctx;
|
|
4151
|
-
const [x, y] =
|
|
4208
|
+
const [x, y] = applyToPoint36(transform, [hole.x, hole.y]);
|
|
4152
4209
|
if (hole.shape === "pill") {
|
|
4153
4210
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4154
4211
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -4243,7 +4300,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4243
4300
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
4244
4301
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4245
4302
|
const holeRadius = scaledHoleDiameter / 2;
|
|
4246
|
-
const [holeCx, holeCy] =
|
|
4303
|
+
const [holeCx, holeCy] = applyToPoint36(transform, [
|
|
4247
4304
|
circularHole.x + circularHole.hole_offset_x,
|
|
4248
4305
|
circularHole.y + circularHole.hole_offset_y
|
|
4249
4306
|
]);
|
|
@@ -4301,7 +4358,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4301
4358
|
const pillHoleWithOffsets = pillHole;
|
|
4302
4359
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
4303
4360
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
4304
|
-
const [holeCenterX, holeCenterY] =
|
|
4361
|
+
const [holeCenterX, holeCenterY] = applyToPoint36(transform, [
|
|
4305
4362
|
pillHole.x + holeOffsetX,
|
|
4306
4363
|
pillHole.y + holeOffsetY
|
|
4307
4364
|
]);
|
|
@@ -4363,7 +4420,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4363
4420
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
4364
4421
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
4365
4422
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
4366
|
-
const [holeCenterX, holeCenterY] =
|
|
4423
|
+
const [holeCenterX, holeCenterY] = applyToPoint36(transform, [
|
|
4367
4424
|
rotatedHole.x + holeOffsetX,
|
|
4368
4425
|
rotatedHole.y + holeOffsetY
|
|
4369
4426
|
]);
|
|
@@ -4419,14 +4476,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4419
4476
|
}
|
|
4420
4477
|
|
|
4421
4478
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
4422
|
-
import { applyToPoint as
|
|
4479
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
4423
4480
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
4424
4481
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
4425
4482
|
const { transform } = ctx;
|
|
4426
4483
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
4427
4484
|
const width = pad.width * Math.abs(transform.a);
|
|
4428
4485
|
const height = pad.height * Math.abs(transform.d);
|
|
4429
|
-
const [x, y] =
|
|
4486
|
+
const [x, y] = applyToPoint37(transform, [pad.x, pad.y]);
|
|
4430
4487
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4431
4488
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
4432
4489
|
return [
|
|
@@ -4478,7 +4535,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4478
4535
|
const width = pad.width * Math.abs(transform.a);
|
|
4479
4536
|
const height = pad.height * Math.abs(transform.d);
|
|
4480
4537
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4481
|
-
const [x, y] =
|
|
4538
|
+
const [x, y] = applyToPoint37(transform, [pad.x, pad.y]);
|
|
4482
4539
|
return [
|
|
4483
4540
|
{
|
|
4484
4541
|
name: "rect",
|
|
@@ -4501,7 +4558,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4501
4558
|
}
|
|
4502
4559
|
if (pad.shape === "circle") {
|
|
4503
4560
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4504
|
-
const [x, y] =
|
|
4561
|
+
const [x, y] = applyToPoint37(transform, [pad.x, pad.y]);
|
|
4505
4562
|
return [
|
|
4506
4563
|
{
|
|
4507
4564
|
name: "circle",
|
|
@@ -4521,7 +4578,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4521
4578
|
}
|
|
4522
4579
|
if (pad.shape === "polygon") {
|
|
4523
4580
|
const points = (pad.points ?? []).map(
|
|
4524
|
-
(point) =>
|
|
4581
|
+
(point) => applyToPoint37(transform, [point.x, point.y])
|
|
4525
4582
|
);
|
|
4526
4583
|
return [
|
|
4527
4584
|
{
|
|
@@ -4698,8 +4755,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
4698
4755
|
}
|
|
4699
4756
|
}
|
|
4700
4757
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
4701
|
-
const [x1, y1] =
|
|
4702
|
-
const [x2, y2] =
|
|
4758
|
+
const [x1, y1] = applyToPoint38(transform, [minX, minY]);
|
|
4759
|
+
const [x2, y2] = applyToPoint38(transform, [maxX, maxY]);
|
|
4703
4760
|
const width = Math.abs(x2 - x1);
|
|
4704
4761
|
const height = Math.abs(y2 - y1);
|
|
4705
4762
|
const x = Math.min(x1, x2);
|
|
@@ -4728,7 +4785,7 @@ import {
|
|
|
4728
4785
|
} from "transformation-matrix";
|
|
4729
4786
|
|
|
4730
4787
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
4731
|
-
import { applyToPoint as
|
|
4788
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
4732
4789
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
4733
4790
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
4734
4791
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -4742,25 +4799,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4742
4799
|
let path;
|
|
4743
4800
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4744
4801
|
path = outline.map((point, index) => {
|
|
4745
|
-
const [x, y] =
|
|
4802
|
+
const [x, y] = applyToPoint39(transform, [point.x, point.y]);
|
|
4746
4803
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4747
4804
|
}).join(" ");
|
|
4748
4805
|
} else {
|
|
4749
4806
|
const halfWidth = width / 2;
|
|
4750
4807
|
const halfHeight = height / 2;
|
|
4751
|
-
const topLeft =
|
|
4808
|
+
const topLeft = applyToPoint39(transform, [
|
|
4752
4809
|
center.x - halfWidth,
|
|
4753
4810
|
center.y - halfHeight
|
|
4754
4811
|
]);
|
|
4755
|
-
const topRight =
|
|
4812
|
+
const topRight = applyToPoint39(transform, [
|
|
4756
4813
|
center.x + halfWidth,
|
|
4757
4814
|
center.y - halfHeight
|
|
4758
4815
|
]);
|
|
4759
|
-
const bottomRight =
|
|
4816
|
+
const bottomRight = applyToPoint39(transform, [
|
|
4760
4817
|
center.x + halfWidth,
|
|
4761
4818
|
center.y + halfHeight
|
|
4762
4819
|
]);
|
|
4763
|
-
const bottomLeft =
|
|
4820
|
+
const bottomLeft = applyToPoint39(transform, [
|
|
4764
4821
|
center.x - halfWidth,
|
|
4765
4822
|
center.y + halfHeight
|
|
4766
4823
|
]);
|
|
@@ -4778,10 +4835,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4778
4835
|
const halfWidth = width2 / 2;
|
|
4779
4836
|
const halfHeight = height2 / 2;
|
|
4780
4837
|
const [tl, tr, br, bl] = [
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4838
|
+
applyToPoint39(transform, [x - halfWidth, y - halfHeight]),
|
|
4839
|
+
applyToPoint39(transform, [x + halfWidth, y - halfHeight]),
|
|
4840
|
+
applyToPoint39(transform, [x + halfWidth, y + halfHeight]),
|
|
4841
|
+
applyToPoint39(transform, [x - halfWidth, y + halfHeight])
|
|
4785
4842
|
];
|
|
4786
4843
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
4787
4844
|
} else if (cutout.shape === "circle") {
|
|
@@ -4831,7 +4888,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4831
4888
|
|
|
4832
4889
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
4833
4890
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
4834
|
-
import { applyToPoint as
|
|
4891
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
4835
4892
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
4836
4893
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
4837
4894
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -4841,7 +4898,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
4841
4898
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
4842
4899
|
return [];
|
|
4843
4900
|
}
|
|
4844
|
-
const [x, y] =
|
|
4901
|
+
const [x, y] = applyToPoint40(transform, [center.x, center.y]);
|
|
4845
4902
|
const scaledWidth = width * Math.abs(transform.a);
|
|
4846
4903
|
const scaledHeight = height * Math.abs(transform.d);
|
|
4847
4904
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -4902,11 +4959,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
4902
4959
|
}
|
|
4903
4960
|
|
|
4904
4961
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
4905
|
-
import { applyToPoint as
|
|
4962
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
4906
4963
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
4907
4964
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
4908
4965
|
const { transform } = ctx;
|
|
4909
|
-
const [x, y] =
|
|
4966
|
+
const [x, y] = applyToPoint41(transform, [hole.x, hole.y]);
|
|
4910
4967
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
4911
4968
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
4912
4969
|
const radius = scaledDiameter / 2;
|
|
@@ -4970,12 +5027,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
4970
5027
|
}
|
|
4971
5028
|
|
|
4972
5029
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
4973
|
-
import { applyToPoint as
|
|
5030
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
4974
5031
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
4975
5032
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
4976
5033
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
4977
5034
|
const { transform } = ctx;
|
|
4978
|
-
const [x, y] =
|
|
5035
|
+
const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
|
|
4979
5036
|
if (hole.shape === "pill") {
|
|
4980
5037
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4981
5038
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -5210,14 +5267,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
5210
5267
|
}
|
|
5211
5268
|
|
|
5212
5269
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
5213
|
-
import { applyToPoint as
|
|
5270
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
5214
5271
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
5215
5272
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
5216
5273
|
const { transform } = ctx;
|
|
5217
5274
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
5218
5275
|
const width = pad.width * Math.abs(transform.a);
|
|
5219
5276
|
const height = pad.height * Math.abs(transform.d);
|
|
5220
|
-
const [x, y] =
|
|
5277
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
5221
5278
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
5222
5279
|
return [
|
|
5223
5280
|
{
|
|
@@ -5260,7 +5317,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5260
5317
|
const width = pad.width * Math.abs(transform.a);
|
|
5261
5318
|
const height = pad.height * Math.abs(transform.d);
|
|
5262
5319
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5263
|
-
const [x, y] =
|
|
5320
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
5264
5321
|
return [
|
|
5265
5322
|
{
|
|
5266
5323
|
name: "rect",
|
|
@@ -5283,7 +5340,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5283
5340
|
}
|
|
5284
5341
|
if (pad.shape === "circle") {
|
|
5285
5342
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5286
|
-
const [x, y] =
|
|
5343
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
5287
5344
|
return [
|
|
5288
5345
|
{
|
|
5289
5346
|
name: "circle",
|
|
@@ -5303,7 +5360,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5303
5360
|
}
|
|
5304
5361
|
if (pad.shape === "polygon") {
|
|
5305
5362
|
const points = (pad.points ?? []).map(
|
|
5306
|
-
(point) =>
|
|
5363
|
+
(point) => applyToPoint43(transform, [point.x, point.y])
|
|
5307
5364
|
);
|
|
5308
5365
|
return [
|
|
5309
5366
|
{
|
|
@@ -5324,7 +5381,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5324
5381
|
}
|
|
5325
5382
|
|
|
5326
5383
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
5327
|
-
import { applyToPoint as
|
|
5384
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
5328
5385
|
import { calculateElbow } from "calculate-elbow";
|
|
5329
5386
|
|
|
5330
5387
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -5401,7 +5458,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5401
5458
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
5402
5459
|
if (!label_info) return [];
|
|
5403
5460
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
5404
|
-
const [port_x, port_y] =
|
|
5461
|
+
const [port_x, port_y] = applyToPoint44(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
5405
5462
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
5406
5463
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
5407
5464
|
const elbow_path = calculateElbow(
|
|
@@ -5542,7 +5599,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5542
5599
|
}
|
|
5543
5600
|
|
|
5544
5601
|
// lib/pinout/calculate-label-positions.ts
|
|
5545
|
-
import { applyToPoint as
|
|
5602
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
5546
5603
|
|
|
5547
5604
|
// lib/pinout/constants.ts
|
|
5548
5605
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -5580,7 +5637,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5580
5637
|
);
|
|
5581
5638
|
const mapToEdgePort = (pinout_label) => ({
|
|
5582
5639
|
pcb_port: pinout_label.pcb_port,
|
|
5583
|
-
y:
|
|
5640
|
+
y: applyToPoint45(transform, [
|
|
5584
5641
|
pinout_label.pcb_port.x,
|
|
5585
5642
|
pinout_label.pcb_port.y
|
|
5586
5643
|
])[1],
|
|
@@ -5595,7 +5652,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5595
5652
|
} else {
|
|
5596
5653
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
5597
5654
|
pcb_port: pinout_label.pcb_port,
|
|
5598
|
-
y:
|
|
5655
|
+
y: applyToPoint45(transform, [
|
|
5599
5656
|
pinout_label.pcb_port.x,
|
|
5600
5657
|
pinout_label.pcb_port.y
|
|
5601
5658
|
])[1],
|
|
@@ -5603,7 +5660,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5603
5660
|
})).sort((a, b) => a.y - b.y);
|
|
5604
5661
|
}
|
|
5605
5662
|
if (edge_ports.length === 0) return;
|
|
5606
|
-
const board_edge_x =
|
|
5663
|
+
const board_edge_x = applyToPoint45(transform, [
|
|
5607
5664
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
5608
5665
|
0
|
|
5609
5666
|
])[0];
|
|
@@ -6018,14 +6075,14 @@ import {
|
|
|
6018
6075
|
} from "transformation-matrix";
|
|
6019
6076
|
|
|
6020
6077
|
// lib/sch/draw-schematic-grid.ts
|
|
6021
|
-
import { applyToPoint as
|
|
6078
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
6022
6079
|
function drawSchematicGrid(params) {
|
|
6023
6080
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
6024
6081
|
const cellSize = params.cellSize ?? 1;
|
|
6025
6082
|
const labelCells = params.labelCells ?? false;
|
|
6026
6083
|
const gridLines = [];
|
|
6027
6084
|
const transformPoint = (x, y) => {
|
|
6028
|
-
const [transformedX, transformedY] =
|
|
6085
|
+
const [transformedX, transformedY] = applyToPoint46(params.transform, [x, y]);
|
|
6029
6086
|
return { x: transformedX, y: transformedY };
|
|
6030
6087
|
};
|
|
6031
6088
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -6106,15 +6163,15 @@ function drawSchematicGrid(params) {
|
|
|
6106
6163
|
}
|
|
6107
6164
|
|
|
6108
6165
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
6109
|
-
import { applyToPoint as
|
|
6166
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
6110
6167
|
function drawSchematicLabeledPoints(params) {
|
|
6111
6168
|
const { points, transform } = params;
|
|
6112
6169
|
const labeledPointsGroup = [];
|
|
6113
6170
|
for (const point of points) {
|
|
6114
|
-
const [x1, y1] =
|
|
6115
|
-
const [x2, y2] =
|
|
6116
|
-
const [x3, y3] =
|
|
6117
|
-
const [x4, y4] =
|
|
6171
|
+
const [x1, y1] = applyToPoint47(transform, [point.x - 0.1, point.y - 0.1]);
|
|
6172
|
+
const [x2, y2] = applyToPoint47(transform, [point.x + 0.1, point.y + 0.1]);
|
|
6173
|
+
const [x3, y3] = applyToPoint47(transform, [point.x - 0.1, point.y + 0.1]);
|
|
6174
|
+
const [x4, y4] = applyToPoint47(transform, [point.x + 0.1, point.y - 0.1]);
|
|
6118
6175
|
labeledPointsGroup.push({
|
|
6119
6176
|
name: "path",
|
|
6120
6177
|
type: "element",
|
|
@@ -6125,7 +6182,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
6125
6182
|
"stroke-opacity": "0.7"
|
|
6126
6183
|
}
|
|
6127
6184
|
});
|
|
6128
|
-
const [labelX, labelY] =
|
|
6185
|
+
const [labelX, labelY] = applyToPoint47(transform, [
|
|
6129
6186
|
point.x + 0.15,
|
|
6130
6187
|
point.y - 0.15
|
|
6131
6188
|
]);
|
|
@@ -7219,7 +7276,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
7219
7276
|
import { symbols } from "schematic-symbols";
|
|
7220
7277
|
import "svgson";
|
|
7221
7278
|
import {
|
|
7222
|
-
applyToPoint as
|
|
7279
|
+
applyToPoint as applyToPoint49,
|
|
7223
7280
|
compose as compose9
|
|
7224
7281
|
} from "transformation-matrix";
|
|
7225
7282
|
|
|
@@ -7303,13 +7360,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
7303
7360
|
}
|
|
7304
7361
|
|
|
7305
7362
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
7306
|
-
import { applyToPoint as
|
|
7363
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7307
7364
|
var createSvgSchErrorText = ({
|
|
7308
7365
|
text,
|
|
7309
7366
|
realCenter,
|
|
7310
7367
|
realToScreenTransform
|
|
7311
7368
|
}) => {
|
|
7312
|
-
const screenCenter =
|
|
7369
|
+
const screenCenter = applyToPoint48(realToScreenTransform, realCenter);
|
|
7313
7370
|
return {
|
|
7314
7371
|
type: "element",
|
|
7315
7372
|
name: "text",
|
|
@@ -7418,11 +7475,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7418
7475
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
7419
7476
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
7420
7477
|
};
|
|
7421
|
-
const [screenMinX, screenMinY] =
|
|
7478
|
+
const [screenMinX, screenMinY] = applyToPoint49(
|
|
7422
7479
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7423
7480
|
[bounds.minX, bounds.minY]
|
|
7424
7481
|
);
|
|
7425
|
-
const [screenMaxX, screenMaxY] =
|
|
7482
|
+
const [screenMaxX, screenMaxY] = applyToPoint49(
|
|
7426
7483
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7427
7484
|
[bounds.maxX, bounds.maxY]
|
|
7428
7485
|
);
|
|
@@ -7451,7 +7508,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7451
7508
|
name: "path",
|
|
7452
7509
|
attributes: {
|
|
7453
7510
|
d: points.map((p, i) => {
|
|
7454
|
-
const [x, y] =
|
|
7511
|
+
const [x, y] = applyToPoint49(
|
|
7455
7512
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7456
7513
|
[p.x, p.y]
|
|
7457
7514
|
);
|
|
@@ -7467,7 +7524,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7467
7524
|
});
|
|
7468
7525
|
}
|
|
7469
7526
|
for (const text of texts) {
|
|
7470
|
-
const screenTextPos =
|
|
7527
|
+
const screenTextPos = applyToPoint49(
|
|
7471
7528
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7472
7529
|
text
|
|
7473
7530
|
);
|
|
@@ -7519,7 +7576,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7519
7576
|
});
|
|
7520
7577
|
}
|
|
7521
7578
|
for (const box of boxes) {
|
|
7522
|
-
const screenBoxPos =
|
|
7579
|
+
const screenBoxPos = applyToPoint49(
|
|
7523
7580
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7524
7581
|
box
|
|
7525
7582
|
);
|
|
@@ -7543,7 +7600,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7543
7600
|
}
|
|
7544
7601
|
for (const port of symbol.ports) {
|
|
7545
7602
|
if (connectedSymbolPorts.has(port)) continue;
|
|
7546
|
-
const screenPortPos =
|
|
7603
|
+
const screenPortPos = applyToPoint49(
|
|
7547
7604
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7548
7605
|
port
|
|
7549
7606
|
);
|
|
@@ -7563,7 +7620,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7563
7620
|
});
|
|
7564
7621
|
}
|
|
7565
7622
|
for (const circle of circles) {
|
|
7566
|
-
const screenCirclePos =
|
|
7623
|
+
const screenCirclePos = applyToPoint49(
|
|
7567
7624
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7568
7625
|
circle
|
|
7569
7626
|
);
|
|
@@ -7590,14 +7647,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7590
7647
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
7591
7648
|
import "schematic-symbols";
|
|
7592
7649
|
import "svgson";
|
|
7593
|
-
import { applyToPoint as
|
|
7650
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
7594
7651
|
|
|
7595
7652
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
7596
7653
|
import "transformation-matrix";
|
|
7597
7654
|
import "@tscircuit/circuit-json-util";
|
|
7598
7655
|
|
|
7599
7656
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
7600
|
-
import { applyToPoint as
|
|
7657
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
7601
7658
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
7602
7659
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
7603
7660
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -7650,8 +7707,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7650
7707
|
realEdgePos.y += realPinLineLength;
|
|
7651
7708
|
break;
|
|
7652
7709
|
}
|
|
7653
|
-
const screenSchPortPos =
|
|
7654
|
-
const screenRealEdgePos =
|
|
7710
|
+
const screenSchPortPos = applyToPoint50(transform, schPort.center);
|
|
7711
|
+
const screenRealEdgePos = applyToPoint50(transform, realEdgePos);
|
|
7655
7712
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
7656
7713
|
const realLineEnd = { ...schPort.center };
|
|
7657
7714
|
if (!isConnected) {
|
|
@@ -7670,7 +7727,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7670
7727
|
break;
|
|
7671
7728
|
}
|
|
7672
7729
|
}
|
|
7673
|
-
const screenLineEnd =
|
|
7730
|
+
const screenLineEnd = applyToPoint50(transform, realLineEnd);
|
|
7674
7731
|
svgObjects.push({
|
|
7675
7732
|
name: "line",
|
|
7676
7733
|
type: "element",
|
|
@@ -7791,7 +7848,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7791
7848
|
};
|
|
7792
7849
|
|
|
7793
7850
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
7794
|
-
import { applyToPoint as
|
|
7851
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
7795
7852
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
7796
7853
|
const svgObjects = [];
|
|
7797
7854
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -7809,7 +7866,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7809
7866
|
} else {
|
|
7810
7867
|
realPinNumberPos.y += 0.02;
|
|
7811
7868
|
}
|
|
7812
|
-
const screenPinNumberTextPos =
|
|
7869
|
+
const screenPinNumberTextPos = applyToPoint51(transform, realPinNumberPos);
|
|
7813
7870
|
svgObjects.push({
|
|
7814
7871
|
name: "text",
|
|
7815
7872
|
type: "element",
|
|
@@ -7839,7 +7896,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7839
7896
|
};
|
|
7840
7897
|
|
|
7841
7898
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
7842
|
-
import { applyToPoint as
|
|
7899
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
7843
7900
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
7844
7901
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
7845
7902
|
const svgObjects = [];
|
|
@@ -7853,7 +7910,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
7853
7910
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
7854
7911
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7855
7912
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7856
|
-
const screenPinNumberTextPos =
|
|
7913
|
+
const screenPinNumberTextPos = applyToPoint52(transform, realPinNumberPos);
|
|
7857
7914
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
7858
7915
|
if (!label) return [];
|
|
7859
7916
|
const isNegated = label.startsWith("N_");
|
|
@@ -7901,13 +7958,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
7901
7958
|
};
|
|
7902
7959
|
|
|
7903
7960
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
7904
|
-
import { applyToPoint as
|
|
7961
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
7905
7962
|
var createSvgSchText = ({
|
|
7906
7963
|
elm,
|
|
7907
7964
|
transform,
|
|
7908
7965
|
colorMap: colorMap2
|
|
7909
7966
|
}) => {
|
|
7910
|
-
const center =
|
|
7967
|
+
const center = applyToPoint54(transform, elm.position);
|
|
7911
7968
|
const textAnchorMap = {
|
|
7912
7969
|
center: "middle",
|
|
7913
7970
|
center_right: "end",
|
|
@@ -7991,11 +8048,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
7991
8048
|
colorMap: colorMap2
|
|
7992
8049
|
}) => {
|
|
7993
8050
|
const svgObjects = [];
|
|
7994
|
-
const componentScreenTopLeft =
|
|
8051
|
+
const componentScreenTopLeft = applyToPoint55(transform, {
|
|
7995
8052
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
7996
8053
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
7997
8054
|
});
|
|
7998
|
-
const componentScreenBottomRight =
|
|
8055
|
+
const componentScreenBottomRight = applyToPoint55(transform, {
|
|
7999
8056
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
8000
8057
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
8001
8058
|
});
|
|
@@ -8081,13 +8138,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
8081
8138
|
}
|
|
8082
8139
|
|
|
8083
8140
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
8084
|
-
import { applyToPoint as
|
|
8141
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
8085
8142
|
function createSvgObjectsFromSchVoltageProbe({
|
|
8086
8143
|
probe,
|
|
8087
8144
|
transform,
|
|
8088
8145
|
colorMap: colorMap2
|
|
8089
8146
|
}) {
|
|
8090
|
-
const [screenX, screenY] =
|
|
8147
|
+
const [screenX, screenY] = applyToPoint56(transform, [
|
|
8091
8148
|
probe.position.x,
|
|
8092
8149
|
probe.position.y
|
|
8093
8150
|
]);
|
|
@@ -8147,17 +8204,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
8147
8204
|
}
|
|
8148
8205
|
|
|
8149
8206
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
8150
|
-
import { applyToPoint as
|
|
8207
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
8151
8208
|
function createSvgObjectsFromSchDebugObject({
|
|
8152
8209
|
debugObject,
|
|
8153
8210
|
transform
|
|
8154
8211
|
}) {
|
|
8155
8212
|
if (debugObject.shape === "rect") {
|
|
8156
|
-
let [screenLeft, screenTop] =
|
|
8213
|
+
let [screenLeft, screenTop] = applyToPoint57(transform, [
|
|
8157
8214
|
debugObject.center.x - debugObject.size.width / 2,
|
|
8158
8215
|
debugObject.center.y - debugObject.size.height / 2
|
|
8159
8216
|
]);
|
|
8160
|
-
let [screenRight, screenBottom] =
|
|
8217
|
+
let [screenRight, screenBottom] = applyToPoint57(transform, [
|
|
8161
8218
|
debugObject.center.x + debugObject.size.width / 2,
|
|
8162
8219
|
debugObject.center.y + debugObject.size.height / 2
|
|
8163
8220
|
]);
|
|
@@ -8167,7 +8224,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8167
8224
|
];
|
|
8168
8225
|
const width = Math.abs(screenRight - screenLeft);
|
|
8169
8226
|
const height = Math.abs(screenBottom - screenTop);
|
|
8170
|
-
const [screenCenterX, screenCenterY] =
|
|
8227
|
+
const [screenCenterX, screenCenterY] = applyToPoint57(transform, [
|
|
8171
8228
|
debugObject.center.x,
|
|
8172
8229
|
debugObject.center.y
|
|
8173
8230
|
]);
|
|
@@ -8213,11 +8270,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8213
8270
|
];
|
|
8214
8271
|
}
|
|
8215
8272
|
if (debugObject.shape === "line") {
|
|
8216
|
-
const [screenStartX, screenStartY] =
|
|
8273
|
+
const [screenStartX, screenStartY] = applyToPoint57(transform, [
|
|
8217
8274
|
debugObject.start.x,
|
|
8218
8275
|
debugObject.start.y
|
|
8219
8276
|
]);
|
|
8220
|
-
const [screenEndX, screenEndY] =
|
|
8277
|
+
const [screenEndX, screenEndY] = applyToPoint57(transform, [
|
|
8221
8278
|
debugObject.end.x,
|
|
8222
8279
|
debugObject.end.y
|
|
8223
8280
|
]);
|
|
@@ -8267,7 +8324,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8267
8324
|
}
|
|
8268
8325
|
|
|
8269
8326
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
8270
|
-
import { applyToPoint as
|
|
8327
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
8271
8328
|
function createSchematicTrace({
|
|
8272
8329
|
trace,
|
|
8273
8330
|
transform,
|
|
@@ -8281,11 +8338,11 @@ function createSchematicTrace({
|
|
|
8281
8338
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
8282
8339
|
const edge = edges[edgeIndex];
|
|
8283
8340
|
if (edge.is_crossing) continue;
|
|
8284
|
-
const [screenFromX, screenFromY] =
|
|
8341
|
+
const [screenFromX, screenFromY] = applyToPoint58(transform, [
|
|
8285
8342
|
edge.from.x,
|
|
8286
8343
|
edge.from.y
|
|
8287
8344
|
]);
|
|
8288
|
-
const [screenToX, screenToY] =
|
|
8345
|
+
const [screenToX, screenToY] = applyToPoint58(transform, [
|
|
8289
8346
|
edge.to.x,
|
|
8290
8347
|
edge.to.y
|
|
8291
8348
|
]);
|
|
@@ -8329,11 +8386,11 @@ function createSchematicTrace({
|
|
|
8329
8386
|
}
|
|
8330
8387
|
for (const edge of edges) {
|
|
8331
8388
|
if (!edge.is_crossing) continue;
|
|
8332
|
-
const [screenFromX, screenFromY] =
|
|
8389
|
+
const [screenFromX, screenFromY] = applyToPoint58(transform, [
|
|
8333
8390
|
edge.from.x,
|
|
8334
8391
|
edge.from.y
|
|
8335
8392
|
]);
|
|
8336
|
-
const [screenToX, screenToY] =
|
|
8393
|
+
const [screenToX, screenToY] = applyToPoint58(transform, [
|
|
8337
8394
|
edge.to.x,
|
|
8338
8395
|
edge.to.y
|
|
8339
8396
|
]);
|
|
@@ -8377,7 +8434,7 @@ function createSchematicTrace({
|
|
|
8377
8434
|
}
|
|
8378
8435
|
if (trace.junctions) {
|
|
8379
8436
|
for (const junction of trace.junctions) {
|
|
8380
|
-
const [screenX, screenY] =
|
|
8437
|
+
const [screenX, screenY] = applyToPoint58(transform, [
|
|
8381
8438
|
junction.x,
|
|
8382
8439
|
junction.y
|
|
8383
8440
|
]);
|
|
@@ -8432,7 +8489,7 @@ function createSchematicTrace({
|
|
|
8432
8489
|
|
|
8433
8490
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
8434
8491
|
import {
|
|
8435
|
-
applyToPoint as
|
|
8492
|
+
applyToPoint as applyToPoint60,
|
|
8436
8493
|
compose as compose11,
|
|
8437
8494
|
rotate as rotate6,
|
|
8438
8495
|
scale as scale6,
|
|
@@ -8441,7 +8498,7 @@ import {
|
|
|
8441
8498
|
|
|
8442
8499
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
8443
8500
|
import {
|
|
8444
|
-
applyToPoint as
|
|
8501
|
+
applyToPoint as applyToPoint59,
|
|
8445
8502
|
compose as compose10,
|
|
8446
8503
|
rotate as rotate5,
|
|
8447
8504
|
scale as scale5,
|
|
@@ -8516,7 +8573,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8516
8573
|
x: symbolBounds.minX,
|
|
8517
8574
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
8518
8575
|
};
|
|
8519
|
-
const rotatedSymbolEnd =
|
|
8576
|
+
const rotatedSymbolEnd = applyToPoint59(rotationMatrix, symbolEndPoint);
|
|
8520
8577
|
const symbolToRealTransform = compose10(
|
|
8521
8578
|
translate10(
|
|
8522
8579
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -8526,11 +8583,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8526
8583
|
scale5(1)
|
|
8527
8584
|
// Use full symbol size
|
|
8528
8585
|
);
|
|
8529
|
-
const [screenMinX, screenMinY] =
|
|
8586
|
+
const [screenMinX, screenMinY] = applyToPoint59(
|
|
8530
8587
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8531
8588
|
[bounds.minX, bounds.minY]
|
|
8532
8589
|
);
|
|
8533
|
-
const [screenMaxX, screenMaxY] =
|
|
8590
|
+
const [screenMaxX, screenMaxY] = applyToPoint59(
|
|
8534
8591
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8535
8592
|
[bounds.maxX, bounds.maxY]
|
|
8536
8593
|
);
|
|
@@ -8554,7 +8611,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8554
8611
|
});
|
|
8555
8612
|
for (const path of symbolPaths) {
|
|
8556
8613
|
const symbolPath = path.points.map((p, i) => {
|
|
8557
|
-
const [x, y] =
|
|
8614
|
+
const [x, y] = applyToPoint59(
|
|
8558
8615
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8559
8616
|
[p.x, p.y]
|
|
8560
8617
|
);
|
|
@@ -8575,7 +8632,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8575
8632
|
});
|
|
8576
8633
|
}
|
|
8577
8634
|
for (const text of symbolTexts) {
|
|
8578
|
-
const screenTextPos =
|
|
8635
|
+
const screenTextPos = applyToPoint59(
|
|
8579
8636
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8580
8637
|
text
|
|
8581
8638
|
);
|
|
@@ -8617,7 +8674,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8617
8674
|
});
|
|
8618
8675
|
}
|
|
8619
8676
|
for (const box of symbolBoxes) {
|
|
8620
|
-
const screenBoxPos =
|
|
8677
|
+
const screenBoxPos = applyToPoint59(
|
|
8621
8678
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8622
8679
|
box
|
|
8623
8680
|
);
|
|
@@ -8640,7 +8697,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8640
8697
|
});
|
|
8641
8698
|
}
|
|
8642
8699
|
for (const circle of symbolCircles) {
|
|
8643
|
-
const screenCirclePos =
|
|
8700
|
+
const screenCirclePos = applyToPoint59(
|
|
8644
8701
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8645
8702
|
circle
|
|
8646
8703
|
);
|
|
@@ -8685,14 +8742,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8685
8742
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
8686
8743
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
8687
8744
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
8688
|
-
const screenCenter =
|
|
8745
|
+
const screenCenter = applyToPoint60(realToScreenTransform, schNetLabel.center);
|
|
8689
8746
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
8690
8747
|
schNetLabel.anchor_side
|
|
8691
8748
|
);
|
|
8692
8749
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
8693
8750
|
screenTextGrowthVec.y *= -1;
|
|
8694
8751
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
8695
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
8752
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint60(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
8696
8753
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
8697
8754
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
8698
8755
|
};
|
|
@@ -8733,7 +8790,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8733
8790
|
y: -0.6
|
|
8734
8791
|
}
|
|
8735
8792
|
].map(
|
|
8736
|
-
(fontRelativePoint) =>
|
|
8793
|
+
(fontRelativePoint) => applyToPoint60(
|
|
8737
8794
|
compose11(
|
|
8738
8795
|
realToScreenTransform,
|
|
8739
8796
|
translate11(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -8810,17 +8867,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8810
8867
|
};
|
|
8811
8868
|
|
|
8812
8869
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
8813
|
-
import { applyToPoint as
|
|
8870
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
8814
8871
|
var createSvgObjectsFromSchematicBox = ({
|
|
8815
8872
|
schematicBox,
|
|
8816
8873
|
transform,
|
|
8817
8874
|
colorMap: colorMap2
|
|
8818
8875
|
}) => {
|
|
8819
|
-
const topLeft =
|
|
8876
|
+
const topLeft = applyToPoint61(transform, {
|
|
8820
8877
|
x: schematicBox.x,
|
|
8821
8878
|
y: schematicBox.y
|
|
8822
8879
|
});
|
|
8823
|
-
const bottomRight =
|
|
8880
|
+
const bottomRight = applyToPoint61(transform, {
|
|
8824
8881
|
x: schematicBox.x + schematicBox.width,
|
|
8825
8882
|
y: schematicBox.y + schematicBox.height
|
|
8826
8883
|
});
|
|
@@ -8856,7 +8913,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
8856
8913
|
};
|
|
8857
8914
|
|
|
8858
8915
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
8859
|
-
import { applyToPoint as
|
|
8916
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
8860
8917
|
var createSvgObjectsFromSchematicTable = ({
|
|
8861
8918
|
schematicTable,
|
|
8862
8919
|
transform,
|
|
@@ -8889,11 +8946,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8889
8946
|
const svgObjects = [];
|
|
8890
8947
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
8891
8948
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
8892
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
8949
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint62(transform, [
|
|
8893
8950
|
topLeftX,
|
|
8894
8951
|
topLeftY
|
|
8895
8952
|
]);
|
|
8896
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
8953
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint62(transform, [
|
|
8897
8954
|
topLeftX + totalWidth,
|
|
8898
8955
|
topLeftY - totalHeight
|
|
8899
8956
|
]);
|
|
@@ -8925,8 +8982,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8925
8982
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
8926
8983
|
);
|
|
8927
8984
|
if (!isMerged) {
|
|
8928
|
-
const start =
|
|
8929
|
-
const end =
|
|
8985
|
+
const start = applyToPoint62(transform, { x: currentX, y: segmentStartY });
|
|
8986
|
+
const end = applyToPoint62(transform, { x: currentX, y: segmentEndY });
|
|
8930
8987
|
svgObjects.push({
|
|
8931
8988
|
name: "line",
|
|
8932
8989
|
type: "element",
|
|
@@ -8955,11 +9012,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8955
9012
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
8956
9013
|
);
|
|
8957
9014
|
if (!isMerged) {
|
|
8958
|
-
const start =
|
|
9015
|
+
const start = applyToPoint62(transform, {
|
|
8959
9016
|
x: segmentStartX,
|
|
8960
9017
|
y: currentY
|
|
8961
9018
|
});
|
|
8962
|
-
const end =
|
|
9019
|
+
const end = applyToPoint62(transform, { x: segmentEndX, y: currentY });
|
|
8963
9020
|
svgObjects.push({
|
|
8964
9021
|
name: "line",
|
|
8965
9022
|
type: "element",
|
|
@@ -9001,7 +9058,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
9001
9058
|
} else if (vertical_align === "bottom") {
|
|
9002
9059
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
9003
9060
|
}
|
|
9004
|
-
const screenTextAnchorPos =
|
|
9061
|
+
const screenTextAnchorPos = applyToPoint62(transform, realTextAnchorPos);
|
|
9005
9062
|
const fontSize = getSchScreenFontSize(
|
|
9006
9063
|
transform,
|
|
9007
9064
|
"reference_designator",
|
|
@@ -9057,13 +9114,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
9057
9114
|
|
|
9058
9115
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
9059
9116
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
9060
|
-
import { applyToPoint as
|
|
9117
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
9061
9118
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
9062
9119
|
var createSvgObjectsForSchPortHover = ({
|
|
9063
9120
|
schPort,
|
|
9064
9121
|
transform
|
|
9065
9122
|
}) => {
|
|
9066
|
-
const screenSchPortPos =
|
|
9123
|
+
const screenSchPortPos = applyToPoint63(transform, schPort.center);
|
|
9067
9124
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
9068
9125
|
return [
|
|
9069
9126
|
{
|
|
@@ -9108,14 +9165,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
9108
9165
|
};
|
|
9109
9166
|
|
|
9110
9167
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
9111
|
-
import { applyToPoint as
|
|
9168
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
9112
9169
|
function createSvgObjectsFromSchematicLine({
|
|
9113
9170
|
schLine,
|
|
9114
9171
|
transform,
|
|
9115
9172
|
colorMap: colorMap2
|
|
9116
9173
|
}) {
|
|
9117
|
-
const p1 =
|
|
9118
|
-
const p2 =
|
|
9174
|
+
const p1 = applyToPoint64(transform, { x: schLine.x1, y: schLine.y1 });
|
|
9175
|
+
const p2 = applyToPoint64(transform, { x: schLine.x2, y: schLine.y2 });
|
|
9119
9176
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
9120
9177
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
9121
9178
|
return [
|
|
@@ -9144,13 +9201,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
9144
9201
|
}
|
|
9145
9202
|
|
|
9146
9203
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
9147
|
-
import { applyToPoint as
|
|
9204
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
9148
9205
|
function createSvgObjectsFromSchematicCircle({
|
|
9149
9206
|
schCircle,
|
|
9150
9207
|
transform,
|
|
9151
9208
|
colorMap: colorMap2
|
|
9152
9209
|
}) {
|
|
9153
|
-
const center =
|
|
9210
|
+
const center = applyToPoint65(transform, schCircle.center);
|
|
9154
9211
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
9155
9212
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
9156
9213
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -9180,13 +9237,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
9180
9237
|
}
|
|
9181
9238
|
|
|
9182
9239
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
9183
|
-
import { applyToPoint as
|
|
9240
|
+
import { applyToPoint as applyToPoint66 } from "transformation-matrix";
|
|
9184
9241
|
function createSvgObjectsFromSchematicRect({
|
|
9185
9242
|
schRect,
|
|
9186
9243
|
transform,
|
|
9187
9244
|
colorMap: colorMap2
|
|
9188
9245
|
}) {
|
|
9189
|
-
const center =
|
|
9246
|
+
const center = applyToPoint66(transform, schRect.center);
|
|
9190
9247
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
9191
9248
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
9192
9249
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -9222,13 +9279,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
9222
9279
|
}
|
|
9223
9280
|
|
|
9224
9281
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
9225
|
-
import { applyToPoint as
|
|
9282
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
9226
9283
|
function createSvgObjectsFromSchematicArc({
|
|
9227
9284
|
schArc,
|
|
9228
9285
|
transform,
|
|
9229
9286
|
colorMap: colorMap2
|
|
9230
9287
|
}) {
|
|
9231
|
-
const center =
|
|
9288
|
+
const center = applyToPoint67(transform, schArc.center);
|
|
9232
9289
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
9233
9290
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
9234
9291
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -10305,18 +10362,18 @@ function formatNumber2(value) {
|
|
|
10305
10362
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
10306
10363
|
import { stringify as stringify7 } from "svgson";
|
|
10307
10364
|
import {
|
|
10308
|
-
applyToPoint as
|
|
10365
|
+
applyToPoint as applyToPoint70,
|
|
10309
10366
|
compose as compose14,
|
|
10310
10367
|
scale as scale8,
|
|
10311
10368
|
translate as translate14
|
|
10312
10369
|
} from "transformation-matrix";
|
|
10313
10370
|
|
|
10314
10371
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
10315
|
-
import { applyToPoint as
|
|
10372
|
+
import { applyToPoint as applyToPoint69 } from "transformation-matrix";
|
|
10316
10373
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
10317
10374
|
const { transform, layer: layerFilter } = ctx;
|
|
10318
10375
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
10319
|
-
const [x, y] =
|
|
10376
|
+
const [x, y] = applyToPoint69(transform, [solderPaste.x, solderPaste.y]);
|
|
10320
10377
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
10321
10378
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
10322
10379
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -10527,8 +10584,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
10527
10584
|
}
|
|
10528
10585
|
}
|
|
10529
10586
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
10530
|
-
const [x1, y1] =
|
|
10531
|
-
const [x2, y2] =
|
|
10587
|
+
const [x1, y1] = applyToPoint70(transform, [minX, minY]);
|
|
10588
|
+
const [x2, y2] = applyToPoint70(transform, [maxX, maxY]);
|
|
10532
10589
|
const width = Math.abs(x2 - x1);
|
|
10533
10590
|
const height = Math.abs(y2 - y1);
|
|
10534
10591
|
const x = Math.min(x1, x2);
|