circuit-to-svg 0.0.245 → 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.js +206 -162
- 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)`;
|
|
@@ -3164,7 +3198,7 @@ function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
|
3164
3198
|
}
|
|
3165
3199
|
|
|
3166
3200
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
3167
|
-
import { applyToPoint as
|
|
3201
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
3168
3202
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
3169
3203
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
3170
3204
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -3176,11 +3210,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
3176
3210
|
}
|
|
3177
3211
|
const halfWidth = width / 2;
|
|
3178
3212
|
const halfHeight = height / 2;
|
|
3179
|
-
const [topLeftX, topLeftY] =
|
|
3213
|
+
const [topLeftX, topLeftY] = applyToPoint29(transform, [
|
|
3180
3214
|
center.x - halfWidth,
|
|
3181
3215
|
center.y + halfHeight
|
|
3182
3216
|
]);
|
|
3183
|
-
const [bottomRightX, bottomRightY] =
|
|
3217
|
+
const [bottomRightX, bottomRightY] = applyToPoint29(transform, [
|
|
3184
3218
|
center.x + halfWidth,
|
|
3185
3219
|
center.y - halfHeight
|
|
3186
3220
|
]);
|
|
@@ -3230,7 +3264,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3230
3264
|
var package_default = {
|
|
3231
3265
|
name: "circuit-to-svg",
|
|
3232
3266
|
type: "module",
|
|
3233
|
-
version: "0.0.
|
|
3267
|
+
version: "0.0.245",
|
|
3234
3268
|
description: "Convert Circuit JSON to SVG",
|
|
3235
3269
|
main: "dist/index.js",
|
|
3236
3270
|
files: [
|
|
@@ -3254,7 +3288,7 @@ var package_default = {
|
|
|
3254
3288
|
"bun-match-svg": "^0.0.12",
|
|
3255
3289
|
esbuild: "^0.20.2",
|
|
3256
3290
|
"performance-now": "^2.1.0",
|
|
3257
|
-
"circuit-json": "^0.0.
|
|
3291
|
+
"circuit-json": "^0.0.284",
|
|
3258
3292
|
react: "19.1.0",
|
|
3259
3293
|
"react-cosmos": "7.0.0",
|
|
3260
3294
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -3280,6 +3314,7 @@ var CIRCUIT_TO_SVG_VERSION = package_default.version;
|
|
|
3280
3314
|
var TYPE_PRIORITY = {
|
|
3281
3315
|
pcb_background: 0,
|
|
3282
3316
|
pcb_boundary: 1,
|
|
3317
|
+
pcb_panel: 5,
|
|
3283
3318
|
pcb_board: 10,
|
|
3284
3319
|
pcb_cutout: 15,
|
|
3285
3320
|
pcb_hole: 18,
|
|
@@ -3393,7 +3428,14 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3393
3428
|
let boardMaxX = Number.NEGATIVE_INFINITY;
|
|
3394
3429
|
let boardMaxY = Number.NEGATIVE_INFINITY;
|
|
3395
3430
|
for (const circuitJsonElm of circuitJson) {
|
|
3396
|
-
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") {
|
|
3397
3439
|
if (circuitJsonElm.outline && Array.isArray(circuitJsonElm.outline) && circuitJsonElm.outline.length >= 3) {
|
|
3398
3440
|
updateBoundsToIncludeOutline(circuitJsonElm.outline);
|
|
3399
3441
|
updateBoardBoundsToIncludeOutline(circuitJsonElm.outline);
|
|
@@ -3712,6 +3754,8 @@ function createSvgObjects({
|
|
|
3712
3754
|
return createSvgObjectsFromPcbNoteLine(elm, ctx);
|
|
3713
3755
|
case "pcb_silkscreen_path":
|
|
3714
3756
|
return createSvgObjectsFromPcbSilkscreenPath(elm, ctx);
|
|
3757
|
+
case "pcb_panel":
|
|
3758
|
+
return ctx.drawPaddingOutsideBoard ? createSvgObjectsFromPcbPanel(elm, ctx) : [];
|
|
3715
3759
|
case "pcb_board":
|
|
3716
3760
|
return ctx.drawPaddingOutsideBoard ? createSvgObjectsFromPcbBoard(elm, ctx) : [];
|
|
3717
3761
|
case "pcb_via":
|
|
@@ -3725,8 +3769,8 @@ function createSvgObjects({
|
|
|
3725
3769
|
}
|
|
3726
3770
|
}
|
|
3727
3771
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
3728
|
-
const [x1, y1] =
|
|
3729
|
-
const [x2, y2] =
|
|
3772
|
+
const [x1, y1] = applyToPoint30(transform, [minX, minY]);
|
|
3773
|
+
const [x2, y2] = applyToPoint30(transform, [maxX, maxY]);
|
|
3730
3774
|
const width = Math.abs(x2 - x1);
|
|
3731
3775
|
const height = Math.abs(y2 - y1);
|
|
3732
3776
|
const x = Math.min(x1, x2);
|
|
@@ -3756,14 +3800,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
3756
3800
|
import { stringify as stringify2 } from "svgson";
|
|
3757
3801
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
3758
3802
|
import {
|
|
3759
|
-
applyToPoint as
|
|
3803
|
+
applyToPoint as applyToPoint37,
|
|
3760
3804
|
compose as compose6,
|
|
3761
3805
|
scale as scale3,
|
|
3762
3806
|
translate as translate6
|
|
3763
3807
|
} from "transformation-matrix";
|
|
3764
3808
|
|
|
3765
3809
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
3766
|
-
import { applyToPoint as
|
|
3810
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
3767
3811
|
var DEFAULT_BOARD_STYLE = {
|
|
3768
3812
|
fill: "none",
|
|
3769
3813
|
stroke: "rgb(0,0,0)",
|
|
@@ -3775,25 +3819,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
3775
3819
|
let path;
|
|
3776
3820
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
3777
3821
|
path = outline.map((point, index) => {
|
|
3778
|
-
const [x, y] =
|
|
3822
|
+
const [x, y] = applyToPoint31(transform, [point.x, point.y]);
|
|
3779
3823
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3780
3824
|
}).join(" ");
|
|
3781
3825
|
} else {
|
|
3782
3826
|
const halfWidth = width / 2;
|
|
3783
3827
|
const halfHeight = height / 2;
|
|
3784
|
-
const topLeft =
|
|
3828
|
+
const topLeft = applyToPoint31(transform, [
|
|
3785
3829
|
center.x - halfWidth,
|
|
3786
3830
|
center.y - halfHeight
|
|
3787
3831
|
]);
|
|
3788
|
-
const topRight =
|
|
3832
|
+
const topRight = applyToPoint31(transform, [
|
|
3789
3833
|
center.x + halfWidth,
|
|
3790
3834
|
center.y - halfHeight
|
|
3791
3835
|
]);
|
|
3792
|
-
const bottomRight =
|
|
3836
|
+
const bottomRight = applyToPoint31(transform, [
|
|
3793
3837
|
center.x + halfWidth,
|
|
3794
3838
|
center.y + halfHeight
|
|
3795
3839
|
]);
|
|
3796
|
-
const bottomLeft =
|
|
3840
|
+
const bottomLeft = applyToPoint31(transform, [
|
|
3797
3841
|
center.x - halfWidth,
|
|
3798
3842
|
center.y + halfHeight
|
|
3799
3843
|
]);
|
|
@@ -3819,7 +3863,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
3819
3863
|
}
|
|
3820
3864
|
|
|
3821
3865
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
3822
|
-
import { applyToPoint as
|
|
3866
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
3823
3867
|
|
|
3824
3868
|
// lib/utils/get-sch-font-size.ts
|
|
3825
3869
|
import "transformation-matrix";
|
|
@@ -3845,8 +3889,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
3845
3889
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
3846
3890
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
3847
3891
|
return null;
|
|
3848
|
-
const [x, y] =
|
|
3849
|
-
const [pinX, pinY] =
|
|
3892
|
+
const [x, y] = applyToPoint33(transform, [center.x, center.y]);
|
|
3893
|
+
const [pinX, pinY] = applyToPoint33(transform, [portPosition.x, portPosition.y]);
|
|
3850
3894
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3851
3895
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3852
3896
|
const isTopLayer = layer === "top";
|
|
@@ -4008,11 +4052,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
4008
4052
|
}
|
|
4009
4053
|
|
|
4010
4054
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
4011
|
-
import { applyToPoint as
|
|
4055
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
4012
4056
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
4013
4057
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
4014
4058
|
const { transform } = ctx;
|
|
4015
|
-
const [x, y] =
|
|
4059
|
+
const [x, y] = applyToPoint34(transform, [hole.x, hole.y]);
|
|
4016
4060
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
4017
4061
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
4018
4062
|
const radius = scaledDiameter / 2;
|
|
@@ -4076,12 +4120,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
4076
4120
|
}
|
|
4077
4121
|
|
|
4078
4122
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
4079
|
-
import { applyToPoint as
|
|
4123
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
4080
4124
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
4081
4125
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
4082
4126
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
4083
4127
|
const { transform } = ctx;
|
|
4084
|
-
const [x, y] =
|
|
4128
|
+
const [x, y] = applyToPoint35(transform, [hole.x, hole.y]);
|
|
4085
4129
|
if (hole.shape === "pill") {
|
|
4086
4130
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4087
4131
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -4176,7 +4220,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4176
4220
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
4177
4221
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4178
4222
|
const holeRadius = scaledHoleDiameter / 2;
|
|
4179
|
-
const [holeCx, holeCy] =
|
|
4223
|
+
const [holeCx, holeCy] = applyToPoint35(transform, [
|
|
4180
4224
|
circularHole.x + circularHole.hole_offset_x,
|
|
4181
4225
|
circularHole.y + circularHole.hole_offset_y
|
|
4182
4226
|
]);
|
|
@@ -4234,7 +4278,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4234
4278
|
const pillHoleWithOffsets = pillHole;
|
|
4235
4279
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
4236
4280
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
4237
|
-
const [holeCenterX, holeCenterY] =
|
|
4281
|
+
const [holeCenterX, holeCenterY] = applyToPoint35(transform, [
|
|
4238
4282
|
pillHole.x + holeOffsetX,
|
|
4239
4283
|
pillHole.y + holeOffsetY
|
|
4240
4284
|
]);
|
|
@@ -4296,7 +4340,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4296
4340
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
4297
4341
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
4298
4342
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
4299
|
-
const [holeCenterX, holeCenterY] =
|
|
4343
|
+
const [holeCenterX, holeCenterY] = applyToPoint35(transform, [
|
|
4300
4344
|
rotatedHole.x + holeOffsetX,
|
|
4301
4345
|
rotatedHole.y + holeOffsetY
|
|
4302
4346
|
]);
|
|
@@ -4352,14 +4396,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4352
4396
|
}
|
|
4353
4397
|
|
|
4354
4398
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
4355
|
-
import { applyToPoint as
|
|
4399
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
4356
4400
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
4357
4401
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
4358
4402
|
const { transform } = ctx;
|
|
4359
4403
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
4360
4404
|
const width = pad.width * Math.abs(transform.a);
|
|
4361
4405
|
const height = pad.height * Math.abs(transform.d);
|
|
4362
|
-
const [x, y] =
|
|
4406
|
+
const [x, y] = applyToPoint36(transform, [pad.x, pad.y]);
|
|
4363
4407
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4364
4408
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
4365
4409
|
return [
|
|
@@ -4411,7 +4455,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4411
4455
|
const width = pad.width * Math.abs(transform.a);
|
|
4412
4456
|
const height = pad.height * Math.abs(transform.d);
|
|
4413
4457
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4414
|
-
const [x, y] =
|
|
4458
|
+
const [x, y] = applyToPoint36(transform, [pad.x, pad.y]);
|
|
4415
4459
|
return [
|
|
4416
4460
|
{
|
|
4417
4461
|
name: "rect",
|
|
@@ -4434,7 +4478,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4434
4478
|
}
|
|
4435
4479
|
if (pad.shape === "circle") {
|
|
4436
4480
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4437
|
-
const [x, y] =
|
|
4481
|
+
const [x, y] = applyToPoint36(transform, [pad.x, pad.y]);
|
|
4438
4482
|
return [
|
|
4439
4483
|
{
|
|
4440
4484
|
name: "circle",
|
|
@@ -4454,7 +4498,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4454
4498
|
}
|
|
4455
4499
|
if (pad.shape === "polygon") {
|
|
4456
4500
|
const points = (pad.points ?? []).map(
|
|
4457
|
-
(point) =>
|
|
4501
|
+
(point) => applyToPoint36(transform, [point.x, point.y])
|
|
4458
4502
|
);
|
|
4459
4503
|
return [
|
|
4460
4504
|
{
|
|
@@ -4631,8 +4675,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
4631
4675
|
}
|
|
4632
4676
|
}
|
|
4633
4677
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
4634
|
-
const [x1, y1] =
|
|
4635
|
-
const [x2, y2] =
|
|
4678
|
+
const [x1, y1] = applyToPoint37(transform, [minX, minY]);
|
|
4679
|
+
const [x2, y2] = applyToPoint37(transform, [maxX, maxY]);
|
|
4636
4680
|
const width = Math.abs(x2 - x1);
|
|
4637
4681
|
const height = Math.abs(y2 - y1);
|
|
4638
4682
|
const x = Math.min(x1, x2);
|
|
@@ -4661,7 +4705,7 @@ import {
|
|
|
4661
4705
|
} from "transformation-matrix";
|
|
4662
4706
|
|
|
4663
4707
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
4664
|
-
import { applyToPoint as
|
|
4708
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
4665
4709
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
4666
4710
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
4667
4711
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -4675,25 +4719,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4675
4719
|
let path;
|
|
4676
4720
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4677
4721
|
path = outline.map((point, index) => {
|
|
4678
|
-
const [x, y] =
|
|
4722
|
+
const [x, y] = applyToPoint38(transform, [point.x, point.y]);
|
|
4679
4723
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4680
4724
|
}).join(" ");
|
|
4681
4725
|
} else {
|
|
4682
4726
|
const halfWidth = width / 2;
|
|
4683
4727
|
const halfHeight = height / 2;
|
|
4684
|
-
const topLeft =
|
|
4728
|
+
const topLeft = applyToPoint38(transform, [
|
|
4685
4729
|
center.x - halfWidth,
|
|
4686
4730
|
center.y - halfHeight
|
|
4687
4731
|
]);
|
|
4688
|
-
const topRight =
|
|
4732
|
+
const topRight = applyToPoint38(transform, [
|
|
4689
4733
|
center.x + halfWidth,
|
|
4690
4734
|
center.y - halfHeight
|
|
4691
4735
|
]);
|
|
4692
|
-
const bottomRight =
|
|
4736
|
+
const bottomRight = applyToPoint38(transform, [
|
|
4693
4737
|
center.x + halfWidth,
|
|
4694
4738
|
center.y + halfHeight
|
|
4695
4739
|
]);
|
|
4696
|
-
const bottomLeft =
|
|
4740
|
+
const bottomLeft = applyToPoint38(transform, [
|
|
4697
4741
|
center.x - halfWidth,
|
|
4698
4742
|
center.y + halfHeight
|
|
4699
4743
|
]);
|
|
@@ -4711,10 +4755,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4711
4755
|
const halfWidth = width2 / 2;
|
|
4712
4756
|
const halfHeight = height2 / 2;
|
|
4713
4757
|
const [tl, tr, br, bl] = [
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
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])
|
|
4718
4762
|
];
|
|
4719
4763
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
4720
4764
|
} else if (cutout.shape === "circle") {
|
|
@@ -4764,7 +4808,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4764
4808
|
|
|
4765
4809
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
4766
4810
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
4767
|
-
import { applyToPoint as
|
|
4811
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
4768
4812
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
4769
4813
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
4770
4814
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -4774,7 +4818,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
4774
4818
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
4775
4819
|
return [];
|
|
4776
4820
|
}
|
|
4777
|
-
const [x, y] =
|
|
4821
|
+
const [x, y] = applyToPoint39(transform, [center.x, center.y]);
|
|
4778
4822
|
const scaledWidth = width * Math.abs(transform.a);
|
|
4779
4823
|
const scaledHeight = height * Math.abs(transform.d);
|
|
4780
4824
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -4835,11 +4879,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
4835
4879
|
}
|
|
4836
4880
|
|
|
4837
4881
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
4838
|
-
import { applyToPoint as
|
|
4882
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
4839
4883
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
4840
4884
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
4841
4885
|
const { transform } = ctx;
|
|
4842
|
-
const [x, y] =
|
|
4886
|
+
const [x, y] = applyToPoint40(transform, [hole.x, hole.y]);
|
|
4843
4887
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
4844
4888
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
4845
4889
|
const radius = scaledDiameter / 2;
|
|
@@ -4903,12 +4947,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
4903
4947
|
}
|
|
4904
4948
|
|
|
4905
4949
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
4906
|
-
import { applyToPoint as
|
|
4950
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
4907
4951
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
4908
4952
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
4909
4953
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
4910
4954
|
const { transform } = ctx;
|
|
4911
|
-
const [x, y] =
|
|
4955
|
+
const [x, y] = applyToPoint41(transform, [hole.x, hole.y]);
|
|
4912
4956
|
if (hole.shape === "pill") {
|
|
4913
4957
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4914
4958
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -5143,14 +5187,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
5143
5187
|
}
|
|
5144
5188
|
|
|
5145
5189
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
5146
|
-
import { applyToPoint as
|
|
5190
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
5147
5191
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
5148
5192
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
5149
5193
|
const { transform } = ctx;
|
|
5150
5194
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
5151
5195
|
const width = pad.width * Math.abs(transform.a);
|
|
5152
5196
|
const height = pad.height * Math.abs(transform.d);
|
|
5153
|
-
const [x, y] =
|
|
5197
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
5154
5198
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
5155
5199
|
return [
|
|
5156
5200
|
{
|
|
@@ -5193,7 +5237,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5193
5237
|
const width = pad.width * Math.abs(transform.a);
|
|
5194
5238
|
const height = pad.height * Math.abs(transform.d);
|
|
5195
5239
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5196
|
-
const [x, y] =
|
|
5240
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
5197
5241
|
return [
|
|
5198
5242
|
{
|
|
5199
5243
|
name: "rect",
|
|
@@ -5216,7 +5260,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5216
5260
|
}
|
|
5217
5261
|
if (pad.shape === "circle") {
|
|
5218
5262
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5219
|
-
const [x, y] =
|
|
5263
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
5220
5264
|
return [
|
|
5221
5265
|
{
|
|
5222
5266
|
name: "circle",
|
|
@@ -5236,7 +5280,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5236
5280
|
}
|
|
5237
5281
|
if (pad.shape === "polygon") {
|
|
5238
5282
|
const points = (pad.points ?? []).map(
|
|
5239
|
-
(point) =>
|
|
5283
|
+
(point) => applyToPoint42(transform, [point.x, point.y])
|
|
5240
5284
|
);
|
|
5241
5285
|
return [
|
|
5242
5286
|
{
|
|
@@ -5257,7 +5301,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5257
5301
|
}
|
|
5258
5302
|
|
|
5259
5303
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
5260
|
-
import { applyToPoint as
|
|
5304
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
5261
5305
|
import { calculateElbow } from "calculate-elbow";
|
|
5262
5306
|
|
|
5263
5307
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -5334,7 +5378,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5334
5378
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
5335
5379
|
if (!label_info) return [];
|
|
5336
5380
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
5337
|
-
const [port_x, port_y] =
|
|
5381
|
+
const [port_x, port_y] = applyToPoint43(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
5338
5382
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
5339
5383
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
5340
5384
|
const elbow_path = calculateElbow(
|
|
@@ -5475,7 +5519,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5475
5519
|
}
|
|
5476
5520
|
|
|
5477
5521
|
// lib/pinout/calculate-label-positions.ts
|
|
5478
|
-
import { applyToPoint as
|
|
5522
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
5479
5523
|
|
|
5480
5524
|
// lib/pinout/constants.ts
|
|
5481
5525
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -5513,7 +5557,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5513
5557
|
);
|
|
5514
5558
|
const mapToEdgePort = (pinout_label) => ({
|
|
5515
5559
|
pcb_port: pinout_label.pcb_port,
|
|
5516
|
-
y:
|
|
5560
|
+
y: applyToPoint44(transform, [
|
|
5517
5561
|
pinout_label.pcb_port.x,
|
|
5518
5562
|
pinout_label.pcb_port.y
|
|
5519
5563
|
])[1],
|
|
@@ -5528,7 +5572,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5528
5572
|
} else {
|
|
5529
5573
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
5530
5574
|
pcb_port: pinout_label.pcb_port,
|
|
5531
|
-
y:
|
|
5575
|
+
y: applyToPoint44(transform, [
|
|
5532
5576
|
pinout_label.pcb_port.x,
|
|
5533
5577
|
pinout_label.pcb_port.y
|
|
5534
5578
|
])[1],
|
|
@@ -5536,7 +5580,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5536
5580
|
})).sort((a, b) => a.y - b.y);
|
|
5537
5581
|
}
|
|
5538
5582
|
if (edge_ports.length === 0) return;
|
|
5539
|
-
const board_edge_x =
|
|
5583
|
+
const board_edge_x = applyToPoint44(transform, [
|
|
5540
5584
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
5541
5585
|
0
|
|
5542
5586
|
])[0];
|
|
@@ -5951,14 +5995,14 @@ import {
|
|
|
5951
5995
|
} from "transformation-matrix";
|
|
5952
5996
|
|
|
5953
5997
|
// lib/sch/draw-schematic-grid.ts
|
|
5954
|
-
import { applyToPoint as
|
|
5998
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
5955
5999
|
function drawSchematicGrid(params) {
|
|
5956
6000
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
5957
6001
|
const cellSize = params.cellSize ?? 1;
|
|
5958
6002
|
const labelCells = params.labelCells ?? false;
|
|
5959
6003
|
const gridLines = [];
|
|
5960
6004
|
const transformPoint = (x, y) => {
|
|
5961
|
-
const [transformedX, transformedY] =
|
|
6005
|
+
const [transformedX, transformedY] = applyToPoint45(params.transform, [x, y]);
|
|
5962
6006
|
return { x: transformedX, y: transformedY };
|
|
5963
6007
|
};
|
|
5964
6008
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -6039,15 +6083,15 @@ function drawSchematicGrid(params) {
|
|
|
6039
6083
|
}
|
|
6040
6084
|
|
|
6041
6085
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
6042
|
-
import { applyToPoint as
|
|
6086
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
6043
6087
|
function drawSchematicLabeledPoints(params) {
|
|
6044
6088
|
const { points, transform } = params;
|
|
6045
6089
|
const labeledPointsGroup = [];
|
|
6046
6090
|
for (const point of points) {
|
|
6047
|
-
const [x1, y1] =
|
|
6048
|
-
const [x2, y2] =
|
|
6049
|
-
const [x3, y3] =
|
|
6050
|
-
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]);
|
|
6051
6095
|
labeledPointsGroup.push({
|
|
6052
6096
|
name: "path",
|
|
6053
6097
|
type: "element",
|
|
@@ -6058,7 +6102,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
6058
6102
|
"stroke-opacity": "0.7"
|
|
6059
6103
|
}
|
|
6060
6104
|
});
|
|
6061
|
-
const [labelX, labelY] =
|
|
6105
|
+
const [labelX, labelY] = applyToPoint46(transform, [
|
|
6062
6106
|
point.x + 0.15,
|
|
6063
6107
|
point.y - 0.15
|
|
6064
6108
|
]);
|
|
@@ -7152,7 +7196,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
7152
7196
|
import { symbols } from "schematic-symbols";
|
|
7153
7197
|
import "svgson";
|
|
7154
7198
|
import {
|
|
7155
|
-
applyToPoint as
|
|
7199
|
+
applyToPoint as applyToPoint48,
|
|
7156
7200
|
compose as compose9
|
|
7157
7201
|
} from "transformation-matrix";
|
|
7158
7202
|
|
|
@@ -7236,13 +7280,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
7236
7280
|
}
|
|
7237
7281
|
|
|
7238
7282
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
7239
|
-
import { applyToPoint as
|
|
7283
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7240
7284
|
var createSvgSchErrorText = ({
|
|
7241
7285
|
text,
|
|
7242
7286
|
realCenter,
|
|
7243
7287
|
realToScreenTransform
|
|
7244
7288
|
}) => {
|
|
7245
|
-
const screenCenter =
|
|
7289
|
+
const screenCenter = applyToPoint47(realToScreenTransform, realCenter);
|
|
7246
7290
|
return {
|
|
7247
7291
|
type: "element",
|
|
7248
7292
|
name: "text",
|
|
@@ -7351,11 +7395,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7351
7395
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
7352
7396
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
7353
7397
|
};
|
|
7354
|
-
const [screenMinX, screenMinY] =
|
|
7398
|
+
const [screenMinX, screenMinY] = applyToPoint48(
|
|
7355
7399
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7356
7400
|
[bounds.minX, bounds.minY]
|
|
7357
7401
|
);
|
|
7358
|
-
const [screenMaxX, screenMaxY] =
|
|
7402
|
+
const [screenMaxX, screenMaxY] = applyToPoint48(
|
|
7359
7403
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7360
7404
|
[bounds.maxX, bounds.maxY]
|
|
7361
7405
|
);
|
|
@@ -7384,7 +7428,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7384
7428
|
name: "path",
|
|
7385
7429
|
attributes: {
|
|
7386
7430
|
d: points.map((p, i) => {
|
|
7387
|
-
const [x, y] =
|
|
7431
|
+
const [x, y] = applyToPoint48(
|
|
7388
7432
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7389
7433
|
[p.x, p.y]
|
|
7390
7434
|
);
|
|
@@ -7400,7 +7444,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7400
7444
|
});
|
|
7401
7445
|
}
|
|
7402
7446
|
for (const text of texts) {
|
|
7403
|
-
const screenTextPos =
|
|
7447
|
+
const screenTextPos = applyToPoint48(
|
|
7404
7448
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7405
7449
|
text
|
|
7406
7450
|
);
|
|
@@ -7452,7 +7496,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7452
7496
|
});
|
|
7453
7497
|
}
|
|
7454
7498
|
for (const box of boxes) {
|
|
7455
|
-
const screenBoxPos =
|
|
7499
|
+
const screenBoxPos = applyToPoint48(
|
|
7456
7500
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7457
7501
|
box
|
|
7458
7502
|
);
|
|
@@ -7476,7 +7520,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7476
7520
|
}
|
|
7477
7521
|
for (const port of symbol.ports) {
|
|
7478
7522
|
if (connectedSymbolPorts.has(port)) continue;
|
|
7479
|
-
const screenPortPos =
|
|
7523
|
+
const screenPortPos = applyToPoint48(
|
|
7480
7524
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7481
7525
|
port
|
|
7482
7526
|
);
|
|
@@ -7496,7 +7540,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7496
7540
|
});
|
|
7497
7541
|
}
|
|
7498
7542
|
for (const circle of circles) {
|
|
7499
|
-
const screenCirclePos =
|
|
7543
|
+
const screenCirclePos = applyToPoint48(
|
|
7500
7544
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7501
7545
|
circle
|
|
7502
7546
|
);
|
|
@@ -7523,14 +7567,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7523
7567
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
7524
7568
|
import "schematic-symbols";
|
|
7525
7569
|
import "svgson";
|
|
7526
|
-
import { applyToPoint as
|
|
7570
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
7527
7571
|
|
|
7528
7572
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
7529
7573
|
import "transformation-matrix";
|
|
7530
7574
|
import "@tscircuit/circuit-json-util";
|
|
7531
7575
|
|
|
7532
7576
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
7533
|
-
import { applyToPoint as
|
|
7577
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7534
7578
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
7535
7579
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
7536
7580
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -7583,8 +7627,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7583
7627
|
realEdgePos.y += realPinLineLength;
|
|
7584
7628
|
break;
|
|
7585
7629
|
}
|
|
7586
|
-
const screenSchPortPos =
|
|
7587
|
-
const screenRealEdgePos =
|
|
7630
|
+
const screenSchPortPos = applyToPoint49(transform, schPort.center);
|
|
7631
|
+
const screenRealEdgePos = applyToPoint49(transform, realEdgePos);
|
|
7588
7632
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
7589
7633
|
const realLineEnd = { ...schPort.center };
|
|
7590
7634
|
if (!isConnected) {
|
|
@@ -7603,7 +7647,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7603
7647
|
break;
|
|
7604
7648
|
}
|
|
7605
7649
|
}
|
|
7606
|
-
const screenLineEnd =
|
|
7650
|
+
const screenLineEnd = applyToPoint49(transform, realLineEnd);
|
|
7607
7651
|
svgObjects.push({
|
|
7608
7652
|
name: "line",
|
|
7609
7653
|
type: "element",
|
|
@@ -7724,7 +7768,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7724
7768
|
};
|
|
7725
7769
|
|
|
7726
7770
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
7727
|
-
import { applyToPoint as
|
|
7771
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
7728
7772
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
7729
7773
|
const svgObjects = [];
|
|
7730
7774
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -7742,7 +7786,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7742
7786
|
} else {
|
|
7743
7787
|
realPinNumberPos.y += 0.02;
|
|
7744
7788
|
}
|
|
7745
|
-
const screenPinNumberTextPos =
|
|
7789
|
+
const screenPinNumberTextPos = applyToPoint50(transform, realPinNumberPos);
|
|
7746
7790
|
svgObjects.push({
|
|
7747
7791
|
name: "text",
|
|
7748
7792
|
type: "element",
|
|
@@ -7772,7 +7816,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7772
7816
|
};
|
|
7773
7817
|
|
|
7774
7818
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
7775
|
-
import { applyToPoint as
|
|
7819
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
7776
7820
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
7777
7821
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
7778
7822
|
const svgObjects = [];
|
|
@@ -7786,7 +7830,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
7786
7830
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
7787
7831
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7788
7832
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7789
|
-
const screenPinNumberTextPos =
|
|
7833
|
+
const screenPinNumberTextPos = applyToPoint51(transform, realPinNumberPos);
|
|
7790
7834
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
7791
7835
|
if (!label) return [];
|
|
7792
7836
|
const isNegated = label.startsWith("N_");
|
|
@@ -7834,13 +7878,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
7834
7878
|
};
|
|
7835
7879
|
|
|
7836
7880
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
7837
|
-
import { applyToPoint as
|
|
7881
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
7838
7882
|
var createSvgSchText = ({
|
|
7839
7883
|
elm,
|
|
7840
7884
|
transform,
|
|
7841
7885
|
colorMap: colorMap2
|
|
7842
7886
|
}) => {
|
|
7843
|
-
const center =
|
|
7887
|
+
const center = applyToPoint53(transform, elm.position);
|
|
7844
7888
|
const textAnchorMap = {
|
|
7845
7889
|
center: "middle",
|
|
7846
7890
|
center_right: "end",
|
|
@@ -7924,11 +7968,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
7924
7968
|
colorMap: colorMap2
|
|
7925
7969
|
}) => {
|
|
7926
7970
|
const svgObjects = [];
|
|
7927
|
-
const componentScreenTopLeft =
|
|
7971
|
+
const componentScreenTopLeft = applyToPoint54(transform, {
|
|
7928
7972
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
7929
7973
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
7930
7974
|
});
|
|
7931
|
-
const componentScreenBottomRight =
|
|
7975
|
+
const componentScreenBottomRight = applyToPoint54(transform, {
|
|
7932
7976
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
7933
7977
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
7934
7978
|
});
|
|
@@ -8014,13 +8058,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
8014
8058
|
}
|
|
8015
8059
|
|
|
8016
8060
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
8017
|
-
import { applyToPoint as
|
|
8061
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
8018
8062
|
function createSvgObjectsFromSchVoltageProbe({
|
|
8019
8063
|
probe,
|
|
8020
8064
|
transform,
|
|
8021
8065
|
colorMap: colorMap2
|
|
8022
8066
|
}) {
|
|
8023
|
-
const [screenX, screenY] =
|
|
8067
|
+
const [screenX, screenY] = applyToPoint55(transform, [
|
|
8024
8068
|
probe.position.x,
|
|
8025
8069
|
probe.position.y
|
|
8026
8070
|
]);
|
|
@@ -8080,17 +8124,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
8080
8124
|
}
|
|
8081
8125
|
|
|
8082
8126
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
8083
|
-
import { applyToPoint as
|
|
8127
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
8084
8128
|
function createSvgObjectsFromSchDebugObject({
|
|
8085
8129
|
debugObject,
|
|
8086
8130
|
transform
|
|
8087
8131
|
}) {
|
|
8088
8132
|
if (debugObject.shape === "rect") {
|
|
8089
|
-
let [screenLeft, screenTop] =
|
|
8133
|
+
let [screenLeft, screenTop] = applyToPoint56(transform, [
|
|
8090
8134
|
debugObject.center.x - debugObject.size.width / 2,
|
|
8091
8135
|
debugObject.center.y - debugObject.size.height / 2
|
|
8092
8136
|
]);
|
|
8093
|
-
let [screenRight, screenBottom] =
|
|
8137
|
+
let [screenRight, screenBottom] = applyToPoint56(transform, [
|
|
8094
8138
|
debugObject.center.x + debugObject.size.width / 2,
|
|
8095
8139
|
debugObject.center.y + debugObject.size.height / 2
|
|
8096
8140
|
]);
|
|
@@ -8100,7 +8144,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8100
8144
|
];
|
|
8101
8145
|
const width = Math.abs(screenRight - screenLeft);
|
|
8102
8146
|
const height = Math.abs(screenBottom - screenTop);
|
|
8103
|
-
const [screenCenterX, screenCenterY] =
|
|
8147
|
+
const [screenCenterX, screenCenterY] = applyToPoint56(transform, [
|
|
8104
8148
|
debugObject.center.x,
|
|
8105
8149
|
debugObject.center.y
|
|
8106
8150
|
]);
|
|
@@ -8146,11 +8190,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8146
8190
|
];
|
|
8147
8191
|
}
|
|
8148
8192
|
if (debugObject.shape === "line") {
|
|
8149
|
-
const [screenStartX, screenStartY] =
|
|
8193
|
+
const [screenStartX, screenStartY] = applyToPoint56(transform, [
|
|
8150
8194
|
debugObject.start.x,
|
|
8151
8195
|
debugObject.start.y
|
|
8152
8196
|
]);
|
|
8153
|
-
const [screenEndX, screenEndY] =
|
|
8197
|
+
const [screenEndX, screenEndY] = applyToPoint56(transform, [
|
|
8154
8198
|
debugObject.end.x,
|
|
8155
8199
|
debugObject.end.y
|
|
8156
8200
|
]);
|
|
@@ -8200,7 +8244,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8200
8244
|
}
|
|
8201
8245
|
|
|
8202
8246
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
8203
|
-
import { applyToPoint as
|
|
8247
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
8204
8248
|
function createSchematicTrace({
|
|
8205
8249
|
trace,
|
|
8206
8250
|
transform,
|
|
@@ -8214,11 +8258,11 @@ function createSchematicTrace({
|
|
|
8214
8258
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
8215
8259
|
const edge = edges[edgeIndex];
|
|
8216
8260
|
if (edge.is_crossing) continue;
|
|
8217
|
-
const [screenFromX, screenFromY] =
|
|
8261
|
+
const [screenFromX, screenFromY] = applyToPoint57(transform, [
|
|
8218
8262
|
edge.from.x,
|
|
8219
8263
|
edge.from.y
|
|
8220
8264
|
]);
|
|
8221
|
-
const [screenToX, screenToY] =
|
|
8265
|
+
const [screenToX, screenToY] = applyToPoint57(transform, [
|
|
8222
8266
|
edge.to.x,
|
|
8223
8267
|
edge.to.y
|
|
8224
8268
|
]);
|
|
@@ -8262,11 +8306,11 @@ function createSchematicTrace({
|
|
|
8262
8306
|
}
|
|
8263
8307
|
for (const edge of edges) {
|
|
8264
8308
|
if (!edge.is_crossing) continue;
|
|
8265
|
-
const [screenFromX, screenFromY] =
|
|
8309
|
+
const [screenFromX, screenFromY] = applyToPoint57(transform, [
|
|
8266
8310
|
edge.from.x,
|
|
8267
8311
|
edge.from.y
|
|
8268
8312
|
]);
|
|
8269
|
-
const [screenToX, screenToY] =
|
|
8313
|
+
const [screenToX, screenToY] = applyToPoint57(transform, [
|
|
8270
8314
|
edge.to.x,
|
|
8271
8315
|
edge.to.y
|
|
8272
8316
|
]);
|
|
@@ -8310,7 +8354,7 @@ function createSchematicTrace({
|
|
|
8310
8354
|
}
|
|
8311
8355
|
if (trace.junctions) {
|
|
8312
8356
|
for (const junction of trace.junctions) {
|
|
8313
|
-
const [screenX, screenY] =
|
|
8357
|
+
const [screenX, screenY] = applyToPoint57(transform, [
|
|
8314
8358
|
junction.x,
|
|
8315
8359
|
junction.y
|
|
8316
8360
|
]);
|
|
@@ -8365,7 +8409,7 @@ function createSchematicTrace({
|
|
|
8365
8409
|
|
|
8366
8410
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
8367
8411
|
import {
|
|
8368
|
-
applyToPoint as
|
|
8412
|
+
applyToPoint as applyToPoint59,
|
|
8369
8413
|
compose as compose11,
|
|
8370
8414
|
rotate as rotate6,
|
|
8371
8415
|
scale as scale6,
|
|
@@ -8374,7 +8418,7 @@ import {
|
|
|
8374
8418
|
|
|
8375
8419
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
8376
8420
|
import {
|
|
8377
|
-
applyToPoint as
|
|
8421
|
+
applyToPoint as applyToPoint58,
|
|
8378
8422
|
compose as compose10,
|
|
8379
8423
|
rotate as rotate5,
|
|
8380
8424
|
scale as scale5,
|
|
@@ -8449,7 +8493,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8449
8493
|
x: symbolBounds.minX,
|
|
8450
8494
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
8451
8495
|
};
|
|
8452
|
-
const rotatedSymbolEnd =
|
|
8496
|
+
const rotatedSymbolEnd = applyToPoint58(rotationMatrix, symbolEndPoint);
|
|
8453
8497
|
const symbolToRealTransform = compose10(
|
|
8454
8498
|
translate10(
|
|
8455
8499
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -8459,11 +8503,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8459
8503
|
scale5(1)
|
|
8460
8504
|
// Use full symbol size
|
|
8461
8505
|
);
|
|
8462
|
-
const [screenMinX, screenMinY] =
|
|
8506
|
+
const [screenMinX, screenMinY] = applyToPoint58(
|
|
8463
8507
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8464
8508
|
[bounds.minX, bounds.minY]
|
|
8465
8509
|
);
|
|
8466
|
-
const [screenMaxX, screenMaxY] =
|
|
8510
|
+
const [screenMaxX, screenMaxY] = applyToPoint58(
|
|
8467
8511
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8468
8512
|
[bounds.maxX, bounds.maxY]
|
|
8469
8513
|
);
|
|
@@ -8487,7 +8531,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8487
8531
|
});
|
|
8488
8532
|
for (const path of symbolPaths) {
|
|
8489
8533
|
const symbolPath = path.points.map((p, i) => {
|
|
8490
|
-
const [x, y] =
|
|
8534
|
+
const [x, y] = applyToPoint58(
|
|
8491
8535
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8492
8536
|
[p.x, p.y]
|
|
8493
8537
|
);
|
|
@@ -8508,7 +8552,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8508
8552
|
});
|
|
8509
8553
|
}
|
|
8510
8554
|
for (const text of symbolTexts) {
|
|
8511
|
-
const screenTextPos =
|
|
8555
|
+
const screenTextPos = applyToPoint58(
|
|
8512
8556
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8513
8557
|
text
|
|
8514
8558
|
);
|
|
@@ -8550,7 +8594,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8550
8594
|
});
|
|
8551
8595
|
}
|
|
8552
8596
|
for (const box of symbolBoxes) {
|
|
8553
|
-
const screenBoxPos =
|
|
8597
|
+
const screenBoxPos = applyToPoint58(
|
|
8554
8598
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8555
8599
|
box
|
|
8556
8600
|
);
|
|
@@ -8573,7 +8617,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8573
8617
|
});
|
|
8574
8618
|
}
|
|
8575
8619
|
for (const circle of symbolCircles) {
|
|
8576
|
-
const screenCirclePos =
|
|
8620
|
+
const screenCirclePos = applyToPoint58(
|
|
8577
8621
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8578
8622
|
circle
|
|
8579
8623
|
);
|
|
@@ -8618,14 +8662,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8618
8662
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
8619
8663
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
8620
8664
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
8621
|
-
const screenCenter =
|
|
8665
|
+
const screenCenter = applyToPoint59(realToScreenTransform, schNetLabel.center);
|
|
8622
8666
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
8623
8667
|
schNetLabel.anchor_side
|
|
8624
8668
|
);
|
|
8625
8669
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
8626
8670
|
screenTextGrowthVec.y *= -1;
|
|
8627
8671
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
8628
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
8672
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint59(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
8629
8673
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
8630
8674
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
8631
8675
|
};
|
|
@@ -8666,7 +8710,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8666
8710
|
y: -0.6
|
|
8667
8711
|
}
|
|
8668
8712
|
].map(
|
|
8669
|
-
(fontRelativePoint) =>
|
|
8713
|
+
(fontRelativePoint) => applyToPoint59(
|
|
8670
8714
|
compose11(
|
|
8671
8715
|
realToScreenTransform,
|
|
8672
8716
|
translate11(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -8743,17 +8787,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8743
8787
|
};
|
|
8744
8788
|
|
|
8745
8789
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
8746
|
-
import { applyToPoint as
|
|
8790
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
8747
8791
|
var createSvgObjectsFromSchematicBox = ({
|
|
8748
8792
|
schematicBox,
|
|
8749
8793
|
transform,
|
|
8750
8794
|
colorMap: colorMap2
|
|
8751
8795
|
}) => {
|
|
8752
|
-
const topLeft =
|
|
8796
|
+
const topLeft = applyToPoint60(transform, {
|
|
8753
8797
|
x: schematicBox.x,
|
|
8754
8798
|
y: schematicBox.y
|
|
8755
8799
|
});
|
|
8756
|
-
const bottomRight =
|
|
8800
|
+
const bottomRight = applyToPoint60(transform, {
|
|
8757
8801
|
x: schematicBox.x + schematicBox.width,
|
|
8758
8802
|
y: schematicBox.y + schematicBox.height
|
|
8759
8803
|
});
|
|
@@ -8789,7 +8833,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
8789
8833
|
};
|
|
8790
8834
|
|
|
8791
8835
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
8792
|
-
import { applyToPoint as
|
|
8836
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
8793
8837
|
var createSvgObjectsFromSchematicTable = ({
|
|
8794
8838
|
schematicTable,
|
|
8795
8839
|
transform,
|
|
@@ -8822,11 +8866,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8822
8866
|
const svgObjects = [];
|
|
8823
8867
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
8824
8868
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
8825
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
8869
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint61(transform, [
|
|
8826
8870
|
topLeftX,
|
|
8827
8871
|
topLeftY
|
|
8828
8872
|
]);
|
|
8829
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
8873
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint61(transform, [
|
|
8830
8874
|
topLeftX + totalWidth,
|
|
8831
8875
|
topLeftY - totalHeight
|
|
8832
8876
|
]);
|
|
@@ -8858,8 +8902,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8858
8902
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
8859
8903
|
);
|
|
8860
8904
|
if (!isMerged) {
|
|
8861
|
-
const start =
|
|
8862
|
-
const end =
|
|
8905
|
+
const start = applyToPoint61(transform, { x: currentX, y: segmentStartY });
|
|
8906
|
+
const end = applyToPoint61(transform, { x: currentX, y: segmentEndY });
|
|
8863
8907
|
svgObjects.push({
|
|
8864
8908
|
name: "line",
|
|
8865
8909
|
type: "element",
|
|
@@ -8888,11 +8932,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8888
8932
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
8889
8933
|
);
|
|
8890
8934
|
if (!isMerged) {
|
|
8891
|
-
const start =
|
|
8935
|
+
const start = applyToPoint61(transform, {
|
|
8892
8936
|
x: segmentStartX,
|
|
8893
8937
|
y: currentY
|
|
8894
8938
|
});
|
|
8895
|
-
const end =
|
|
8939
|
+
const end = applyToPoint61(transform, { x: segmentEndX, y: currentY });
|
|
8896
8940
|
svgObjects.push({
|
|
8897
8941
|
name: "line",
|
|
8898
8942
|
type: "element",
|
|
@@ -8934,7 +8978,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8934
8978
|
} else if (vertical_align === "bottom") {
|
|
8935
8979
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
8936
8980
|
}
|
|
8937
|
-
const screenTextAnchorPos =
|
|
8981
|
+
const screenTextAnchorPos = applyToPoint61(transform, realTextAnchorPos);
|
|
8938
8982
|
const fontSize = getSchScreenFontSize(
|
|
8939
8983
|
transform,
|
|
8940
8984
|
"reference_designator",
|
|
@@ -8990,13 +9034,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8990
9034
|
|
|
8991
9035
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
8992
9036
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
8993
|
-
import { applyToPoint as
|
|
9037
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
8994
9038
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
8995
9039
|
var createSvgObjectsForSchPortHover = ({
|
|
8996
9040
|
schPort,
|
|
8997
9041
|
transform
|
|
8998
9042
|
}) => {
|
|
8999
|
-
const screenSchPortPos =
|
|
9043
|
+
const screenSchPortPos = applyToPoint62(transform, schPort.center);
|
|
9000
9044
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
9001
9045
|
return [
|
|
9002
9046
|
{
|
|
@@ -9041,14 +9085,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
9041
9085
|
};
|
|
9042
9086
|
|
|
9043
9087
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
9044
|
-
import { applyToPoint as
|
|
9088
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
9045
9089
|
function createSvgObjectsFromSchematicLine({
|
|
9046
9090
|
schLine,
|
|
9047
9091
|
transform,
|
|
9048
9092
|
colorMap: colorMap2
|
|
9049
9093
|
}) {
|
|
9050
|
-
const p1 =
|
|
9051
|
-
const p2 =
|
|
9094
|
+
const p1 = applyToPoint63(transform, { x: schLine.x1, y: schLine.y1 });
|
|
9095
|
+
const p2 = applyToPoint63(transform, { x: schLine.x2, y: schLine.y2 });
|
|
9052
9096
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
9053
9097
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
9054
9098
|
return [
|
|
@@ -9077,13 +9121,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
9077
9121
|
}
|
|
9078
9122
|
|
|
9079
9123
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
9080
|
-
import { applyToPoint as
|
|
9124
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
9081
9125
|
function createSvgObjectsFromSchematicCircle({
|
|
9082
9126
|
schCircle,
|
|
9083
9127
|
transform,
|
|
9084
9128
|
colorMap: colorMap2
|
|
9085
9129
|
}) {
|
|
9086
|
-
const center =
|
|
9130
|
+
const center = applyToPoint64(transform, schCircle.center);
|
|
9087
9131
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
9088
9132
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
9089
9133
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -9113,13 +9157,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
9113
9157
|
}
|
|
9114
9158
|
|
|
9115
9159
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
9116
|
-
import { applyToPoint as
|
|
9160
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
9117
9161
|
function createSvgObjectsFromSchematicRect({
|
|
9118
9162
|
schRect,
|
|
9119
9163
|
transform,
|
|
9120
9164
|
colorMap: colorMap2
|
|
9121
9165
|
}) {
|
|
9122
|
-
const center =
|
|
9166
|
+
const center = applyToPoint65(transform, schRect.center);
|
|
9123
9167
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
9124
9168
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
9125
9169
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -9155,13 +9199,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
9155
9199
|
}
|
|
9156
9200
|
|
|
9157
9201
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
9158
|
-
import { applyToPoint as
|
|
9202
|
+
import { applyToPoint as applyToPoint66 } from "transformation-matrix";
|
|
9159
9203
|
function createSvgObjectsFromSchematicArc({
|
|
9160
9204
|
schArc,
|
|
9161
9205
|
transform,
|
|
9162
9206
|
colorMap: colorMap2
|
|
9163
9207
|
}) {
|
|
9164
|
-
const center =
|
|
9208
|
+
const center = applyToPoint66(transform, schArc.center);
|
|
9165
9209
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
9166
9210
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
9167
9211
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -10196,18 +10240,18 @@ function formatNumber2(value) {
|
|
|
10196
10240
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
10197
10241
|
import { stringify as stringify7 } from "svgson";
|
|
10198
10242
|
import {
|
|
10199
|
-
applyToPoint as
|
|
10243
|
+
applyToPoint as applyToPoint69,
|
|
10200
10244
|
compose as compose14,
|
|
10201
10245
|
scale as scale8,
|
|
10202
10246
|
translate as translate14
|
|
10203
10247
|
} from "transformation-matrix";
|
|
10204
10248
|
|
|
10205
10249
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
10206
|
-
import { applyToPoint as
|
|
10250
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
10207
10251
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
10208
10252
|
const { transform, layer: layerFilter } = ctx;
|
|
10209
10253
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
10210
|
-
const [x, y] =
|
|
10254
|
+
const [x, y] = applyToPoint68(transform, [solderPaste.x, solderPaste.y]);
|
|
10211
10255
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
10212
10256
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
10213
10257
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -10418,8 +10462,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
10418
10462
|
}
|
|
10419
10463
|
}
|
|
10420
10464
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
10421
|
-
const [x1, y1] =
|
|
10422
|
-
const [x2, y2] =
|
|
10465
|
+
const [x1, y1] = applyToPoint69(transform, [minX, minY]);
|
|
10466
|
+
const [x2, y2] = applyToPoint69(transform, [maxX, maxY]);
|
|
10423
10467
|
const width = Math.abs(x2 - x1);
|
|
10424
10468
|
const height = Math.abs(y2 - y1);
|
|
10425
10469
|
const x = Math.min(x1, x2);
|