circuit-to-svg 0.0.186 → 0.0.188
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 +160 -105
- 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 applyToPoint20,
|
|
5
5
|
compose as compose5,
|
|
6
6
|
scale as scale2,
|
|
7
7
|
translate as translate5
|
|
@@ -1448,12 +1448,44 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1448
1448
|
|
|
1449
1449
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
1450
1450
|
import {
|
|
1451
|
-
applyToPoint as
|
|
1451
|
+
applyToPoint as applyToPoint18,
|
|
1452
1452
|
compose as compose4,
|
|
1453
1453
|
rotate as rotate4,
|
|
1454
1454
|
toString as matrixToString7,
|
|
1455
1455
|
translate as translate4
|
|
1456
1456
|
} from "transformation-matrix";
|
|
1457
|
+
|
|
1458
|
+
// lib/utils/ring-to-path-d.ts
|
|
1459
|
+
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
1460
|
+
function ringToPathD(vertices, transform) {
|
|
1461
|
+
if (vertices.length === 0) return "";
|
|
1462
|
+
const transformedVertices = vertices.map((v) => {
|
|
1463
|
+
const [x, y] = applyToPoint17(transform, [v.x, v.y]);
|
|
1464
|
+
return { ...v, x, y };
|
|
1465
|
+
});
|
|
1466
|
+
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
1467
|
+
for (let i = 0; i < transformedVertices.length; i++) {
|
|
1468
|
+
const start = transformedVertices[i];
|
|
1469
|
+
const end = transformedVertices[(i + 1) % transformedVertices.length];
|
|
1470
|
+
if (start.bulge) {
|
|
1471
|
+
if (Math.hypot(end.x - start.x, end.y - start.y) < 1e-9) continue;
|
|
1472
|
+
const bulge = start.bulge;
|
|
1473
|
+
const dx = end.x - start.x;
|
|
1474
|
+
const dy = end.y - start.y;
|
|
1475
|
+
const dist = Math.hypot(dx, dy);
|
|
1476
|
+
const radius = Math.abs(dist / 4 / bulge * (bulge * bulge + 1));
|
|
1477
|
+
const sweepFlag = bulge < 0 ? 0 : 1;
|
|
1478
|
+
const largeArcFlag = Math.abs(bulge) > 1 ? 1 : 0;
|
|
1479
|
+
d += ` A ${radius} ${radius} 0 ${largeArcFlag} ${sweepFlag} ${end.x} ${end.y}`;
|
|
1480
|
+
} else {
|
|
1481
|
+
d += ` L ${end.x} ${end.y}`;
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
d += " Z";
|
|
1485
|
+
return d;
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
1457
1489
|
function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
1458
1490
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1459
1491
|
const { layer } = pour;
|
|
@@ -1461,7 +1493,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
1461
1493
|
const color = layerNameToColor(layer, colorMap2);
|
|
1462
1494
|
const opacity = "0.5";
|
|
1463
1495
|
if (pour.shape === "rect") {
|
|
1464
|
-
const [cx, cy] =
|
|
1496
|
+
const [cx, cy] = applyToPoint18(transform, [pour.center.x, pour.center.y]);
|
|
1465
1497
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
1466
1498
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
1467
1499
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -1490,7 +1522,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
1490
1522
|
if (pour.shape === "polygon") {
|
|
1491
1523
|
if (!pour.points || pour.points.length === 0) return [];
|
|
1492
1524
|
const transformedPoints = pour.points.map(
|
|
1493
|
-
(p) =>
|
|
1525
|
+
(p) => applyToPoint18(transform, [p.x, p.y])
|
|
1494
1526
|
);
|
|
1495
1527
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
1496
1528
|
return [
|
|
@@ -1509,15 +1541,38 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
1509
1541
|
}
|
|
1510
1542
|
];
|
|
1511
1543
|
}
|
|
1544
|
+
if (pour.shape === "brep") {
|
|
1545
|
+
const { brep_shape } = pour;
|
|
1546
|
+
let d = ringToPathD(brep_shape.outer_ring.vertices, transform);
|
|
1547
|
+
for (const inner_ring of brep_shape.inner_rings ?? []) {
|
|
1548
|
+
d += ` ${ringToPathD(inner_ring.vertices, transform)}`;
|
|
1549
|
+
}
|
|
1550
|
+
return [
|
|
1551
|
+
{
|
|
1552
|
+
name: "path",
|
|
1553
|
+
type: "element",
|
|
1554
|
+
attributes: {
|
|
1555
|
+
class: "pcb-copper-pour pcb-copper-pour-brep",
|
|
1556
|
+
d,
|
|
1557
|
+
fill: color,
|
|
1558
|
+
"fill-rule": "evenodd",
|
|
1559
|
+
"fill-opacity": opacity,
|
|
1560
|
+
"data-layer": layer
|
|
1561
|
+
},
|
|
1562
|
+
children: [],
|
|
1563
|
+
value: ""
|
|
1564
|
+
}
|
|
1565
|
+
];
|
|
1566
|
+
}
|
|
1512
1567
|
return [];
|
|
1513
1568
|
}
|
|
1514
1569
|
|
|
1515
1570
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
1516
|
-
import { applyToPoint as
|
|
1571
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
1517
1572
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
1518
1573
|
const { transform } = ctx;
|
|
1519
1574
|
const { center, width, height, rotation = 0 } = component;
|
|
1520
|
-
const [x, y] =
|
|
1575
|
+
const [x, y] = applyToPoint19(transform, [center.x, center.y]);
|
|
1521
1576
|
const scaledWidth = width * Math.abs(transform.a);
|
|
1522
1577
|
const scaledHeight = height * Math.abs(transform.d);
|
|
1523
1578
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -1589,7 +1644,7 @@ var package_default = {
|
|
|
1589
1644
|
"react-cosmos": "7.0.0",
|
|
1590
1645
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
1591
1646
|
"react-dom": "19.1.0",
|
|
1592
|
-
tscircuit: "^0.0.
|
|
1647
|
+
tscircuit: "^0.0.624",
|
|
1593
1648
|
tsup: "^8.0.2",
|
|
1594
1649
|
typescript: "^5.4.5",
|
|
1595
1650
|
"vite-tsconfig-paths": "^5.0.1"
|
|
@@ -1962,8 +2017,8 @@ function createSvgObjects({
|
|
|
1962
2017
|
}
|
|
1963
2018
|
}
|
|
1964
2019
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
1965
|
-
const [x1, y1] =
|
|
1966
|
-
const [x2, y2] =
|
|
2020
|
+
const [x1, y1] = applyToPoint20(transform, [minX, minY]);
|
|
2021
|
+
const [x2, y2] = applyToPoint20(transform, [maxX, maxY]);
|
|
1967
2022
|
const width = Math.abs(x2 - x1);
|
|
1968
2023
|
const height = Math.abs(y2 - y1);
|
|
1969
2024
|
const x = Math.min(x1, x2);
|
|
@@ -1991,14 +2046,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
1991
2046
|
import { stringify as stringify2 } from "svgson";
|
|
1992
2047
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
1993
2048
|
import {
|
|
1994
|
-
applyToPoint as
|
|
2049
|
+
applyToPoint as applyToPoint27,
|
|
1995
2050
|
compose as compose6,
|
|
1996
2051
|
scale as scale3,
|
|
1997
2052
|
translate as translate6
|
|
1998
2053
|
} from "transformation-matrix";
|
|
1999
2054
|
|
|
2000
2055
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
2001
|
-
import { applyToPoint as
|
|
2056
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
2002
2057
|
var DEFAULT_BOARD_STYLE = {
|
|
2003
2058
|
fill: "none",
|
|
2004
2059
|
stroke: "rgb(0,0,0)",
|
|
@@ -2010,25 +2065,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
2010
2065
|
let path;
|
|
2011
2066
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
2012
2067
|
path = outline.map((point, index) => {
|
|
2013
|
-
const [x, y] =
|
|
2068
|
+
const [x, y] = applyToPoint21(transform, [point.x, point.y]);
|
|
2014
2069
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
2015
2070
|
}).join(" ");
|
|
2016
2071
|
} else {
|
|
2017
2072
|
const halfWidth = width / 2;
|
|
2018
2073
|
const halfHeight = height / 2;
|
|
2019
|
-
const topLeft =
|
|
2074
|
+
const topLeft = applyToPoint21(transform, [
|
|
2020
2075
|
center.x - halfWidth,
|
|
2021
2076
|
center.y - halfHeight
|
|
2022
2077
|
]);
|
|
2023
|
-
const topRight =
|
|
2078
|
+
const topRight = applyToPoint21(transform, [
|
|
2024
2079
|
center.x + halfWidth,
|
|
2025
2080
|
center.y - halfHeight
|
|
2026
2081
|
]);
|
|
2027
|
-
const bottomRight =
|
|
2082
|
+
const bottomRight = applyToPoint21(transform, [
|
|
2028
2083
|
center.x + halfWidth,
|
|
2029
2084
|
center.y + halfHeight
|
|
2030
2085
|
]);
|
|
2031
|
-
const bottomLeft =
|
|
2086
|
+
const bottomLeft = applyToPoint21(transform, [
|
|
2032
2087
|
center.x - halfWidth,
|
|
2033
2088
|
center.y + halfHeight
|
|
2034
2089
|
]);
|
|
@@ -2054,7 +2109,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
2054
2109
|
}
|
|
2055
2110
|
|
|
2056
2111
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
2057
|
-
import { applyToPoint as
|
|
2112
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
2058
2113
|
|
|
2059
2114
|
// lib/utils/get-sch-font-size.ts
|
|
2060
2115
|
import "transformation-matrix";
|
|
@@ -2080,8 +2135,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
2080
2135
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
2081
2136
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
2082
2137
|
return null;
|
|
2083
|
-
const [x, y] =
|
|
2084
|
-
const [pinX, pinY] =
|
|
2138
|
+
const [x, y] = applyToPoint23(transform, [center.x, center.y]);
|
|
2139
|
+
const [pinX, pinY] = applyToPoint23(transform, [portPosition.x, portPosition.y]);
|
|
2085
2140
|
const scaledWidth = width * Math.abs(transform.a);
|
|
2086
2141
|
const scaledHeight = height * Math.abs(transform.d);
|
|
2087
2142
|
const isTopLayer = layer === "top";
|
|
@@ -2243,11 +2298,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
2243
2298
|
}
|
|
2244
2299
|
|
|
2245
2300
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
2246
|
-
import { applyToPoint as
|
|
2301
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
2247
2302
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
2248
2303
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
2249
2304
|
const { transform } = ctx;
|
|
2250
|
-
const [x, y] =
|
|
2305
|
+
const [x, y] = applyToPoint24(transform, [hole.x, hole.y]);
|
|
2251
2306
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
2252
2307
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
2253
2308
|
const radius = scaledDiameter / 2;
|
|
@@ -2311,12 +2366,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
2311
2366
|
}
|
|
2312
2367
|
|
|
2313
2368
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
2314
|
-
import { applyToPoint as
|
|
2369
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
2315
2370
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
2316
2371
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
2317
2372
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
2318
2373
|
const { transform } = ctx;
|
|
2319
|
-
const [x, y] =
|
|
2374
|
+
const [x, y] = applyToPoint25(transform, [hole.x, hole.y]);
|
|
2320
2375
|
if (hole.shape === "pill") {
|
|
2321
2376
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
2322
2377
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -2551,14 +2606,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
2551
2606
|
}
|
|
2552
2607
|
|
|
2553
2608
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
2554
|
-
import { applyToPoint as
|
|
2609
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
2555
2610
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
2556
2611
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
2557
2612
|
const { transform } = ctx;
|
|
2558
2613
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
2559
2614
|
const width = pad.width * Math.abs(transform.a);
|
|
2560
2615
|
const height = pad.height * Math.abs(transform.d);
|
|
2561
|
-
const [x, y] =
|
|
2616
|
+
const [x, y] = applyToPoint26(transform, [pad.x, pad.y]);
|
|
2562
2617
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
2563
2618
|
return [
|
|
2564
2619
|
{
|
|
@@ -2601,7 +2656,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
2601
2656
|
const width = pad.width * Math.abs(transform.a);
|
|
2602
2657
|
const height = pad.height * Math.abs(transform.d);
|
|
2603
2658
|
const radius = pad.radius * Math.abs(transform.a);
|
|
2604
|
-
const [x, y] =
|
|
2659
|
+
const [x, y] = applyToPoint26(transform, [pad.x, pad.y]);
|
|
2605
2660
|
return [
|
|
2606
2661
|
{
|
|
2607
2662
|
name: "rect",
|
|
@@ -2624,7 +2679,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
2624
2679
|
}
|
|
2625
2680
|
if (pad.shape === "circle") {
|
|
2626
2681
|
const radius = pad.radius * Math.abs(transform.a);
|
|
2627
|
-
const [x, y] =
|
|
2682
|
+
const [x, y] = applyToPoint26(transform, [pad.x, pad.y]);
|
|
2628
2683
|
return [
|
|
2629
2684
|
{
|
|
2630
2685
|
name: "circle",
|
|
@@ -2644,7 +2699,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
2644
2699
|
}
|
|
2645
2700
|
if (pad.shape === "polygon") {
|
|
2646
2701
|
const points = (pad.points ?? []).map(
|
|
2647
|
-
(point) =>
|
|
2702
|
+
(point) => applyToPoint26(transform, [point.x, point.y])
|
|
2648
2703
|
);
|
|
2649
2704
|
return [
|
|
2650
2705
|
{
|
|
@@ -2821,8 +2876,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
2821
2876
|
}
|
|
2822
2877
|
}
|
|
2823
2878
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
2824
|
-
const [x1, y1] =
|
|
2825
|
-
const [x2, y2] =
|
|
2879
|
+
const [x1, y1] = applyToPoint27(transform, [minX, minY]);
|
|
2880
|
+
const [x2, y2] = applyToPoint27(transform, [maxX, maxY]);
|
|
2826
2881
|
const width = Math.abs(x2 - x1);
|
|
2827
2882
|
const height = Math.abs(y2 - y1);
|
|
2828
2883
|
const x = Math.min(x1, x2);
|
|
@@ -3089,14 +3144,14 @@ import {
|
|
|
3089
3144
|
} from "transformation-matrix";
|
|
3090
3145
|
|
|
3091
3146
|
// lib/sch/draw-schematic-grid.ts
|
|
3092
|
-
import { applyToPoint as
|
|
3147
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
3093
3148
|
function drawSchematicGrid(params) {
|
|
3094
3149
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
3095
3150
|
const cellSize = params.cellSize ?? 1;
|
|
3096
3151
|
const labelCells = params.labelCells ?? false;
|
|
3097
3152
|
const gridLines = [];
|
|
3098
3153
|
const transformPoint = (x, y) => {
|
|
3099
|
-
const [transformedX, transformedY] =
|
|
3154
|
+
const [transformedX, transformedY] = applyToPoint28(params.transform, [x, y]);
|
|
3100
3155
|
return { x: transformedX, y: transformedY };
|
|
3101
3156
|
};
|
|
3102
3157
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -3177,15 +3232,15 @@ function drawSchematicGrid(params) {
|
|
|
3177
3232
|
}
|
|
3178
3233
|
|
|
3179
3234
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
3180
|
-
import { applyToPoint as
|
|
3235
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
3181
3236
|
function drawSchematicLabeledPoints(params) {
|
|
3182
3237
|
const { points, transform } = params;
|
|
3183
3238
|
const labeledPointsGroup = [];
|
|
3184
3239
|
for (const point of points) {
|
|
3185
|
-
const [x1, y1] =
|
|
3186
|
-
const [x2, y2] =
|
|
3187
|
-
const [x3, y3] =
|
|
3188
|
-
const [x4, y4] =
|
|
3240
|
+
const [x1, y1] = applyToPoint29(transform, [point.x - 0.1, point.y - 0.1]);
|
|
3241
|
+
const [x2, y2] = applyToPoint29(transform, [point.x + 0.1, point.y + 0.1]);
|
|
3242
|
+
const [x3, y3] = applyToPoint29(transform, [point.x - 0.1, point.y + 0.1]);
|
|
3243
|
+
const [x4, y4] = applyToPoint29(transform, [point.x + 0.1, point.y - 0.1]);
|
|
3189
3244
|
labeledPointsGroup.push({
|
|
3190
3245
|
name: "path",
|
|
3191
3246
|
type: "element",
|
|
@@ -3196,7 +3251,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
3196
3251
|
"stroke-opacity": "0.7"
|
|
3197
3252
|
}
|
|
3198
3253
|
});
|
|
3199
|
-
const [labelX, labelY] =
|
|
3254
|
+
const [labelX, labelY] = applyToPoint29(transform, [
|
|
3200
3255
|
point.x + 0.15,
|
|
3201
3256
|
point.y - 0.15
|
|
3202
3257
|
]);
|
|
@@ -4269,7 +4324,7 @@ import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
|
4269
4324
|
import { symbols } from "schematic-symbols";
|
|
4270
4325
|
import "svgson";
|
|
4271
4326
|
import {
|
|
4272
|
-
applyToPoint as
|
|
4327
|
+
applyToPoint as applyToPoint31,
|
|
4273
4328
|
compose as compose8
|
|
4274
4329
|
} from "transformation-matrix";
|
|
4275
4330
|
|
|
@@ -4353,13 +4408,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
4353
4408
|
}
|
|
4354
4409
|
|
|
4355
4410
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
4356
|
-
import { applyToPoint as
|
|
4411
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
4357
4412
|
var createSvgSchErrorText = ({
|
|
4358
4413
|
text,
|
|
4359
4414
|
realCenter,
|
|
4360
4415
|
realToScreenTransform
|
|
4361
4416
|
}) => {
|
|
4362
|
-
const screenCenter =
|
|
4417
|
+
const screenCenter = applyToPoint30(realToScreenTransform, realCenter);
|
|
4363
4418
|
return {
|
|
4364
4419
|
type: "element",
|
|
4365
4420
|
name: "text",
|
|
@@ -4468,11 +4523,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
4468
4523
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
4469
4524
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
4470
4525
|
};
|
|
4471
|
-
const [screenMinX, screenMinY] =
|
|
4526
|
+
const [screenMinX, screenMinY] = applyToPoint31(
|
|
4472
4527
|
compose8(realToScreenTransform, transformFromSymbolToReal),
|
|
4473
4528
|
[bounds.minX, bounds.minY]
|
|
4474
4529
|
);
|
|
4475
|
-
const [screenMaxX, screenMaxY] =
|
|
4530
|
+
const [screenMaxX, screenMaxY] = applyToPoint31(
|
|
4476
4531
|
compose8(realToScreenTransform, transformFromSymbolToReal),
|
|
4477
4532
|
[bounds.maxX, bounds.maxY]
|
|
4478
4533
|
);
|
|
@@ -4501,7 +4556,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
4501
4556
|
name: "path",
|
|
4502
4557
|
attributes: {
|
|
4503
4558
|
d: points.map((p, i) => {
|
|
4504
|
-
const [x, y] =
|
|
4559
|
+
const [x, y] = applyToPoint31(
|
|
4505
4560
|
compose8(realToScreenTransform, transformFromSymbolToReal),
|
|
4506
4561
|
[p.x, p.y]
|
|
4507
4562
|
);
|
|
@@ -4517,7 +4572,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
4517
4572
|
});
|
|
4518
4573
|
}
|
|
4519
4574
|
for (const text of texts) {
|
|
4520
|
-
const screenTextPos =
|
|
4575
|
+
const screenTextPos = applyToPoint31(
|
|
4521
4576
|
compose8(realToScreenTransform, transformFromSymbolToReal),
|
|
4522
4577
|
text
|
|
4523
4578
|
);
|
|
@@ -4569,7 +4624,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
4569
4624
|
});
|
|
4570
4625
|
}
|
|
4571
4626
|
for (const box of boxes) {
|
|
4572
|
-
const screenBoxPos =
|
|
4627
|
+
const screenBoxPos = applyToPoint31(
|
|
4573
4628
|
compose8(realToScreenTransform, transformFromSymbolToReal),
|
|
4574
4629
|
box
|
|
4575
4630
|
);
|
|
@@ -4593,7 +4648,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
4593
4648
|
}
|
|
4594
4649
|
for (const port of symbol.ports) {
|
|
4595
4650
|
if (connectedSymbolPorts.has(port)) continue;
|
|
4596
|
-
const screenPortPos =
|
|
4651
|
+
const screenPortPos = applyToPoint31(
|
|
4597
4652
|
compose8(realToScreenTransform, transformFromSymbolToReal),
|
|
4598
4653
|
port
|
|
4599
4654
|
);
|
|
@@ -4613,7 +4668,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
4613
4668
|
});
|
|
4614
4669
|
}
|
|
4615
4670
|
for (const circle of circles) {
|
|
4616
|
-
const screenCirclePos =
|
|
4671
|
+
const screenCirclePos = applyToPoint31(
|
|
4617
4672
|
compose8(realToScreenTransform, transformFromSymbolToReal),
|
|
4618
4673
|
circle
|
|
4619
4674
|
);
|
|
@@ -4640,14 +4695,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
4640
4695
|
import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
4641
4696
|
import "schematic-symbols";
|
|
4642
4697
|
import "svgson";
|
|
4643
|
-
import { applyToPoint as
|
|
4698
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
4644
4699
|
|
|
4645
4700
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
4646
4701
|
import "transformation-matrix";
|
|
4647
4702
|
import "@tscircuit/circuit-json-util";
|
|
4648
4703
|
|
|
4649
4704
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
4650
|
-
import { applyToPoint as
|
|
4705
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
4651
4706
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
4652
4707
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
4653
4708
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -4700,8 +4755,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
4700
4755
|
realEdgePos.y += realPinLineLength;
|
|
4701
4756
|
break;
|
|
4702
4757
|
}
|
|
4703
|
-
const screenSchPortPos =
|
|
4704
|
-
const screenRealEdgePos =
|
|
4758
|
+
const screenSchPortPos = applyToPoint32(transform, schPort.center);
|
|
4759
|
+
const screenRealEdgePos = applyToPoint32(transform, realEdgePos);
|
|
4705
4760
|
const realLineEnd = { ...schPort.center };
|
|
4706
4761
|
switch (schPort.side_of_component) {
|
|
4707
4762
|
case "left":
|
|
@@ -4717,7 +4772,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
4717
4772
|
realLineEnd.y += PIN_CIRCLE_RADIUS_MM;
|
|
4718
4773
|
break;
|
|
4719
4774
|
}
|
|
4720
|
-
const screenLineEnd =
|
|
4775
|
+
const screenLineEnd = applyToPoint32(transform, realLineEnd);
|
|
4721
4776
|
svgObjects.push({
|
|
4722
4777
|
name: "line",
|
|
4723
4778
|
type: "element",
|
|
@@ -4839,7 +4894,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
4839
4894
|
};
|
|
4840
4895
|
|
|
4841
4896
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
4842
|
-
import { applyToPoint as
|
|
4897
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
4843
4898
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
4844
4899
|
const svgObjects = [];
|
|
4845
4900
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -4857,7 +4912,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
4857
4912
|
} else {
|
|
4858
4913
|
realPinNumberPos.y += 0.02;
|
|
4859
4914
|
}
|
|
4860
|
-
const screenPinNumberTextPos =
|
|
4915
|
+
const screenPinNumberTextPos = applyToPoint33(transform, realPinNumberPos);
|
|
4861
4916
|
svgObjects.push({
|
|
4862
4917
|
name: "text",
|
|
4863
4918
|
type: "element",
|
|
@@ -4887,7 +4942,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
4887
4942
|
};
|
|
4888
4943
|
|
|
4889
4944
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
4890
|
-
import { applyToPoint as
|
|
4945
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
4891
4946
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
4892
4947
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
4893
4948
|
const svgObjects = [];
|
|
@@ -4901,7 +4956,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
4901
4956
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
4902
4957
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
4903
4958
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
4904
|
-
const screenPinNumberTextPos =
|
|
4959
|
+
const screenPinNumberTextPos = applyToPoint34(transform, realPinNumberPos);
|
|
4905
4960
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
4906
4961
|
if (!label) return [];
|
|
4907
4962
|
const isNegated = label.startsWith("N_");
|
|
@@ -4949,13 +5004,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
4949
5004
|
};
|
|
4950
5005
|
|
|
4951
5006
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
4952
|
-
import { applyToPoint as
|
|
5007
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
4953
5008
|
var createSvgSchText = ({
|
|
4954
5009
|
elm,
|
|
4955
5010
|
transform,
|
|
4956
5011
|
colorMap: colorMap2
|
|
4957
5012
|
}) => {
|
|
4958
|
-
const center =
|
|
5013
|
+
const center = applyToPoint36(transform, elm.position);
|
|
4959
5014
|
const textAnchorMap = {
|
|
4960
5015
|
center: "middle",
|
|
4961
5016
|
center_right: "end",
|
|
@@ -5039,11 +5094,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
5039
5094
|
colorMap: colorMap2
|
|
5040
5095
|
}) => {
|
|
5041
5096
|
const svgObjects = [];
|
|
5042
|
-
const componentScreenTopLeft =
|
|
5097
|
+
const componentScreenTopLeft = applyToPoint37(transform, {
|
|
5043
5098
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
5044
5099
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
5045
5100
|
});
|
|
5046
|
-
const componentScreenBottomRight =
|
|
5101
|
+
const componentScreenBottomRight = applyToPoint37(transform, {
|
|
5047
5102
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
5048
5103
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
5049
5104
|
});
|
|
@@ -5126,13 +5181,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
5126
5181
|
}
|
|
5127
5182
|
|
|
5128
5183
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
5129
|
-
import { applyToPoint as
|
|
5184
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
5130
5185
|
function createSvgObjectsFromSchVoltageProbe({
|
|
5131
5186
|
probe,
|
|
5132
5187
|
transform,
|
|
5133
5188
|
colorMap: colorMap2
|
|
5134
5189
|
}) {
|
|
5135
|
-
const [screenX, screenY] =
|
|
5190
|
+
const [screenX, screenY] = applyToPoint38(transform, [
|
|
5136
5191
|
probe.position.x,
|
|
5137
5192
|
probe.position.y
|
|
5138
5193
|
]);
|
|
@@ -5192,17 +5247,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
5192
5247
|
}
|
|
5193
5248
|
|
|
5194
5249
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
5195
|
-
import { applyToPoint as
|
|
5250
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
5196
5251
|
function createSvgObjectsFromSchDebugObject({
|
|
5197
5252
|
debugObject,
|
|
5198
5253
|
transform
|
|
5199
5254
|
}) {
|
|
5200
5255
|
if (debugObject.shape === "rect") {
|
|
5201
|
-
let [screenLeft, screenTop] =
|
|
5256
|
+
let [screenLeft, screenTop] = applyToPoint39(transform, [
|
|
5202
5257
|
debugObject.center.x - debugObject.size.width / 2,
|
|
5203
5258
|
debugObject.center.y - debugObject.size.height / 2
|
|
5204
5259
|
]);
|
|
5205
|
-
let [screenRight, screenBottom] =
|
|
5260
|
+
let [screenRight, screenBottom] = applyToPoint39(transform, [
|
|
5206
5261
|
debugObject.center.x + debugObject.size.width / 2,
|
|
5207
5262
|
debugObject.center.y + debugObject.size.height / 2
|
|
5208
5263
|
]);
|
|
@@ -5212,7 +5267,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
5212
5267
|
];
|
|
5213
5268
|
const width = Math.abs(screenRight - screenLeft);
|
|
5214
5269
|
const height = Math.abs(screenBottom - screenTop);
|
|
5215
|
-
const [screenCenterX, screenCenterY] =
|
|
5270
|
+
const [screenCenterX, screenCenterY] = applyToPoint39(transform, [
|
|
5216
5271
|
debugObject.center.x,
|
|
5217
5272
|
debugObject.center.y
|
|
5218
5273
|
]);
|
|
@@ -5258,11 +5313,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
5258
5313
|
];
|
|
5259
5314
|
}
|
|
5260
5315
|
if (debugObject.shape === "line") {
|
|
5261
|
-
const [screenStartX, screenStartY] =
|
|
5316
|
+
const [screenStartX, screenStartY] = applyToPoint39(transform, [
|
|
5262
5317
|
debugObject.start.x,
|
|
5263
5318
|
debugObject.start.y
|
|
5264
5319
|
]);
|
|
5265
|
-
const [screenEndX, screenEndY] =
|
|
5320
|
+
const [screenEndX, screenEndY] = applyToPoint39(transform, [
|
|
5266
5321
|
debugObject.end.x,
|
|
5267
5322
|
debugObject.end.y
|
|
5268
5323
|
]);
|
|
@@ -5312,7 +5367,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
5312
5367
|
}
|
|
5313
5368
|
|
|
5314
5369
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
5315
|
-
import { applyToPoint as
|
|
5370
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
5316
5371
|
function createSchematicTrace({
|
|
5317
5372
|
trace,
|
|
5318
5373
|
transform,
|
|
@@ -5326,11 +5381,11 @@ function createSchematicTrace({
|
|
|
5326
5381
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
5327
5382
|
const edge = edges[edgeIndex];
|
|
5328
5383
|
if (edge.is_crossing) continue;
|
|
5329
|
-
const [screenFromX, screenFromY] =
|
|
5384
|
+
const [screenFromX, screenFromY] = applyToPoint40(transform, [
|
|
5330
5385
|
edge.from.x,
|
|
5331
5386
|
edge.from.y
|
|
5332
5387
|
]);
|
|
5333
|
-
const [screenToX, screenToY] =
|
|
5388
|
+
const [screenToX, screenToY] = applyToPoint40(transform, [
|
|
5334
5389
|
edge.to.x,
|
|
5335
5390
|
edge.to.y
|
|
5336
5391
|
]);
|
|
@@ -5374,11 +5429,11 @@ function createSchematicTrace({
|
|
|
5374
5429
|
}
|
|
5375
5430
|
for (const edge of edges) {
|
|
5376
5431
|
if (!edge.is_crossing) continue;
|
|
5377
|
-
const [screenFromX, screenFromY] =
|
|
5432
|
+
const [screenFromX, screenFromY] = applyToPoint40(transform, [
|
|
5378
5433
|
edge.from.x,
|
|
5379
5434
|
edge.from.y
|
|
5380
5435
|
]);
|
|
5381
|
-
const [screenToX, screenToY] =
|
|
5436
|
+
const [screenToX, screenToY] = applyToPoint40(transform, [
|
|
5382
5437
|
edge.to.x,
|
|
5383
5438
|
edge.to.y
|
|
5384
5439
|
]);
|
|
@@ -5422,7 +5477,7 @@ function createSchematicTrace({
|
|
|
5422
5477
|
}
|
|
5423
5478
|
if (trace.junctions) {
|
|
5424
5479
|
for (const junction of trace.junctions) {
|
|
5425
|
-
const [screenX, screenY] =
|
|
5480
|
+
const [screenX, screenY] = applyToPoint40(transform, [
|
|
5426
5481
|
junction.x,
|
|
5427
5482
|
junction.y
|
|
5428
5483
|
]);
|
|
@@ -5477,7 +5532,7 @@ function createSchematicTrace({
|
|
|
5477
5532
|
|
|
5478
5533
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
5479
5534
|
import {
|
|
5480
|
-
applyToPoint as
|
|
5535
|
+
applyToPoint as applyToPoint42,
|
|
5481
5536
|
compose as compose10,
|
|
5482
5537
|
rotate as rotate6,
|
|
5483
5538
|
scale as scale6,
|
|
@@ -5486,7 +5541,7 @@ import {
|
|
|
5486
5541
|
|
|
5487
5542
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
5488
5543
|
import {
|
|
5489
|
-
applyToPoint as
|
|
5544
|
+
applyToPoint as applyToPoint41,
|
|
5490
5545
|
compose as compose9,
|
|
5491
5546
|
rotate as rotate5,
|
|
5492
5547
|
scale as scale5,
|
|
@@ -5561,7 +5616,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
5561
5616
|
x: symbolBounds.minX,
|
|
5562
5617
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
5563
5618
|
};
|
|
5564
|
-
const rotatedSymbolEnd =
|
|
5619
|
+
const rotatedSymbolEnd = applyToPoint41(rotationMatrix, symbolEndPoint);
|
|
5565
5620
|
const symbolToRealTransform = compose9(
|
|
5566
5621
|
translate9(
|
|
5567
5622
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -5571,11 +5626,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
5571
5626
|
scale5(1)
|
|
5572
5627
|
// Use full symbol size
|
|
5573
5628
|
);
|
|
5574
|
-
const [screenMinX, screenMinY] =
|
|
5629
|
+
const [screenMinX, screenMinY] = applyToPoint41(
|
|
5575
5630
|
compose9(realToScreenTransform, symbolToRealTransform),
|
|
5576
5631
|
[bounds.minX, bounds.minY]
|
|
5577
5632
|
);
|
|
5578
|
-
const [screenMaxX, screenMaxY] =
|
|
5633
|
+
const [screenMaxX, screenMaxY] = applyToPoint41(
|
|
5579
5634
|
compose9(realToScreenTransform, symbolToRealTransform),
|
|
5580
5635
|
[bounds.maxX, bounds.maxY]
|
|
5581
5636
|
);
|
|
@@ -5599,7 +5654,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
5599
5654
|
});
|
|
5600
5655
|
for (const path of symbolPaths) {
|
|
5601
5656
|
const symbolPath = path.points.map((p, i) => {
|
|
5602
|
-
const [x, y] =
|
|
5657
|
+
const [x, y] = applyToPoint41(
|
|
5603
5658
|
compose9(realToScreenTransform, symbolToRealTransform),
|
|
5604
5659
|
[p.x, p.y]
|
|
5605
5660
|
);
|
|
@@ -5620,7 +5675,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
5620
5675
|
});
|
|
5621
5676
|
}
|
|
5622
5677
|
for (const text of symbolTexts) {
|
|
5623
|
-
const screenTextPos =
|
|
5678
|
+
const screenTextPos = applyToPoint41(
|
|
5624
5679
|
compose9(realToScreenTransform, symbolToRealTransform),
|
|
5625
5680
|
text
|
|
5626
5681
|
);
|
|
@@ -5662,7 +5717,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
5662
5717
|
});
|
|
5663
5718
|
}
|
|
5664
5719
|
for (const box of symbolBoxes) {
|
|
5665
|
-
const screenBoxPos =
|
|
5720
|
+
const screenBoxPos = applyToPoint41(
|
|
5666
5721
|
compose9(realToScreenTransform, symbolToRealTransform),
|
|
5667
5722
|
box
|
|
5668
5723
|
);
|
|
@@ -5685,7 +5740,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
5685
5740
|
});
|
|
5686
5741
|
}
|
|
5687
5742
|
for (const circle of symbolCircles) {
|
|
5688
|
-
const screenCirclePos =
|
|
5743
|
+
const screenCirclePos = applyToPoint41(
|
|
5689
5744
|
compose9(realToScreenTransform, symbolToRealTransform),
|
|
5690
5745
|
circle
|
|
5691
5746
|
);
|
|
@@ -5730,14 +5785,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
5730
5785
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
5731
5786
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
5732
5787
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
5733
|
-
const screenCenter =
|
|
5788
|
+
const screenCenter = applyToPoint42(realToScreenTransform, schNetLabel.center);
|
|
5734
5789
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
5735
5790
|
schNetLabel.anchor_side
|
|
5736
5791
|
);
|
|
5737
5792
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
5738
5793
|
screenTextGrowthVec.y *= -1;
|
|
5739
5794
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
5740
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
5795
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint42(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
5741
5796
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
5742
5797
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
5743
5798
|
};
|
|
@@ -5778,7 +5833,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
5778
5833
|
y: -0.6
|
|
5779
5834
|
}
|
|
5780
5835
|
].map(
|
|
5781
|
-
(fontRelativePoint) =>
|
|
5836
|
+
(fontRelativePoint) => applyToPoint42(
|
|
5782
5837
|
compose10(
|
|
5783
5838
|
realToScreenTransform,
|
|
5784
5839
|
translate10(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -5855,17 +5910,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
5855
5910
|
};
|
|
5856
5911
|
|
|
5857
5912
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
5858
|
-
import { applyToPoint as
|
|
5913
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
5859
5914
|
var createSvgObjectsFromSchematicBox = ({
|
|
5860
5915
|
schematicBox,
|
|
5861
5916
|
transform,
|
|
5862
5917
|
colorMap: colorMap2
|
|
5863
5918
|
}) => {
|
|
5864
|
-
const topLeft =
|
|
5919
|
+
const topLeft = applyToPoint43(transform, {
|
|
5865
5920
|
x: schematicBox.x,
|
|
5866
5921
|
y: schematicBox.y
|
|
5867
5922
|
});
|
|
5868
|
-
const bottomRight =
|
|
5923
|
+
const bottomRight = applyToPoint43(transform, {
|
|
5869
5924
|
x: schematicBox.x + schematicBox.width,
|
|
5870
5925
|
y: schematicBox.y + schematicBox.height
|
|
5871
5926
|
});
|
|
@@ -5901,7 +5956,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
5901
5956
|
};
|
|
5902
5957
|
|
|
5903
5958
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
5904
|
-
import { applyToPoint as
|
|
5959
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
5905
5960
|
var createSvgObjectsFromSchematicTable = ({
|
|
5906
5961
|
schematicTable,
|
|
5907
5962
|
transform,
|
|
@@ -5934,11 +5989,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
5934
5989
|
const svgObjects = [];
|
|
5935
5990
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
5936
5991
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
5937
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
5992
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint44(transform, [
|
|
5938
5993
|
topLeftX,
|
|
5939
5994
|
topLeftY
|
|
5940
5995
|
]);
|
|
5941
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
5996
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint44(transform, [
|
|
5942
5997
|
topLeftX + totalWidth,
|
|
5943
5998
|
topLeftY - totalHeight
|
|
5944
5999
|
]);
|
|
@@ -5970,8 +6025,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
5970
6025
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
5971
6026
|
);
|
|
5972
6027
|
if (!isMerged) {
|
|
5973
|
-
const start =
|
|
5974
|
-
const end =
|
|
6028
|
+
const start = applyToPoint44(transform, { x: currentX, y: segmentStartY });
|
|
6029
|
+
const end = applyToPoint44(transform, { x: currentX, y: segmentEndY });
|
|
5975
6030
|
svgObjects.push({
|
|
5976
6031
|
name: "line",
|
|
5977
6032
|
type: "element",
|
|
@@ -6000,11 +6055,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
6000
6055
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
6001
6056
|
);
|
|
6002
6057
|
if (!isMerged) {
|
|
6003
|
-
const start =
|
|
6058
|
+
const start = applyToPoint44(transform, {
|
|
6004
6059
|
x: segmentStartX,
|
|
6005
6060
|
y: currentY
|
|
6006
6061
|
});
|
|
6007
|
-
const end =
|
|
6062
|
+
const end = applyToPoint44(transform, { x: segmentEndX, y: currentY });
|
|
6008
6063
|
svgObjects.push({
|
|
6009
6064
|
name: "line",
|
|
6010
6065
|
type: "element",
|
|
@@ -6046,7 +6101,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
6046
6101
|
} else if (vertical_align === "bottom") {
|
|
6047
6102
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
6048
6103
|
}
|
|
6049
|
-
const screenTextAnchorPos =
|
|
6104
|
+
const screenTextAnchorPos = applyToPoint44(transform, realTextAnchorPos);
|
|
6050
6105
|
const fontSize = getSchScreenFontSize(
|
|
6051
6106
|
transform,
|
|
6052
6107
|
"reference_designator",
|
|
@@ -6102,13 +6157,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
6102
6157
|
|
|
6103
6158
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
6104
6159
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
6105
|
-
import { applyToPoint as
|
|
6160
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
6106
6161
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
6107
6162
|
var createSvgObjectsForSchPortHover = ({
|
|
6108
6163
|
schPort,
|
|
6109
6164
|
transform
|
|
6110
6165
|
}) => {
|
|
6111
|
-
const screenSchPortPos =
|
|
6166
|
+
const screenSchPortPos = applyToPoint45(transform, schPort.center);
|
|
6112
6167
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
6113
6168
|
return [
|
|
6114
6169
|
{
|
|
@@ -6416,18 +6471,18 @@ var circuitJsonToSchematicSvg = convertCircuitJsonToSchematicSvg;
|
|
|
6416
6471
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
6417
6472
|
import { stringify as stringify4 } from "svgson";
|
|
6418
6473
|
import {
|
|
6419
|
-
applyToPoint as
|
|
6474
|
+
applyToPoint as applyToPoint48,
|
|
6420
6475
|
compose as compose12,
|
|
6421
6476
|
scale as scale8,
|
|
6422
6477
|
translate as translate12
|
|
6423
6478
|
} from "transformation-matrix";
|
|
6424
6479
|
|
|
6425
6480
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
6426
|
-
import { applyToPoint as
|
|
6481
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
6427
6482
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
6428
6483
|
const { transform, layer: layerFilter } = ctx;
|
|
6429
6484
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
6430
|
-
const [x, y] =
|
|
6485
|
+
const [x, y] = applyToPoint47(transform, [solderPaste.x, solderPaste.y]);
|
|
6431
6486
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
6432
6487
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
6433
6488
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -6630,8 +6685,8 @@ function createSvgObjects3({ elm, ctx }) {
|
|
|
6630
6685
|
}
|
|
6631
6686
|
}
|
|
6632
6687
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
6633
|
-
const [x1, y1] =
|
|
6634
|
-
const [x2, y2] =
|
|
6688
|
+
const [x1, y1] = applyToPoint48(transform, [minX, minY]);
|
|
6689
|
+
const [x2, y2] = applyToPoint48(transform, [maxX, maxY]);
|
|
6635
6690
|
const width = Math.abs(x2 - x1);
|
|
6636
6691
|
const height = Math.abs(y2 - y1);
|
|
6637
6692
|
const x = Math.min(x1, x2);
|