circuit-to-svg 0.0.244 → 0.0.246
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 +2 -0
- package/dist/index.js +261 -159
- 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 applyToPoint30,
|
|
5
5
|
compose as compose5,
|
|
6
6
|
scale as scale2,
|
|
7
7
|
translate as translate5
|
|
@@ -2466,11 +2466,45 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
2466
2466
|
];
|
|
2467
2467
|
}
|
|
2468
2468
|
|
|
2469
|
-
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-
|
|
2469
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
|
|
2470
2470
|
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
2471
|
+
function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
2472
|
+
const { transform, colorMap: colorMap2, renderSolderMask } = ctx;
|
|
2473
|
+
const width = Number(pcbPanel.width);
|
|
2474
|
+
const height = Number(pcbPanel.height);
|
|
2475
|
+
const topLeft = applyToPoint21(transform, [0, 0]);
|
|
2476
|
+
const topRight = applyToPoint21(transform, [width, 0]);
|
|
2477
|
+
const bottomRight = applyToPoint21(transform, [width, height]);
|
|
2478
|
+
const bottomLeft = applyToPoint21(transform, [0, height]);
|
|
2479
|
+
const path = `M ${topLeft[0]} ${topLeft[1]} L ${topRight[0]} ${topRight[1]} L ${bottomRight[0]} ${bottomRight[1]} L ${bottomLeft[0]} ${bottomLeft[1]} Z`;
|
|
2480
|
+
const isCoveredWithSolderMask = pcbPanel.covered_with_solder_mask !== false;
|
|
2481
|
+
const shouldRenderSolderMask = Boolean(
|
|
2482
|
+
renderSolderMask && isCoveredWithSolderMask
|
|
2483
|
+
);
|
|
2484
|
+
return [
|
|
2485
|
+
{
|
|
2486
|
+
name: "path",
|
|
2487
|
+
type: "element",
|
|
2488
|
+
value: "",
|
|
2489
|
+
children: [],
|
|
2490
|
+
attributes: {
|
|
2491
|
+
class: "pcb-panel",
|
|
2492
|
+
d: path,
|
|
2493
|
+
fill: shouldRenderSolderMask ? colorMap2.soldermask.top : "none",
|
|
2494
|
+
stroke: colorMap2.boardOutline,
|
|
2495
|
+
"stroke-width": (0.1 * Math.abs(transform.a)).toString(),
|
|
2496
|
+
"data-type": "pcb_panel",
|
|
2497
|
+
"data-pcb-layer": "board"
|
|
2498
|
+
}
|
|
2499
|
+
}
|
|
2500
|
+
];
|
|
2501
|
+
}
|
|
2502
|
+
|
|
2503
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
2504
|
+
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
2471
2505
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
2472
2506
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
2473
|
-
const [x, y] =
|
|
2507
|
+
const [x, y] = applyToPoint22(transform, [hole.x, hole.y]);
|
|
2474
2508
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
2475
2509
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
2476
2510
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -2516,10 +2550,10 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
2516
2550
|
}
|
|
2517
2551
|
|
|
2518
2552
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
2519
|
-
import { applyToPoint as
|
|
2553
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
2520
2554
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
2521
2555
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
2522
|
-
const [x, y] =
|
|
2556
|
+
const [x, y] = applyToPoint23(transform, [hole.x, hole.y]);
|
|
2523
2557
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
2524
2558
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
2525
2559
|
const radius = scaledDiameter / 2;
|
|
@@ -2657,7 +2691,7 @@ import {
|
|
|
2657
2691
|
getFullConnectivityMapFromCircuitJson
|
|
2658
2692
|
} from "circuit-json-to-connectivity-map";
|
|
2659
2693
|
import "svgson";
|
|
2660
|
-
import { applyToPoint as
|
|
2694
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
2661
2695
|
|
|
2662
2696
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
2663
2697
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -2737,11 +2771,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
2737
2771
|
});
|
|
2738
2772
|
const svgObjects = [];
|
|
2739
2773
|
for (const line of ratsNestLines) {
|
|
2740
|
-
const transformedStart =
|
|
2774
|
+
const transformedStart = applyToPoint24(transform, [
|
|
2741
2775
|
line.startPoint.x,
|
|
2742
2776
|
line.startPoint.y
|
|
2743
2777
|
]);
|
|
2744
|
-
const transformedEnd =
|
|
2778
|
+
const transformedEnd = applyToPoint24(transform, [
|
|
2745
2779
|
line.endPoint.x,
|
|
2746
2780
|
line.endPoint.y
|
|
2747
2781
|
]);
|
|
@@ -2769,7 +2803,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
2769
2803
|
|
|
2770
2804
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
2771
2805
|
import {
|
|
2772
|
-
applyToPoint as
|
|
2806
|
+
applyToPoint as applyToPoint25,
|
|
2773
2807
|
compose as compose3,
|
|
2774
2808
|
rotate as rotate3,
|
|
2775
2809
|
translate as translate3,
|
|
@@ -2779,7 +2813,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2779
2813
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
2780
2814
|
if (cutout.shape === "rect") {
|
|
2781
2815
|
const rectCutout = cutout;
|
|
2782
|
-
const [cx, cy] =
|
|
2816
|
+
const [cx, cy] = applyToPoint25(transform, [
|
|
2783
2817
|
rectCutout.center.x,
|
|
2784
2818
|
rectCutout.center.y
|
|
2785
2819
|
]);
|
|
@@ -2810,7 +2844,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2810
2844
|
}
|
|
2811
2845
|
if (cutout.shape === "circle") {
|
|
2812
2846
|
const circleCutout = cutout;
|
|
2813
|
-
const [cx, cy] =
|
|
2847
|
+
const [cx, cy] = applyToPoint25(transform, [
|
|
2814
2848
|
circleCutout.center.x,
|
|
2815
2849
|
circleCutout.center.y
|
|
2816
2850
|
]);
|
|
@@ -2837,7 +2871,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2837
2871
|
const polygonCutout = cutout;
|
|
2838
2872
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
2839
2873
|
const transformedPoints = polygonCutout.points.map(
|
|
2840
|
-
(p) =>
|
|
2874
|
+
(p) => applyToPoint25(transform, [p.x, p.y])
|
|
2841
2875
|
);
|
|
2842
2876
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
2843
2877
|
return [
|
|
@@ -2861,7 +2895,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
2861
2895
|
|
|
2862
2896
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
2863
2897
|
import {
|
|
2864
|
-
applyToPoint as
|
|
2898
|
+
applyToPoint as applyToPoint27,
|
|
2865
2899
|
compose as compose4,
|
|
2866
2900
|
rotate as rotate4,
|
|
2867
2901
|
toString as matrixToString7,
|
|
@@ -2869,11 +2903,11 @@ import {
|
|
|
2869
2903
|
} from "transformation-matrix";
|
|
2870
2904
|
|
|
2871
2905
|
// lib/utils/ring-to-path-d.ts
|
|
2872
|
-
import { applyToPoint as
|
|
2906
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
2873
2907
|
function ringToPathD(vertices, transform) {
|
|
2874
2908
|
if (vertices.length === 0) return "";
|
|
2875
2909
|
const transformedVertices = vertices.map((v) => {
|
|
2876
|
-
const [x, y] =
|
|
2910
|
+
const [x, y] = applyToPoint26(transform, [v.x, v.y]);
|
|
2877
2911
|
return { ...v, x, y };
|
|
2878
2912
|
});
|
|
2879
2913
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -2906,7 +2940,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
2906
2940
|
const color = layerNameToColor(layer, colorMap2);
|
|
2907
2941
|
const opacity = "0.5";
|
|
2908
2942
|
if (pour.shape === "rect") {
|
|
2909
|
-
const [cx, cy] =
|
|
2943
|
+
const [cx, cy] = applyToPoint27(transform, [pour.center.x, pour.center.y]);
|
|
2910
2944
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
2911
2945
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
2912
2946
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -2936,7 +2970,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
2936
2970
|
if (pour.shape === "polygon") {
|
|
2937
2971
|
if (!pour.points || pour.points.length === 0) return [];
|
|
2938
2972
|
const transformedPoints = pour.points.map(
|
|
2939
|
-
(p) =>
|
|
2973
|
+
(p) => applyToPoint27(transform, [p.x, p.y])
|
|
2940
2974
|
);
|
|
2941
2975
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
2942
2976
|
return [
|
|
@@ -3121,11 +3155,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
3121
3155
|
}
|
|
3122
3156
|
|
|
3123
3157
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
3124
|
-
import { applyToPoint as
|
|
3158
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
3125
3159
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
3126
3160
|
const { transform } = ctx;
|
|
3127
3161
|
const { center, width, height, rotation = 0 } = component;
|
|
3128
|
-
const [x, y] =
|
|
3162
|
+
const [x, y] = applyToPoint28(transform, [center.x, center.y]);
|
|
3129
3163
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3130
3164
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3131
3165
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -3163,6 +3197,61 @@ function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
|
3163
3197
|
];
|
|
3164
3198
|
}
|
|
3165
3199
|
|
|
3200
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
3201
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
3202
|
+
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
3203
|
+
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
3204
|
+
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
3205
|
+
const { transform } = ctx;
|
|
3206
|
+
const { center, width, height } = pcbGroup;
|
|
3207
|
+
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
3208
|
+
console.error("Invalid pcb_group data", { center, width, height });
|
|
3209
|
+
return [];
|
|
3210
|
+
}
|
|
3211
|
+
const halfWidth = width / 2;
|
|
3212
|
+
const halfHeight = height / 2;
|
|
3213
|
+
const [topLeftX, topLeftY] = applyToPoint29(transform, [
|
|
3214
|
+
center.x - halfWidth,
|
|
3215
|
+
center.y + halfHeight
|
|
3216
|
+
]);
|
|
3217
|
+
const [bottomRightX, bottomRightY] = applyToPoint29(transform, [
|
|
3218
|
+
center.x + halfWidth,
|
|
3219
|
+
center.y - halfHeight
|
|
3220
|
+
]);
|
|
3221
|
+
const rectX = Math.min(topLeftX, bottomRightX);
|
|
3222
|
+
const rectY = Math.min(topLeftY, bottomRightY);
|
|
3223
|
+
const rectWidth = Math.abs(bottomRightX - topLeftX);
|
|
3224
|
+
const rectHeight = Math.abs(bottomRightY - topLeftY);
|
|
3225
|
+
const transformedStrokeWidth = DEFAULT_STROKE_WIDTH * Math.abs(transform.a);
|
|
3226
|
+
const dashLength = 0.3 * Math.abs(transform.a);
|
|
3227
|
+
const gapLength = 0.15 * Math.abs(transform.a);
|
|
3228
|
+
const attributes = {
|
|
3229
|
+
x: rectX.toString(),
|
|
3230
|
+
y: rectY.toString(),
|
|
3231
|
+
width: rectWidth.toString(),
|
|
3232
|
+
height: rectHeight.toString(),
|
|
3233
|
+
class: "pcb-group",
|
|
3234
|
+
fill: "none",
|
|
3235
|
+
stroke: DEFAULT_GROUP_COLOR,
|
|
3236
|
+
"stroke-width": transformedStrokeWidth.toString(),
|
|
3237
|
+
"stroke-dasharray": `${dashLength} ${gapLength}`,
|
|
3238
|
+
"data-type": "pcb_group",
|
|
3239
|
+
"data-pcb-group-id": pcbGroup.pcb_group_id,
|
|
3240
|
+
"data-pcb-layer": "overlay"
|
|
3241
|
+
};
|
|
3242
|
+
if (pcbGroup.name) {
|
|
3243
|
+
attributes["data-group-name"] = pcbGroup.name;
|
|
3244
|
+
}
|
|
3245
|
+
const svgObject = {
|
|
3246
|
+
name: "rect",
|
|
3247
|
+
type: "element",
|
|
3248
|
+
value: "",
|
|
3249
|
+
attributes,
|
|
3250
|
+
children: []
|
|
3251
|
+
};
|
|
3252
|
+
return [svgObject];
|
|
3253
|
+
}
|
|
3254
|
+
|
|
3166
3255
|
// lib/utils/get-software-used-string.ts
|
|
3167
3256
|
function getSoftwareUsedString(circuitJson) {
|
|
3168
3257
|
const metadata = circuitJson.find(
|
|
@@ -3175,7 +3264,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3175
3264
|
var package_default = {
|
|
3176
3265
|
name: "circuit-to-svg",
|
|
3177
3266
|
type: "module",
|
|
3178
|
-
version: "0.0.
|
|
3267
|
+
version: "0.0.245",
|
|
3179
3268
|
description: "Convert Circuit JSON to SVG",
|
|
3180
3269
|
main: "dist/index.js",
|
|
3181
3270
|
files: [
|
|
@@ -3199,7 +3288,7 @@ var package_default = {
|
|
|
3199
3288
|
"bun-match-svg": "^0.0.12",
|
|
3200
3289
|
esbuild: "^0.20.2",
|
|
3201
3290
|
"performance-now": "^2.1.0",
|
|
3202
|
-
"circuit-json": "^0.0.
|
|
3291
|
+
"circuit-json": "^0.0.284",
|
|
3203
3292
|
react: "19.1.0",
|
|
3204
3293
|
"react-cosmos": "7.0.0",
|
|
3205
3294
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -3225,6 +3314,7 @@ var CIRCUIT_TO_SVG_VERSION = package_default.version;
|
|
|
3225
3314
|
var TYPE_PRIORITY = {
|
|
3226
3315
|
pcb_background: 0,
|
|
3227
3316
|
pcb_boundary: 1,
|
|
3317
|
+
pcb_panel: 5,
|
|
3228
3318
|
pcb_board: 10,
|
|
3229
3319
|
pcb_cutout: 15,
|
|
3230
3320
|
pcb_hole: 18,
|
|
@@ -3338,7 +3428,14 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3338
3428
|
let boardMaxX = Number.NEGATIVE_INFINITY;
|
|
3339
3429
|
let boardMaxY = Number.NEGATIVE_INFINITY;
|
|
3340
3430
|
for (const circuitJsonElm of circuitJson) {
|
|
3341
|
-
if (circuitJsonElm.type === "
|
|
3431
|
+
if (circuitJsonElm.type === "pcb_panel") {
|
|
3432
|
+
const panel = circuitJsonElm;
|
|
3433
|
+
const width = Number(panel.width);
|
|
3434
|
+
const height = Number(panel.height);
|
|
3435
|
+
const center = { x: width / 2, y: height / 2 };
|
|
3436
|
+
updateBounds(center, width, height);
|
|
3437
|
+
updateBoardBounds(center, width, height);
|
|
3438
|
+
} else if (circuitJsonElm.type === "pcb_board") {
|
|
3342
3439
|
if (circuitJsonElm.outline && Array.isArray(circuitJsonElm.outline) && circuitJsonElm.outline.length >= 3) {
|
|
3343
3440
|
updateBoundsToIncludeOutline(circuitJsonElm.outline);
|
|
3344
3441
|
updateBoardBoundsToIncludeOutline(circuitJsonElm.outline);
|
|
@@ -3442,6 +3539,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3442
3539
|
transform,
|
|
3443
3540
|
layer,
|
|
3444
3541
|
shouldDrawErrors: options?.shouldDrawErrors,
|
|
3542
|
+
showPcbGroups: options?.showPcbGroups,
|
|
3445
3543
|
drawPaddingOutsideBoard,
|
|
3446
3544
|
colorMap: colorMap2,
|
|
3447
3545
|
renderSolderMask: options?.renderSolderMask
|
|
@@ -3656,19 +3754,23 @@ function createSvgObjects({
|
|
|
3656
3754
|
return createSvgObjectsFromPcbNoteLine(elm, ctx);
|
|
3657
3755
|
case "pcb_silkscreen_path":
|
|
3658
3756
|
return createSvgObjectsFromPcbSilkscreenPath(elm, ctx);
|
|
3757
|
+
case "pcb_panel":
|
|
3758
|
+
return ctx.drawPaddingOutsideBoard ? createSvgObjectsFromPcbPanel(elm, ctx) : [];
|
|
3659
3759
|
case "pcb_board":
|
|
3660
3760
|
return ctx.drawPaddingOutsideBoard ? createSvgObjectsFromPcbBoard(elm, ctx) : [];
|
|
3661
3761
|
case "pcb_via":
|
|
3662
3762
|
return createSvgObjectsFromPcbVia(elm, ctx);
|
|
3663
3763
|
case "pcb_cutout":
|
|
3664
3764
|
return createSvgObjectsFromPcbCutout(elm, ctx);
|
|
3765
|
+
case "pcb_group":
|
|
3766
|
+
return ctx.showPcbGroups ? createSvgObjectsFromPcbGroup(elm, ctx) : [];
|
|
3665
3767
|
default:
|
|
3666
3768
|
return [];
|
|
3667
3769
|
}
|
|
3668
3770
|
}
|
|
3669
3771
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
3670
|
-
const [x1, y1] =
|
|
3671
|
-
const [x2, y2] =
|
|
3772
|
+
const [x1, y1] = applyToPoint30(transform, [minX, minY]);
|
|
3773
|
+
const [x2, y2] = applyToPoint30(transform, [maxX, maxY]);
|
|
3672
3774
|
const width = Math.abs(x2 - x1);
|
|
3673
3775
|
const height = Math.abs(y2 - y1);
|
|
3674
3776
|
const x = Math.min(x1, x2);
|
|
@@ -3698,14 +3800,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
3698
3800
|
import { stringify as stringify2 } from "svgson";
|
|
3699
3801
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
3700
3802
|
import {
|
|
3701
|
-
applyToPoint as
|
|
3803
|
+
applyToPoint as applyToPoint37,
|
|
3702
3804
|
compose as compose6,
|
|
3703
3805
|
scale as scale3,
|
|
3704
3806
|
translate as translate6
|
|
3705
3807
|
} from "transformation-matrix";
|
|
3706
3808
|
|
|
3707
3809
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
3708
|
-
import { applyToPoint as
|
|
3810
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
3709
3811
|
var DEFAULT_BOARD_STYLE = {
|
|
3710
3812
|
fill: "none",
|
|
3711
3813
|
stroke: "rgb(0,0,0)",
|
|
@@ -3717,25 +3819,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
3717
3819
|
let path;
|
|
3718
3820
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
3719
3821
|
path = outline.map((point, index) => {
|
|
3720
|
-
const [x, y] =
|
|
3822
|
+
const [x, y] = applyToPoint31(transform, [point.x, point.y]);
|
|
3721
3823
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3722
3824
|
}).join(" ");
|
|
3723
3825
|
} else {
|
|
3724
3826
|
const halfWidth = width / 2;
|
|
3725
3827
|
const halfHeight = height / 2;
|
|
3726
|
-
const topLeft =
|
|
3828
|
+
const topLeft = applyToPoint31(transform, [
|
|
3727
3829
|
center.x - halfWidth,
|
|
3728
3830
|
center.y - halfHeight
|
|
3729
3831
|
]);
|
|
3730
|
-
const topRight =
|
|
3832
|
+
const topRight = applyToPoint31(transform, [
|
|
3731
3833
|
center.x + halfWidth,
|
|
3732
3834
|
center.y - halfHeight
|
|
3733
3835
|
]);
|
|
3734
|
-
const bottomRight =
|
|
3836
|
+
const bottomRight = applyToPoint31(transform, [
|
|
3735
3837
|
center.x + halfWidth,
|
|
3736
3838
|
center.y + halfHeight
|
|
3737
3839
|
]);
|
|
3738
|
-
const bottomLeft =
|
|
3840
|
+
const bottomLeft = applyToPoint31(transform, [
|
|
3739
3841
|
center.x - halfWidth,
|
|
3740
3842
|
center.y + halfHeight
|
|
3741
3843
|
]);
|
|
@@ -3761,7 +3863,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
3761
3863
|
}
|
|
3762
3864
|
|
|
3763
3865
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
3764
|
-
import { applyToPoint as
|
|
3866
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
3765
3867
|
|
|
3766
3868
|
// lib/utils/get-sch-font-size.ts
|
|
3767
3869
|
import "transformation-matrix";
|
|
@@ -3787,8 +3889,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
3787
3889
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
3788
3890
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
3789
3891
|
return null;
|
|
3790
|
-
const [x, y] =
|
|
3791
|
-
const [pinX, pinY] =
|
|
3892
|
+
const [x, y] = applyToPoint33(transform, [center.x, center.y]);
|
|
3893
|
+
const [pinX, pinY] = applyToPoint33(transform, [portPosition.x, portPosition.y]);
|
|
3792
3894
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3793
3895
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3794
3896
|
const isTopLayer = layer === "top";
|
|
@@ -3950,11 +4052,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
3950
4052
|
}
|
|
3951
4053
|
|
|
3952
4054
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
3953
|
-
import { applyToPoint as
|
|
4055
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
3954
4056
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
3955
4057
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
3956
4058
|
const { transform } = ctx;
|
|
3957
|
-
const [x, y] =
|
|
4059
|
+
const [x, y] = applyToPoint34(transform, [hole.x, hole.y]);
|
|
3958
4060
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
3959
4061
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
3960
4062
|
const radius = scaledDiameter / 2;
|
|
@@ -4018,12 +4120,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
4018
4120
|
}
|
|
4019
4121
|
|
|
4020
4122
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
4021
|
-
import { applyToPoint as
|
|
4123
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
4022
4124
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
4023
4125
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
4024
4126
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
4025
4127
|
const { transform } = ctx;
|
|
4026
|
-
const [x, y] =
|
|
4128
|
+
const [x, y] = applyToPoint35(transform, [hole.x, hole.y]);
|
|
4027
4129
|
if (hole.shape === "pill") {
|
|
4028
4130
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4029
4131
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -4118,7 +4220,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4118
4220
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
4119
4221
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4120
4222
|
const holeRadius = scaledHoleDiameter / 2;
|
|
4121
|
-
const [holeCx, holeCy] =
|
|
4223
|
+
const [holeCx, holeCy] = applyToPoint35(transform, [
|
|
4122
4224
|
circularHole.x + circularHole.hole_offset_x,
|
|
4123
4225
|
circularHole.y + circularHole.hole_offset_y
|
|
4124
4226
|
]);
|
|
@@ -4176,7 +4278,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4176
4278
|
const pillHoleWithOffsets = pillHole;
|
|
4177
4279
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
4178
4280
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
4179
|
-
const [holeCenterX, holeCenterY] =
|
|
4281
|
+
const [holeCenterX, holeCenterY] = applyToPoint35(transform, [
|
|
4180
4282
|
pillHole.x + holeOffsetX,
|
|
4181
4283
|
pillHole.y + holeOffsetY
|
|
4182
4284
|
]);
|
|
@@ -4238,7 +4340,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4238
4340
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
4239
4341
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
4240
4342
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
4241
|
-
const [holeCenterX, holeCenterY] =
|
|
4343
|
+
const [holeCenterX, holeCenterY] = applyToPoint35(transform, [
|
|
4242
4344
|
rotatedHole.x + holeOffsetX,
|
|
4243
4345
|
rotatedHole.y + holeOffsetY
|
|
4244
4346
|
]);
|
|
@@ -4294,14 +4396,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4294
4396
|
}
|
|
4295
4397
|
|
|
4296
4398
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
4297
|
-
import { applyToPoint as
|
|
4399
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
4298
4400
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
4299
4401
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
4300
4402
|
const { transform } = ctx;
|
|
4301
4403
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
4302
4404
|
const width = pad.width * Math.abs(transform.a);
|
|
4303
4405
|
const height = pad.height * Math.abs(transform.d);
|
|
4304
|
-
const [x, y] =
|
|
4406
|
+
const [x, y] = applyToPoint36(transform, [pad.x, pad.y]);
|
|
4305
4407
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4306
4408
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
4307
4409
|
return [
|
|
@@ -4353,7 +4455,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4353
4455
|
const width = pad.width * Math.abs(transform.a);
|
|
4354
4456
|
const height = pad.height * Math.abs(transform.d);
|
|
4355
4457
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4356
|
-
const [x, y] =
|
|
4458
|
+
const [x, y] = applyToPoint36(transform, [pad.x, pad.y]);
|
|
4357
4459
|
return [
|
|
4358
4460
|
{
|
|
4359
4461
|
name: "rect",
|
|
@@ -4376,7 +4478,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4376
4478
|
}
|
|
4377
4479
|
if (pad.shape === "circle") {
|
|
4378
4480
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4379
|
-
const [x, y] =
|
|
4481
|
+
const [x, y] = applyToPoint36(transform, [pad.x, pad.y]);
|
|
4380
4482
|
return [
|
|
4381
4483
|
{
|
|
4382
4484
|
name: "circle",
|
|
@@ -4396,7 +4498,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4396
4498
|
}
|
|
4397
4499
|
if (pad.shape === "polygon") {
|
|
4398
4500
|
const points = (pad.points ?? []).map(
|
|
4399
|
-
(point) =>
|
|
4501
|
+
(point) => applyToPoint36(transform, [point.x, point.y])
|
|
4400
4502
|
);
|
|
4401
4503
|
return [
|
|
4402
4504
|
{
|
|
@@ -4573,8 +4675,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
4573
4675
|
}
|
|
4574
4676
|
}
|
|
4575
4677
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
4576
|
-
const [x1, y1] =
|
|
4577
|
-
const [x2, y2] =
|
|
4678
|
+
const [x1, y1] = applyToPoint37(transform, [minX, minY]);
|
|
4679
|
+
const [x2, y2] = applyToPoint37(transform, [maxX, maxY]);
|
|
4578
4680
|
const width = Math.abs(x2 - x1);
|
|
4579
4681
|
const height = Math.abs(y2 - y1);
|
|
4580
4682
|
const x = Math.min(x1, x2);
|
|
@@ -4603,7 +4705,7 @@ import {
|
|
|
4603
4705
|
} from "transformation-matrix";
|
|
4604
4706
|
|
|
4605
4707
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
4606
|
-
import { applyToPoint as
|
|
4708
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
4607
4709
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
4608
4710
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
4609
4711
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -4617,25 +4719,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4617
4719
|
let path;
|
|
4618
4720
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4619
4721
|
path = outline.map((point, index) => {
|
|
4620
|
-
const [x, y] =
|
|
4722
|
+
const [x, y] = applyToPoint38(transform, [point.x, point.y]);
|
|
4621
4723
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4622
4724
|
}).join(" ");
|
|
4623
4725
|
} else {
|
|
4624
4726
|
const halfWidth = width / 2;
|
|
4625
4727
|
const halfHeight = height / 2;
|
|
4626
|
-
const topLeft =
|
|
4728
|
+
const topLeft = applyToPoint38(transform, [
|
|
4627
4729
|
center.x - halfWidth,
|
|
4628
4730
|
center.y - halfHeight
|
|
4629
4731
|
]);
|
|
4630
|
-
const topRight =
|
|
4732
|
+
const topRight = applyToPoint38(transform, [
|
|
4631
4733
|
center.x + halfWidth,
|
|
4632
4734
|
center.y - halfHeight
|
|
4633
4735
|
]);
|
|
4634
|
-
const bottomRight =
|
|
4736
|
+
const bottomRight = applyToPoint38(transform, [
|
|
4635
4737
|
center.x + halfWidth,
|
|
4636
4738
|
center.y + halfHeight
|
|
4637
4739
|
]);
|
|
4638
|
-
const bottomLeft =
|
|
4740
|
+
const bottomLeft = applyToPoint38(transform, [
|
|
4639
4741
|
center.x - halfWidth,
|
|
4640
4742
|
center.y + halfHeight
|
|
4641
4743
|
]);
|
|
@@ -4653,10 +4755,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4653
4755
|
const halfWidth = width2 / 2;
|
|
4654
4756
|
const halfHeight = height2 / 2;
|
|
4655
4757
|
const [tl, tr, br, bl] = [
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4758
|
+
applyToPoint38(transform, [x - halfWidth, y - halfHeight]),
|
|
4759
|
+
applyToPoint38(transform, [x + halfWidth, y - halfHeight]),
|
|
4760
|
+
applyToPoint38(transform, [x + halfWidth, y + halfHeight]),
|
|
4761
|
+
applyToPoint38(transform, [x - halfWidth, y + halfHeight])
|
|
4660
4762
|
];
|
|
4661
4763
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
4662
4764
|
} else if (cutout.shape === "circle") {
|
|
@@ -4706,7 +4808,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4706
4808
|
|
|
4707
4809
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
4708
4810
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
4709
|
-
import { applyToPoint as
|
|
4811
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
4710
4812
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
4711
4813
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
4712
4814
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -4716,7 +4818,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
4716
4818
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
4717
4819
|
return [];
|
|
4718
4820
|
}
|
|
4719
|
-
const [x, y] =
|
|
4821
|
+
const [x, y] = applyToPoint39(transform, [center.x, center.y]);
|
|
4720
4822
|
const scaledWidth = width * Math.abs(transform.a);
|
|
4721
4823
|
const scaledHeight = height * Math.abs(transform.d);
|
|
4722
4824
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -4777,11 +4879,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
4777
4879
|
}
|
|
4778
4880
|
|
|
4779
4881
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
4780
|
-
import { applyToPoint as
|
|
4882
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
4781
4883
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
4782
4884
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
4783
4885
|
const { transform } = ctx;
|
|
4784
|
-
const [x, y] =
|
|
4886
|
+
const [x, y] = applyToPoint40(transform, [hole.x, hole.y]);
|
|
4785
4887
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
4786
4888
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
4787
4889
|
const radius = scaledDiameter / 2;
|
|
@@ -4845,12 +4947,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
4845
4947
|
}
|
|
4846
4948
|
|
|
4847
4949
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
4848
|
-
import { applyToPoint as
|
|
4950
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
4849
4951
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
4850
4952
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
4851
4953
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
4852
4954
|
const { transform } = ctx;
|
|
4853
|
-
const [x, y] =
|
|
4955
|
+
const [x, y] = applyToPoint41(transform, [hole.x, hole.y]);
|
|
4854
4956
|
if (hole.shape === "pill") {
|
|
4855
4957
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4856
4958
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -5085,14 +5187,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
5085
5187
|
}
|
|
5086
5188
|
|
|
5087
5189
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
5088
|
-
import { applyToPoint as
|
|
5190
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
5089
5191
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
5090
5192
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
5091
5193
|
const { transform } = ctx;
|
|
5092
5194
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
5093
5195
|
const width = pad.width * Math.abs(transform.a);
|
|
5094
5196
|
const height = pad.height * Math.abs(transform.d);
|
|
5095
|
-
const [x, y] =
|
|
5197
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
5096
5198
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
5097
5199
|
return [
|
|
5098
5200
|
{
|
|
@@ -5135,7 +5237,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5135
5237
|
const width = pad.width * Math.abs(transform.a);
|
|
5136
5238
|
const height = pad.height * Math.abs(transform.d);
|
|
5137
5239
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5138
|
-
const [x, y] =
|
|
5240
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
5139
5241
|
return [
|
|
5140
5242
|
{
|
|
5141
5243
|
name: "rect",
|
|
@@ -5158,7 +5260,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5158
5260
|
}
|
|
5159
5261
|
if (pad.shape === "circle") {
|
|
5160
5262
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5161
|
-
const [x, y] =
|
|
5263
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
5162
5264
|
return [
|
|
5163
5265
|
{
|
|
5164
5266
|
name: "circle",
|
|
@@ -5178,7 +5280,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5178
5280
|
}
|
|
5179
5281
|
if (pad.shape === "polygon") {
|
|
5180
5282
|
const points = (pad.points ?? []).map(
|
|
5181
|
-
(point) =>
|
|
5283
|
+
(point) => applyToPoint42(transform, [point.x, point.y])
|
|
5182
5284
|
);
|
|
5183
5285
|
return [
|
|
5184
5286
|
{
|
|
@@ -5199,7 +5301,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5199
5301
|
}
|
|
5200
5302
|
|
|
5201
5303
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
5202
|
-
import { applyToPoint as
|
|
5304
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
5203
5305
|
import { calculateElbow } from "calculate-elbow";
|
|
5204
5306
|
|
|
5205
5307
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -5276,7 +5378,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5276
5378
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
5277
5379
|
if (!label_info) return [];
|
|
5278
5380
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
5279
|
-
const [port_x, port_y] =
|
|
5381
|
+
const [port_x, port_y] = applyToPoint43(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
5280
5382
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
5281
5383
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
5282
5384
|
const elbow_path = calculateElbow(
|
|
@@ -5417,7 +5519,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5417
5519
|
}
|
|
5418
5520
|
|
|
5419
5521
|
// lib/pinout/calculate-label-positions.ts
|
|
5420
|
-
import { applyToPoint as
|
|
5522
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
5421
5523
|
|
|
5422
5524
|
// lib/pinout/constants.ts
|
|
5423
5525
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -5455,7 +5557,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5455
5557
|
);
|
|
5456
5558
|
const mapToEdgePort = (pinout_label) => ({
|
|
5457
5559
|
pcb_port: pinout_label.pcb_port,
|
|
5458
|
-
y:
|
|
5560
|
+
y: applyToPoint44(transform, [
|
|
5459
5561
|
pinout_label.pcb_port.x,
|
|
5460
5562
|
pinout_label.pcb_port.y
|
|
5461
5563
|
])[1],
|
|
@@ -5470,7 +5572,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5470
5572
|
} else {
|
|
5471
5573
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
5472
5574
|
pcb_port: pinout_label.pcb_port,
|
|
5473
|
-
y:
|
|
5575
|
+
y: applyToPoint44(transform, [
|
|
5474
5576
|
pinout_label.pcb_port.x,
|
|
5475
5577
|
pinout_label.pcb_port.y
|
|
5476
5578
|
])[1],
|
|
@@ -5478,7 +5580,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5478
5580
|
})).sort((a, b) => a.y - b.y);
|
|
5479
5581
|
}
|
|
5480
5582
|
if (edge_ports.length === 0) return;
|
|
5481
|
-
const board_edge_x =
|
|
5583
|
+
const board_edge_x = applyToPoint44(transform, [
|
|
5482
5584
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
5483
5585
|
0
|
|
5484
5586
|
])[0];
|
|
@@ -5893,14 +5995,14 @@ import {
|
|
|
5893
5995
|
} from "transformation-matrix";
|
|
5894
5996
|
|
|
5895
5997
|
// lib/sch/draw-schematic-grid.ts
|
|
5896
|
-
import { applyToPoint as
|
|
5998
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
5897
5999
|
function drawSchematicGrid(params) {
|
|
5898
6000
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
5899
6001
|
const cellSize = params.cellSize ?? 1;
|
|
5900
6002
|
const labelCells = params.labelCells ?? false;
|
|
5901
6003
|
const gridLines = [];
|
|
5902
6004
|
const transformPoint = (x, y) => {
|
|
5903
|
-
const [transformedX, transformedY] =
|
|
6005
|
+
const [transformedX, transformedY] = applyToPoint45(params.transform, [x, y]);
|
|
5904
6006
|
return { x: transformedX, y: transformedY };
|
|
5905
6007
|
};
|
|
5906
6008
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -5981,15 +6083,15 @@ function drawSchematicGrid(params) {
|
|
|
5981
6083
|
}
|
|
5982
6084
|
|
|
5983
6085
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
5984
|
-
import { applyToPoint as
|
|
6086
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
5985
6087
|
function drawSchematicLabeledPoints(params) {
|
|
5986
6088
|
const { points, transform } = params;
|
|
5987
6089
|
const labeledPointsGroup = [];
|
|
5988
6090
|
for (const point of points) {
|
|
5989
|
-
const [x1, y1] =
|
|
5990
|
-
const [x2, y2] =
|
|
5991
|
-
const [x3, y3] =
|
|
5992
|
-
const [x4, y4] =
|
|
6091
|
+
const [x1, y1] = applyToPoint46(transform, [point.x - 0.1, point.y - 0.1]);
|
|
6092
|
+
const [x2, y2] = applyToPoint46(transform, [point.x + 0.1, point.y + 0.1]);
|
|
6093
|
+
const [x3, y3] = applyToPoint46(transform, [point.x - 0.1, point.y + 0.1]);
|
|
6094
|
+
const [x4, y4] = applyToPoint46(transform, [point.x + 0.1, point.y - 0.1]);
|
|
5993
6095
|
labeledPointsGroup.push({
|
|
5994
6096
|
name: "path",
|
|
5995
6097
|
type: "element",
|
|
@@ -6000,7 +6102,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
6000
6102
|
"stroke-opacity": "0.7"
|
|
6001
6103
|
}
|
|
6002
6104
|
});
|
|
6003
|
-
const [labelX, labelY] =
|
|
6105
|
+
const [labelX, labelY] = applyToPoint46(transform, [
|
|
6004
6106
|
point.x + 0.15,
|
|
6005
6107
|
point.y - 0.15
|
|
6006
6108
|
]);
|
|
@@ -7094,7 +7196,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
7094
7196
|
import { symbols } from "schematic-symbols";
|
|
7095
7197
|
import "svgson";
|
|
7096
7198
|
import {
|
|
7097
|
-
applyToPoint as
|
|
7199
|
+
applyToPoint as applyToPoint48,
|
|
7098
7200
|
compose as compose9
|
|
7099
7201
|
} from "transformation-matrix";
|
|
7100
7202
|
|
|
@@ -7178,13 +7280,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
7178
7280
|
}
|
|
7179
7281
|
|
|
7180
7282
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
7181
|
-
import { applyToPoint as
|
|
7283
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7182
7284
|
var createSvgSchErrorText = ({
|
|
7183
7285
|
text,
|
|
7184
7286
|
realCenter,
|
|
7185
7287
|
realToScreenTransform
|
|
7186
7288
|
}) => {
|
|
7187
|
-
const screenCenter =
|
|
7289
|
+
const screenCenter = applyToPoint47(realToScreenTransform, realCenter);
|
|
7188
7290
|
return {
|
|
7189
7291
|
type: "element",
|
|
7190
7292
|
name: "text",
|
|
@@ -7293,11 +7395,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7293
7395
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
7294
7396
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
7295
7397
|
};
|
|
7296
|
-
const [screenMinX, screenMinY] =
|
|
7398
|
+
const [screenMinX, screenMinY] = applyToPoint48(
|
|
7297
7399
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7298
7400
|
[bounds.minX, bounds.minY]
|
|
7299
7401
|
);
|
|
7300
|
-
const [screenMaxX, screenMaxY] =
|
|
7402
|
+
const [screenMaxX, screenMaxY] = applyToPoint48(
|
|
7301
7403
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7302
7404
|
[bounds.maxX, bounds.maxY]
|
|
7303
7405
|
);
|
|
@@ -7326,7 +7428,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7326
7428
|
name: "path",
|
|
7327
7429
|
attributes: {
|
|
7328
7430
|
d: points.map((p, i) => {
|
|
7329
|
-
const [x, y] =
|
|
7431
|
+
const [x, y] = applyToPoint48(
|
|
7330
7432
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7331
7433
|
[p.x, p.y]
|
|
7332
7434
|
);
|
|
@@ -7342,7 +7444,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7342
7444
|
});
|
|
7343
7445
|
}
|
|
7344
7446
|
for (const text of texts) {
|
|
7345
|
-
const screenTextPos =
|
|
7447
|
+
const screenTextPos = applyToPoint48(
|
|
7346
7448
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7347
7449
|
text
|
|
7348
7450
|
);
|
|
@@ -7394,7 +7496,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7394
7496
|
});
|
|
7395
7497
|
}
|
|
7396
7498
|
for (const box of boxes) {
|
|
7397
|
-
const screenBoxPos =
|
|
7499
|
+
const screenBoxPos = applyToPoint48(
|
|
7398
7500
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7399
7501
|
box
|
|
7400
7502
|
);
|
|
@@ -7418,7 +7520,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7418
7520
|
}
|
|
7419
7521
|
for (const port of symbol.ports) {
|
|
7420
7522
|
if (connectedSymbolPorts.has(port)) continue;
|
|
7421
|
-
const screenPortPos =
|
|
7523
|
+
const screenPortPos = applyToPoint48(
|
|
7422
7524
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7423
7525
|
port
|
|
7424
7526
|
);
|
|
@@ -7438,7 +7540,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7438
7540
|
});
|
|
7439
7541
|
}
|
|
7440
7542
|
for (const circle of circles) {
|
|
7441
|
-
const screenCirclePos =
|
|
7543
|
+
const screenCirclePos = applyToPoint48(
|
|
7442
7544
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7443
7545
|
circle
|
|
7444
7546
|
);
|
|
@@ -7465,14 +7567,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7465
7567
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
7466
7568
|
import "schematic-symbols";
|
|
7467
7569
|
import "svgson";
|
|
7468
|
-
import { applyToPoint as
|
|
7570
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
7469
7571
|
|
|
7470
7572
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
7471
7573
|
import "transformation-matrix";
|
|
7472
7574
|
import "@tscircuit/circuit-json-util";
|
|
7473
7575
|
|
|
7474
7576
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
7475
|
-
import { applyToPoint as
|
|
7577
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7476
7578
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
7477
7579
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
7478
7580
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -7525,8 +7627,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7525
7627
|
realEdgePos.y += realPinLineLength;
|
|
7526
7628
|
break;
|
|
7527
7629
|
}
|
|
7528
|
-
const screenSchPortPos =
|
|
7529
|
-
const screenRealEdgePos =
|
|
7630
|
+
const screenSchPortPos = applyToPoint49(transform, schPort.center);
|
|
7631
|
+
const screenRealEdgePos = applyToPoint49(transform, realEdgePos);
|
|
7530
7632
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
7531
7633
|
const realLineEnd = { ...schPort.center };
|
|
7532
7634
|
if (!isConnected) {
|
|
@@ -7545,7 +7647,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7545
7647
|
break;
|
|
7546
7648
|
}
|
|
7547
7649
|
}
|
|
7548
|
-
const screenLineEnd =
|
|
7650
|
+
const screenLineEnd = applyToPoint49(transform, realLineEnd);
|
|
7549
7651
|
svgObjects.push({
|
|
7550
7652
|
name: "line",
|
|
7551
7653
|
type: "element",
|
|
@@ -7666,7 +7768,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7666
7768
|
};
|
|
7667
7769
|
|
|
7668
7770
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
7669
|
-
import { applyToPoint as
|
|
7771
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
7670
7772
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
7671
7773
|
const svgObjects = [];
|
|
7672
7774
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -7684,7 +7786,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7684
7786
|
} else {
|
|
7685
7787
|
realPinNumberPos.y += 0.02;
|
|
7686
7788
|
}
|
|
7687
|
-
const screenPinNumberTextPos =
|
|
7789
|
+
const screenPinNumberTextPos = applyToPoint50(transform, realPinNumberPos);
|
|
7688
7790
|
svgObjects.push({
|
|
7689
7791
|
name: "text",
|
|
7690
7792
|
type: "element",
|
|
@@ -7714,7 +7816,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7714
7816
|
};
|
|
7715
7817
|
|
|
7716
7818
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
7717
|
-
import { applyToPoint as
|
|
7819
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
7718
7820
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
7719
7821
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
7720
7822
|
const svgObjects = [];
|
|
@@ -7728,7 +7830,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
7728
7830
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
7729
7831
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7730
7832
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7731
|
-
const screenPinNumberTextPos =
|
|
7833
|
+
const screenPinNumberTextPos = applyToPoint51(transform, realPinNumberPos);
|
|
7732
7834
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
7733
7835
|
if (!label) return [];
|
|
7734
7836
|
const isNegated = label.startsWith("N_");
|
|
@@ -7776,13 +7878,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
7776
7878
|
};
|
|
7777
7879
|
|
|
7778
7880
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
7779
|
-
import { applyToPoint as
|
|
7881
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
7780
7882
|
var createSvgSchText = ({
|
|
7781
7883
|
elm,
|
|
7782
7884
|
transform,
|
|
7783
7885
|
colorMap: colorMap2
|
|
7784
7886
|
}) => {
|
|
7785
|
-
const center =
|
|
7887
|
+
const center = applyToPoint53(transform, elm.position);
|
|
7786
7888
|
const textAnchorMap = {
|
|
7787
7889
|
center: "middle",
|
|
7788
7890
|
center_right: "end",
|
|
@@ -7866,11 +7968,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
7866
7968
|
colorMap: colorMap2
|
|
7867
7969
|
}) => {
|
|
7868
7970
|
const svgObjects = [];
|
|
7869
|
-
const componentScreenTopLeft =
|
|
7971
|
+
const componentScreenTopLeft = applyToPoint54(transform, {
|
|
7870
7972
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
7871
7973
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
7872
7974
|
});
|
|
7873
|
-
const componentScreenBottomRight =
|
|
7975
|
+
const componentScreenBottomRight = applyToPoint54(transform, {
|
|
7874
7976
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
7875
7977
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
7876
7978
|
});
|
|
@@ -7956,13 +8058,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
7956
8058
|
}
|
|
7957
8059
|
|
|
7958
8060
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
7959
|
-
import { applyToPoint as
|
|
8061
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
7960
8062
|
function createSvgObjectsFromSchVoltageProbe({
|
|
7961
8063
|
probe,
|
|
7962
8064
|
transform,
|
|
7963
8065
|
colorMap: colorMap2
|
|
7964
8066
|
}) {
|
|
7965
|
-
const [screenX, screenY] =
|
|
8067
|
+
const [screenX, screenY] = applyToPoint55(transform, [
|
|
7966
8068
|
probe.position.x,
|
|
7967
8069
|
probe.position.y
|
|
7968
8070
|
]);
|
|
@@ -8022,17 +8124,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
8022
8124
|
}
|
|
8023
8125
|
|
|
8024
8126
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
8025
|
-
import { applyToPoint as
|
|
8127
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
8026
8128
|
function createSvgObjectsFromSchDebugObject({
|
|
8027
8129
|
debugObject,
|
|
8028
8130
|
transform
|
|
8029
8131
|
}) {
|
|
8030
8132
|
if (debugObject.shape === "rect") {
|
|
8031
|
-
let [screenLeft, screenTop] =
|
|
8133
|
+
let [screenLeft, screenTop] = applyToPoint56(transform, [
|
|
8032
8134
|
debugObject.center.x - debugObject.size.width / 2,
|
|
8033
8135
|
debugObject.center.y - debugObject.size.height / 2
|
|
8034
8136
|
]);
|
|
8035
|
-
let [screenRight, screenBottom] =
|
|
8137
|
+
let [screenRight, screenBottom] = applyToPoint56(transform, [
|
|
8036
8138
|
debugObject.center.x + debugObject.size.width / 2,
|
|
8037
8139
|
debugObject.center.y + debugObject.size.height / 2
|
|
8038
8140
|
]);
|
|
@@ -8042,7 +8144,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8042
8144
|
];
|
|
8043
8145
|
const width = Math.abs(screenRight - screenLeft);
|
|
8044
8146
|
const height = Math.abs(screenBottom - screenTop);
|
|
8045
|
-
const [screenCenterX, screenCenterY] =
|
|
8147
|
+
const [screenCenterX, screenCenterY] = applyToPoint56(transform, [
|
|
8046
8148
|
debugObject.center.x,
|
|
8047
8149
|
debugObject.center.y
|
|
8048
8150
|
]);
|
|
@@ -8088,11 +8190,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8088
8190
|
];
|
|
8089
8191
|
}
|
|
8090
8192
|
if (debugObject.shape === "line") {
|
|
8091
|
-
const [screenStartX, screenStartY] =
|
|
8193
|
+
const [screenStartX, screenStartY] = applyToPoint56(transform, [
|
|
8092
8194
|
debugObject.start.x,
|
|
8093
8195
|
debugObject.start.y
|
|
8094
8196
|
]);
|
|
8095
|
-
const [screenEndX, screenEndY] =
|
|
8197
|
+
const [screenEndX, screenEndY] = applyToPoint56(transform, [
|
|
8096
8198
|
debugObject.end.x,
|
|
8097
8199
|
debugObject.end.y
|
|
8098
8200
|
]);
|
|
@@ -8142,7 +8244,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8142
8244
|
}
|
|
8143
8245
|
|
|
8144
8246
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
8145
|
-
import { applyToPoint as
|
|
8247
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
8146
8248
|
function createSchematicTrace({
|
|
8147
8249
|
trace,
|
|
8148
8250
|
transform,
|
|
@@ -8156,11 +8258,11 @@ function createSchematicTrace({
|
|
|
8156
8258
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
8157
8259
|
const edge = edges[edgeIndex];
|
|
8158
8260
|
if (edge.is_crossing) continue;
|
|
8159
|
-
const [screenFromX, screenFromY] =
|
|
8261
|
+
const [screenFromX, screenFromY] = applyToPoint57(transform, [
|
|
8160
8262
|
edge.from.x,
|
|
8161
8263
|
edge.from.y
|
|
8162
8264
|
]);
|
|
8163
|
-
const [screenToX, screenToY] =
|
|
8265
|
+
const [screenToX, screenToY] = applyToPoint57(transform, [
|
|
8164
8266
|
edge.to.x,
|
|
8165
8267
|
edge.to.y
|
|
8166
8268
|
]);
|
|
@@ -8204,11 +8306,11 @@ function createSchematicTrace({
|
|
|
8204
8306
|
}
|
|
8205
8307
|
for (const edge of edges) {
|
|
8206
8308
|
if (!edge.is_crossing) continue;
|
|
8207
|
-
const [screenFromX, screenFromY] =
|
|
8309
|
+
const [screenFromX, screenFromY] = applyToPoint57(transform, [
|
|
8208
8310
|
edge.from.x,
|
|
8209
8311
|
edge.from.y
|
|
8210
8312
|
]);
|
|
8211
|
-
const [screenToX, screenToY] =
|
|
8313
|
+
const [screenToX, screenToY] = applyToPoint57(transform, [
|
|
8212
8314
|
edge.to.x,
|
|
8213
8315
|
edge.to.y
|
|
8214
8316
|
]);
|
|
@@ -8252,7 +8354,7 @@ function createSchematicTrace({
|
|
|
8252
8354
|
}
|
|
8253
8355
|
if (trace.junctions) {
|
|
8254
8356
|
for (const junction of trace.junctions) {
|
|
8255
|
-
const [screenX, screenY] =
|
|
8357
|
+
const [screenX, screenY] = applyToPoint57(transform, [
|
|
8256
8358
|
junction.x,
|
|
8257
8359
|
junction.y
|
|
8258
8360
|
]);
|
|
@@ -8307,7 +8409,7 @@ function createSchematicTrace({
|
|
|
8307
8409
|
|
|
8308
8410
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
8309
8411
|
import {
|
|
8310
|
-
applyToPoint as
|
|
8412
|
+
applyToPoint as applyToPoint59,
|
|
8311
8413
|
compose as compose11,
|
|
8312
8414
|
rotate as rotate6,
|
|
8313
8415
|
scale as scale6,
|
|
@@ -8316,7 +8418,7 @@ import {
|
|
|
8316
8418
|
|
|
8317
8419
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
8318
8420
|
import {
|
|
8319
|
-
applyToPoint as
|
|
8421
|
+
applyToPoint as applyToPoint58,
|
|
8320
8422
|
compose as compose10,
|
|
8321
8423
|
rotate as rotate5,
|
|
8322
8424
|
scale as scale5,
|
|
@@ -8391,7 +8493,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8391
8493
|
x: symbolBounds.minX,
|
|
8392
8494
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
8393
8495
|
};
|
|
8394
|
-
const rotatedSymbolEnd =
|
|
8496
|
+
const rotatedSymbolEnd = applyToPoint58(rotationMatrix, symbolEndPoint);
|
|
8395
8497
|
const symbolToRealTransform = compose10(
|
|
8396
8498
|
translate10(
|
|
8397
8499
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -8401,11 +8503,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8401
8503
|
scale5(1)
|
|
8402
8504
|
// Use full symbol size
|
|
8403
8505
|
);
|
|
8404
|
-
const [screenMinX, screenMinY] =
|
|
8506
|
+
const [screenMinX, screenMinY] = applyToPoint58(
|
|
8405
8507
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8406
8508
|
[bounds.minX, bounds.minY]
|
|
8407
8509
|
);
|
|
8408
|
-
const [screenMaxX, screenMaxY] =
|
|
8510
|
+
const [screenMaxX, screenMaxY] = applyToPoint58(
|
|
8409
8511
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8410
8512
|
[bounds.maxX, bounds.maxY]
|
|
8411
8513
|
);
|
|
@@ -8429,7 +8531,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8429
8531
|
});
|
|
8430
8532
|
for (const path of symbolPaths) {
|
|
8431
8533
|
const symbolPath = path.points.map((p, i) => {
|
|
8432
|
-
const [x, y] =
|
|
8534
|
+
const [x, y] = applyToPoint58(
|
|
8433
8535
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8434
8536
|
[p.x, p.y]
|
|
8435
8537
|
);
|
|
@@ -8450,7 +8552,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8450
8552
|
});
|
|
8451
8553
|
}
|
|
8452
8554
|
for (const text of symbolTexts) {
|
|
8453
|
-
const screenTextPos =
|
|
8555
|
+
const screenTextPos = applyToPoint58(
|
|
8454
8556
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8455
8557
|
text
|
|
8456
8558
|
);
|
|
@@ -8492,7 +8594,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8492
8594
|
});
|
|
8493
8595
|
}
|
|
8494
8596
|
for (const box of symbolBoxes) {
|
|
8495
|
-
const screenBoxPos =
|
|
8597
|
+
const screenBoxPos = applyToPoint58(
|
|
8496
8598
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8497
8599
|
box
|
|
8498
8600
|
);
|
|
@@ -8515,7 +8617,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8515
8617
|
});
|
|
8516
8618
|
}
|
|
8517
8619
|
for (const circle of symbolCircles) {
|
|
8518
|
-
const screenCirclePos =
|
|
8620
|
+
const screenCirclePos = applyToPoint58(
|
|
8519
8621
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8520
8622
|
circle
|
|
8521
8623
|
);
|
|
@@ -8560,14 +8662,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8560
8662
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
8561
8663
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
8562
8664
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
8563
|
-
const screenCenter =
|
|
8665
|
+
const screenCenter = applyToPoint59(realToScreenTransform, schNetLabel.center);
|
|
8564
8666
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
8565
8667
|
schNetLabel.anchor_side
|
|
8566
8668
|
);
|
|
8567
8669
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
8568
8670
|
screenTextGrowthVec.y *= -1;
|
|
8569
8671
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
8570
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
8672
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint59(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
8571
8673
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
8572
8674
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
8573
8675
|
};
|
|
@@ -8608,7 +8710,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8608
8710
|
y: -0.6
|
|
8609
8711
|
}
|
|
8610
8712
|
].map(
|
|
8611
|
-
(fontRelativePoint) =>
|
|
8713
|
+
(fontRelativePoint) => applyToPoint59(
|
|
8612
8714
|
compose11(
|
|
8613
8715
|
realToScreenTransform,
|
|
8614
8716
|
translate11(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -8685,17 +8787,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8685
8787
|
};
|
|
8686
8788
|
|
|
8687
8789
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
8688
|
-
import { applyToPoint as
|
|
8790
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
8689
8791
|
var createSvgObjectsFromSchematicBox = ({
|
|
8690
8792
|
schematicBox,
|
|
8691
8793
|
transform,
|
|
8692
8794
|
colorMap: colorMap2
|
|
8693
8795
|
}) => {
|
|
8694
|
-
const topLeft =
|
|
8796
|
+
const topLeft = applyToPoint60(transform, {
|
|
8695
8797
|
x: schematicBox.x,
|
|
8696
8798
|
y: schematicBox.y
|
|
8697
8799
|
});
|
|
8698
|
-
const bottomRight =
|
|
8800
|
+
const bottomRight = applyToPoint60(transform, {
|
|
8699
8801
|
x: schematicBox.x + schematicBox.width,
|
|
8700
8802
|
y: schematicBox.y + schematicBox.height
|
|
8701
8803
|
});
|
|
@@ -8731,7 +8833,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
8731
8833
|
};
|
|
8732
8834
|
|
|
8733
8835
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
8734
|
-
import { applyToPoint as
|
|
8836
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
8735
8837
|
var createSvgObjectsFromSchematicTable = ({
|
|
8736
8838
|
schematicTable,
|
|
8737
8839
|
transform,
|
|
@@ -8764,11 +8866,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8764
8866
|
const svgObjects = [];
|
|
8765
8867
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
8766
8868
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
8767
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
8869
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint61(transform, [
|
|
8768
8870
|
topLeftX,
|
|
8769
8871
|
topLeftY
|
|
8770
8872
|
]);
|
|
8771
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
8873
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint61(transform, [
|
|
8772
8874
|
topLeftX + totalWidth,
|
|
8773
8875
|
topLeftY - totalHeight
|
|
8774
8876
|
]);
|
|
@@ -8800,8 +8902,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8800
8902
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
8801
8903
|
);
|
|
8802
8904
|
if (!isMerged) {
|
|
8803
|
-
const start =
|
|
8804
|
-
const end =
|
|
8905
|
+
const start = applyToPoint61(transform, { x: currentX, y: segmentStartY });
|
|
8906
|
+
const end = applyToPoint61(transform, { x: currentX, y: segmentEndY });
|
|
8805
8907
|
svgObjects.push({
|
|
8806
8908
|
name: "line",
|
|
8807
8909
|
type: "element",
|
|
@@ -8830,11 +8932,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8830
8932
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
8831
8933
|
);
|
|
8832
8934
|
if (!isMerged) {
|
|
8833
|
-
const start =
|
|
8935
|
+
const start = applyToPoint61(transform, {
|
|
8834
8936
|
x: segmentStartX,
|
|
8835
8937
|
y: currentY
|
|
8836
8938
|
});
|
|
8837
|
-
const end =
|
|
8939
|
+
const end = applyToPoint61(transform, { x: segmentEndX, y: currentY });
|
|
8838
8940
|
svgObjects.push({
|
|
8839
8941
|
name: "line",
|
|
8840
8942
|
type: "element",
|
|
@@ -8876,7 +8978,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8876
8978
|
} else if (vertical_align === "bottom") {
|
|
8877
8979
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
8878
8980
|
}
|
|
8879
|
-
const screenTextAnchorPos =
|
|
8981
|
+
const screenTextAnchorPos = applyToPoint61(transform, realTextAnchorPos);
|
|
8880
8982
|
const fontSize = getSchScreenFontSize(
|
|
8881
8983
|
transform,
|
|
8882
8984
|
"reference_designator",
|
|
@@ -8932,13 +9034,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8932
9034
|
|
|
8933
9035
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
8934
9036
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
8935
|
-
import { applyToPoint as
|
|
9037
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
8936
9038
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
8937
9039
|
var createSvgObjectsForSchPortHover = ({
|
|
8938
9040
|
schPort,
|
|
8939
9041
|
transform
|
|
8940
9042
|
}) => {
|
|
8941
|
-
const screenSchPortPos =
|
|
9043
|
+
const screenSchPortPos = applyToPoint62(transform, schPort.center);
|
|
8942
9044
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
8943
9045
|
return [
|
|
8944
9046
|
{
|
|
@@ -8983,14 +9085,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
8983
9085
|
};
|
|
8984
9086
|
|
|
8985
9087
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
8986
|
-
import { applyToPoint as
|
|
9088
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
8987
9089
|
function createSvgObjectsFromSchematicLine({
|
|
8988
9090
|
schLine,
|
|
8989
9091
|
transform,
|
|
8990
9092
|
colorMap: colorMap2
|
|
8991
9093
|
}) {
|
|
8992
|
-
const p1 =
|
|
8993
|
-
const p2 =
|
|
9094
|
+
const p1 = applyToPoint63(transform, { x: schLine.x1, y: schLine.y1 });
|
|
9095
|
+
const p2 = applyToPoint63(transform, { x: schLine.x2, y: schLine.y2 });
|
|
8994
9096
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
8995
9097
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
8996
9098
|
return [
|
|
@@ -9019,13 +9121,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
9019
9121
|
}
|
|
9020
9122
|
|
|
9021
9123
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
9022
|
-
import { applyToPoint as
|
|
9124
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
9023
9125
|
function createSvgObjectsFromSchematicCircle({
|
|
9024
9126
|
schCircle,
|
|
9025
9127
|
transform,
|
|
9026
9128
|
colorMap: colorMap2
|
|
9027
9129
|
}) {
|
|
9028
|
-
const center =
|
|
9130
|
+
const center = applyToPoint64(transform, schCircle.center);
|
|
9029
9131
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
9030
9132
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
9031
9133
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -9055,13 +9157,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
9055
9157
|
}
|
|
9056
9158
|
|
|
9057
9159
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
9058
|
-
import { applyToPoint as
|
|
9160
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
9059
9161
|
function createSvgObjectsFromSchematicRect({
|
|
9060
9162
|
schRect,
|
|
9061
9163
|
transform,
|
|
9062
9164
|
colorMap: colorMap2
|
|
9063
9165
|
}) {
|
|
9064
|
-
const center =
|
|
9166
|
+
const center = applyToPoint65(transform, schRect.center);
|
|
9065
9167
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
9066
9168
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
9067
9169
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -9097,13 +9199,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
9097
9199
|
}
|
|
9098
9200
|
|
|
9099
9201
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
9100
|
-
import { applyToPoint as
|
|
9202
|
+
import { applyToPoint as applyToPoint66 } from "transformation-matrix";
|
|
9101
9203
|
function createSvgObjectsFromSchematicArc({
|
|
9102
9204
|
schArc,
|
|
9103
9205
|
transform,
|
|
9104
9206
|
colorMap: colorMap2
|
|
9105
9207
|
}) {
|
|
9106
|
-
const center =
|
|
9208
|
+
const center = applyToPoint66(transform, schArc.center);
|
|
9107
9209
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
9108
9210
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
9109
9211
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -10138,18 +10240,18 @@ function formatNumber2(value) {
|
|
|
10138
10240
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
10139
10241
|
import { stringify as stringify7 } from "svgson";
|
|
10140
10242
|
import {
|
|
10141
|
-
applyToPoint as
|
|
10243
|
+
applyToPoint as applyToPoint69,
|
|
10142
10244
|
compose as compose14,
|
|
10143
10245
|
scale as scale8,
|
|
10144
10246
|
translate as translate14
|
|
10145
10247
|
} from "transformation-matrix";
|
|
10146
10248
|
|
|
10147
10249
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
10148
|
-
import { applyToPoint as
|
|
10250
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
10149
10251
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
10150
10252
|
const { transform, layer: layerFilter } = ctx;
|
|
10151
10253
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
10152
|
-
const [x, y] =
|
|
10254
|
+
const [x, y] = applyToPoint68(transform, [solderPaste.x, solderPaste.y]);
|
|
10153
10255
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
10154
10256
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
10155
10257
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -10360,8 +10462,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
10360
10462
|
}
|
|
10361
10463
|
}
|
|
10362
10464
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
10363
|
-
const [x1, y1] =
|
|
10364
|
-
const [x2, y2] =
|
|
10465
|
+
const [x1, y1] = applyToPoint69(transform, [minX, minY]);
|
|
10466
|
+
const [x2, y2] = applyToPoint69(transform, [maxX, maxY]);
|
|
10365
10467
|
const width = Math.abs(x2 - x1);
|
|
10366
10468
|
const height = Math.abs(y2 - y1);
|
|
10367
10469
|
const x = Math.min(x1, x2);
|