circuit-to-svg 0.0.142 → 0.0.144
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +10 -0
- package/dist/index.js +154 -122
- 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 applyToPoint18,
|
|
5
5
|
compose as compose4,
|
|
6
6
|
scale as scale2,
|
|
7
7
|
translate as translate4
|
|
@@ -834,12 +834,20 @@ var DEFAULT_PCB_COLOR_MAP = {
|
|
|
834
834
|
top: "rgb(200, 52, 52)",
|
|
835
835
|
bottom: "rgb(77, 127, 196)"
|
|
836
836
|
},
|
|
837
|
+
soldermask: {
|
|
838
|
+
top: "rgb(200, 52, 52)",
|
|
839
|
+
bottom: "rgb(77, 127, 196)"
|
|
840
|
+
},
|
|
837
841
|
drill: "#FF26E2",
|
|
838
842
|
silkscreen: {
|
|
839
843
|
top: "#f2eda1",
|
|
840
844
|
bottom: "#5da9e9"
|
|
841
845
|
},
|
|
842
|
-
boardOutline: "rgba(255, 255, 255, 0.5)"
|
|
846
|
+
boardOutline: "rgba(255, 255, 255, 0.5)",
|
|
847
|
+
debugComponent: {
|
|
848
|
+
fill: null,
|
|
849
|
+
stroke: null
|
|
850
|
+
}
|
|
843
851
|
};
|
|
844
852
|
var HOLE_COLOR = DEFAULT_PCB_COLOR_MAP.drill;
|
|
845
853
|
var SILKSCREEN_TOP_COLOR = DEFAULT_PCB_COLOR_MAP.silkscreen.top;
|
|
@@ -913,11 +921,11 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
913
921
|
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
914
922
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
915
923
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
916
|
-
const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
|
|
917
924
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
918
925
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
919
926
|
const width = pad.width * Math.abs(transform.a);
|
|
920
927
|
const height = pad.height * Math.abs(transform.d);
|
|
928
|
+
const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
|
|
921
929
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
922
930
|
return [
|
|
923
931
|
{
|
|
@@ -954,6 +962,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
954
962
|
const width = pad.width * Math.abs(transform.a);
|
|
955
963
|
const height = pad.height * Math.abs(transform.d);
|
|
956
964
|
const radius = pad.radius * Math.abs(transform.a);
|
|
965
|
+
const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
|
|
957
966
|
return [
|
|
958
967
|
{
|
|
959
968
|
name: "rect",
|
|
@@ -971,6 +980,22 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
971
980
|
}
|
|
972
981
|
];
|
|
973
982
|
}
|
|
983
|
+
if (pad.shape === "polygon") {
|
|
984
|
+
const points = (pad.points ?? []).map(
|
|
985
|
+
(point) => applyToPoint11(transform, [point.x, point.y])
|
|
986
|
+
);
|
|
987
|
+
return [
|
|
988
|
+
{
|
|
989
|
+
name: "polygon",
|
|
990
|
+
type: "element",
|
|
991
|
+
attributes: {
|
|
992
|
+
class: "pcb-pad",
|
|
993
|
+
fill: layerNameToColor(pad.layer),
|
|
994
|
+
points
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
];
|
|
998
|
+
}
|
|
974
999
|
return [];
|
|
975
1000
|
}
|
|
976
1001
|
|
|
@@ -1331,6 +1356,43 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1331
1356
|
return [];
|
|
1332
1357
|
}
|
|
1333
1358
|
|
|
1359
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
1360
|
+
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
1361
|
+
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
1362
|
+
const { transform } = ctx;
|
|
1363
|
+
const { center, width, height, rotation = 0 } = component;
|
|
1364
|
+
const [x, y] = applyToPoint17(transform, [center.x, center.y]);
|
|
1365
|
+
const scaledWidth = width * Math.abs(transform.a);
|
|
1366
|
+
const scaledHeight = height * Math.abs(transform.d);
|
|
1367
|
+
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
1368
|
+
if (!ctx.colorMap.debugComponent?.fill && !ctx.colorMap.debugComponent?.stroke) {
|
|
1369
|
+
return [];
|
|
1370
|
+
}
|
|
1371
|
+
return [
|
|
1372
|
+
{
|
|
1373
|
+
name: "g",
|
|
1374
|
+
type: "element",
|
|
1375
|
+
attributes: { transform: transformStr },
|
|
1376
|
+
children: [
|
|
1377
|
+
{
|
|
1378
|
+
name: "rect",
|
|
1379
|
+
type: "element",
|
|
1380
|
+
attributes: {
|
|
1381
|
+
class: "pcb-component",
|
|
1382
|
+
x: (-scaledWidth / 2).toString(),
|
|
1383
|
+
y: (-scaledHeight / 2).toString(),
|
|
1384
|
+
width: scaledWidth.toString(),
|
|
1385
|
+
height: scaledHeight.toString(),
|
|
1386
|
+
fill: ctx.colorMap.debugComponent.fill ?? "transparent",
|
|
1387
|
+
stroke: ctx.colorMap.debugComponent.stroke ?? "transparent"
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
],
|
|
1391
|
+
value: ""
|
|
1392
|
+
}
|
|
1393
|
+
];
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1334
1396
|
// lib/pcb/convert-circuit-json-to-pcb-svg.ts
|
|
1335
1397
|
var OBJECT_ORDER = [
|
|
1336
1398
|
"pcb_trace_error",
|
|
@@ -1360,7 +1422,15 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
1360
1422
|
top: colorOverrides?.silkscreen?.top ?? DEFAULT_PCB_COLOR_MAP.silkscreen.top,
|
|
1361
1423
|
bottom: colorOverrides?.silkscreen?.bottom ?? DEFAULT_PCB_COLOR_MAP.silkscreen.bottom
|
|
1362
1424
|
},
|
|
1363
|
-
boardOutline: colorOverrides?.boardOutline ?? DEFAULT_PCB_COLOR_MAP.boardOutline
|
|
1425
|
+
boardOutline: colorOverrides?.boardOutline ?? DEFAULT_PCB_COLOR_MAP.boardOutline,
|
|
1426
|
+
soldermask: {
|
|
1427
|
+
top: colorOverrides?.soldermask?.top ?? DEFAULT_PCB_COLOR_MAP.soldermask.top,
|
|
1428
|
+
bottom: colorOverrides?.soldermask?.bottom ?? DEFAULT_PCB_COLOR_MAP.soldermask.bottom
|
|
1429
|
+
},
|
|
1430
|
+
debugComponent: {
|
|
1431
|
+
fill: colorOverrides?.debugComponent?.fill ?? DEFAULT_PCB_COLOR_MAP.debugComponent.fill,
|
|
1432
|
+
stroke: colorOverrides?.debugComponent?.stroke ?? DEFAULT_PCB_COLOR_MAP.debugComponent.stroke
|
|
1433
|
+
}
|
|
1364
1434
|
};
|
|
1365
1435
|
let minX = Number.POSITIVE_INFINITY;
|
|
1366
1436
|
let minY = Number.POSITIVE_INFINITY;
|
|
@@ -1577,14 +1647,13 @@ function createSvgObjects({
|
|
|
1577
1647
|
circuitJson,
|
|
1578
1648
|
ctx
|
|
1579
1649
|
}) {
|
|
1580
|
-
const { transform, layer: layerFilter, shouldDrawErrors } = ctx;
|
|
1581
1650
|
switch (elm.type) {
|
|
1582
1651
|
case "pcb_trace_error":
|
|
1583
1652
|
return createSvgObjectsFromPcbTraceError(elm, circuitJson, ctx).filter(
|
|
1584
1653
|
Boolean
|
|
1585
1654
|
);
|
|
1586
1655
|
case "pcb_component":
|
|
1587
|
-
return
|
|
1656
|
+
return createSvgObjectsFromPcbComponent(elm, ctx).filter(Boolean);
|
|
1588
1657
|
case "pcb_trace":
|
|
1589
1658
|
return createSvgObjectsFromPcbTrace(elm, ctx);
|
|
1590
1659
|
case "pcb_plated_hole":
|
|
@@ -1617,46 +1686,9 @@ function createSvgObjects({
|
|
|
1617
1686
|
return [];
|
|
1618
1687
|
}
|
|
1619
1688
|
}
|
|
1620
|
-
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
1621
|
-
const { transform } = ctx;
|
|
1622
|
-
const { center, width, height, rotation = 0 } = component;
|
|
1623
|
-
const [x, y] = applyToPoint17(transform, [center.x, center.y]);
|
|
1624
|
-
const scaledWidth = width * Math.abs(transform.a);
|
|
1625
|
-
const scaledHeight = height * Math.abs(transform.d);
|
|
1626
|
-
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
1627
|
-
return {
|
|
1628
|
-
name: "g",
|
|
1629
|
-
type: "element",
|
|
1630
|
-
attributes: { transform: transformStr },
|
|
1631
|
-
children: [
|
|
1632
|
-
{
|
|
1633
|
-
name: "rect",
|
|
1634
|
-
type: "element",
|
|
1635
|
-
attributes: {
|
|
1636
|
-
class: "pcb-component",
|
|
1637
|
-
x: (-scaledWidth / 2).toString(),
|
|
1638
|
-
y: (-scaledHeight / 2).toString(),
|
|
1639
|
-
width: scaledWidth.toString(),
|
|
1640
|
-
height: scaledHeight.toString()
|
|
1641
|
-
}
|
|
1642
|
-
},
|
|
1643
|
-
{
|
|
1644
|
-
name: "rect",
|
|
1645
|
-
type: "element",
|
|
1646
|
-
attributes: {
|
|
1647
|
-
class: "pcb-component-outline",
|
|
1648
|
-
x: (-scaledWidth / 2).toString(),
|
|
1649
|
-
y: (-scaledHeight / 2).toString(),
|
|
1650
|
-
width: scaledWidth.toString(),
|
|
1651
|
-
height: scaledHeight.toString()
|
|
1652
|
-
}
|
|
1653
|
-
}
|
|
1654
|
-
]
|
|
1655
|
-
};
|
|
1656
|
-
}
|
|
1657
1689
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
1658
|
-
const [x1, y1] =
|
|
1659
|
-
const [x2, y2] =
|
|
1690
|
+
const [x1, y1] = applyToPoint18(transform, [minX, minY]);
|
|
1691
|
+
const [x2, y2] = applyToPoint18(transform, [maxX, maxY]);
|
|
1660
1692
|
const width = Math.abs(x2 - x1);
|
|
1661
1693
|
const height = Math.abs(y2 - y1);
|
|
1662
1694
|
const x = Math.min(x1, x2);
|
|
@@ -1684,14 +1716,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
1684
1716
|
import { stringify as stringify2 } from "svgson";
|
|
1685
1717
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
1686
1718
|
import {
|
|
1687
|
-
applyToPoint as
|
|
1719
|
+
applyToPoint as applyToPoint22,
|
|
1688
1720
|
compose as compose5,
|
|
1689
1721
|
scale as scale3,
|
|
1690
1722
|
translate as translate5
|
|
1691
1723
|
} from "transformation-matrix";
|
|
1692
1724
|
|
|
1693
1725
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
1694
|
-
import { applyToPoint as
|
|
1726
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
1695
1727
|
var DEFAULT_BOARD_STYLE = {
|
|
1696
1728
|
fill: "none",
|
|
1697
1729
|
stroke: "rgb(0,0,0)",
|
|
@@ -1703,25 +1735,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
1703
1735
|
let path;
|
|
1704
1736
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
1705
1737
|
path = outline.map((point, index) => {
|
|
1706
|
-
const [x, y] =
|
|
1738
|
+
const [x, y] = applyToPoint19(transform, [point.x, point.y]);
|
|
1707
1739
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
1708
1740
|
}).join(" ");
|
|
1709
1741
|
} else {
|
|
1710
1742
|
const halfWidth = width / 2;
|
|
1711
1743
|
const halfHeight = height / 2;
|
|
1712
|
-
const topLeft =
|
|
1744
|
+
const topLeft = applyToPoint19(transform, [
|
|
1713
1745
|
center.x - halfWidth,
|
|
1714
1746
|
center.y - halfHeight
|
|
1715
1747
|
]);
|
|
1716
|
-
const topRight =
|
|
1748
|
+
const topRight = applyToPoint19(transform, [
|
|
1717
1749
|
center.x + halfWidth,
|
|
1718
1750
|
center.y - halfHeight
|
|
1719
1751
|
]);
|
|
1720
|
-
const bottomRight =
|
|
1752
|
+
const bottomRight = applyToPoint19(transform, [
|
|
1721
1753
|
center.x + halfWidth,
|
|
1722
1754
|
center.y + halfHeight
|
|
1723
1755
|
]);
|
|
1724
|
-
const bottomLeft =
|
|
1756
|
+
const bottomLeft = applyToPoint19(transform, [
|
|
1725
1757
|
center.x - halfWidth,
|
|
1726
1758
|
center.y + halfHeight
|
|
1727
1759
|
]);
|
|
@@ -1747,7 +1779,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
1747
1779
|
}
|
|
1748
1780
|
|
|
1749
1781
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
1750
|
-
import { applyToPoint as
|
|
1782
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
1751
1783
|
|
|
1752
1784
|
// lib/utils/get-sch-font-size.ts
|
|
1753
1785
|
import "transformation-matrix";
|
|
@@ -1765,8 +1797,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
1765
1797
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
1766
1798
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
1767
1799
|
return null;
|
|
1768
|
-
const [x, y] =
|
|
1769
|
-
const [pinX, pinY] =
|
|
1800
|
+
const [x, y] = applyToPoint21(transform, [center.x, center.y]);
|
|
1801
|
+
const [pinX, pinY] = applyToPoint21(transform, [portPosition.x, portPosition.y]);
|
|
1770
1802
|
const scaledWidth = width * Math.abs(transform.a);
|
|
1771
1803
|
const scaledHeight = height * Math.abs(transform.d);
|
|
1772
1804
|
const isTopLayer = layer === "top";
|
|
@@ -2063,8 +2095,8 @@ function createSvgObjects2(elm, transform, soup) {
|
|
|
2063
2095
|
}
|
|
2064
2096
|
}
|
|
2065
2097
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
2066
|
-
const [x1, y1] =
|
|
2067
|
-
const [x2, y2] =
|
|
2098
|
+
const [x1, y1] = applyToPoint22(transform, [minX, minY]);
|
|
2099
|
+
const [x2, y2] = applyToPoint22(transform, [maxX, maxY]);
|
|
2068
2100
|
const width = Math.abs(x2 - x1);
|
|
2069
2101
|
const height = Math.abs(y2 - y1);
|
|
2070
2102
|
const x = Math.min(x1, x2);
|
|
@@ -2330,14 +2362,14 @@ import {
|
|
|
2330
2362
|
} from "transformation-matrix";
|
|
2331
2363
|
|
|
2332
2364
|
// lib/sch/draw-schematic-grid.ts
|
|
2333
|
-
import { applyToPoint as
|
|
2365
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
2334
2366
|
function drawSchematicGrid(params) {
|
|
2335
2367
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
2336
2368
|
const cellSize = params.cellSize ?? 1;
|
|
2337
2369
|
const labelCells = params.labelCells ?? false;
|
|
2338
2370
|
const gridLines = [];
|
|
2339
2371
|
const transformPoint = (x, y) => {
|
|
2340
|
-
const [transformedX, transformedY] =
|
|
2372
|
+
const [transformedX, transformedY] = applyToPoint23(params.transform, [x, y]);
|
|
2341
2373
|
return { x: transformedX, y: transformedY };
|
|
2342
2374
|
};
|
|
2343
2375
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -2418,15 +2450,15 @@ function drawSchematicGrid(params) {
|
|
|
2418
2450
|
}
|
|
2419
2451
|
|
|
2420
2452
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
2421
|
-
import { applyToPoint as
|
|
2453
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
2422
2454
|
function drawSchematicLabeledPoints(params) {
|
|
2423
2455
|
const { points, transform } = params;
|
|
2424
2456
|
const labeledPointsGroup = [];
|
|
2425
2457
|
for (const point of points) {
|
|
2426
|
-
const [x1, y1] =
|
|
2427
|
-
const [x2, y2] =
|
|
2428
|
-
const [x3, y3] =
|
|
2429
|
-
const [x4, y4] =
|
|
2458
|
+
const [x1, y1] = applyToPoint24(transform, [point.x - 0.1, point.y - 0.1]);
|
|
2459
|
+
const [x2, y2] = applyToPoint24(transform, [point.x + 0.1, point.y + 0.1]);
|
|
2460
|
+
const [x3, y3] = applyToPoint24(transform, [point.x - 0.1, point.y + 0.1]);
|
|
2461
|
+
const [x4, y4] = applyToPoint24(transform, [point.x + 0.1, point.y - 0.1]);
|
|
2430
2462
|
labeledPointsGroup.push({
|
|
2431
2463
|
name: "path",
|
|
2432
2464
|
type: "element",
|
|
@@ -2437,7 +2469,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
2437
2469
|
"stroke-opacity": "0.7"
|
|
2438
2470
|
}
|
|
2439
2471
|
});
|
|
2440
|
-
const [labelX, labelY] =
|
|
2472
|
+
const [labelX, labelY] = applyToPoint24(transform, [
|
|
2441
2473
|
point.x + 0.15,
|
|
2442
2474
|
point.y - 0.15
|
|
2443
2475
|
]);
|
|
@@ -2548,7 +2580,7 @@ import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
|
2548
2580
|
import { symbols } from "schematic-symbols";
|
|
2549
2581
|
import "svgson";
|
|
2550
2582
|
import {
|
|
2551
|
-
applyToPoint as
|
|
2583
|
+
applyToPoint as applyToPoint26,
|
|
2552
2584
|
compose as compose7
|
|
2553
2585
|
} from "transformation-matrix";
|
|
2554
2586
|
|
|
@@ -2632,13 +2664,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
2632
2664
|
}
|
|
2633
2665
|
|
|
2634
2666
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
2635
|
-
import { applyToPoint as
|
|
2667
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
2636
2668
|
var createSvgSchErrorText = ({
|
|
2637
2669
|
text,
|
|
2638
2670
|
realCenter,
|
|
2639
2671
|
realToScreenTransform
|
|
2640
2672
|
}) => {
|
|
2641
|
-
const screenCenter =
|
|
2673
|
+
const screenCenter = applyToPoint25(realToScreenTransform, realCenter);
|
|
2642
2674
|
return {
|
|
2643
2675
|
type: "element",
|
|
2644
2676
|
name: "text",
|
|
@@ -2729,11 +2761,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2729
2761
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
2730
2762
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
2731
2763
|
};
|
|
2732
|
-
const [screenMinX, screenMinY] =
|
|
2764
|
+
const [screenMinX, screenMinY] = applyToPoint26(
|
|
2733
2765
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2734
2766
|
[bounds.minX, bounds.minY]
|
|
2735
2767
|
);
|
|
2736
|
-
const [screenMaxX, screenMaxY] =
|
|
2768
|
+
const [screenMaxX, screenMaxY] = applyToPoint26(
|
|
2737
2769
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2738
2770
|
[bounds.maxX, bounds.maxY]
|
|
2739
2771
|
);
|
|
@@ -2762,7 +2794,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2762
2794
|
name: "path",
|
|
2763
2795
|
attributes: {
|
|
2764
2796
|
d: points.map((p, i) => {
|
|
2765
|
-
const [x, y] =
|
|
2797
|
+
const [x, y] = applyToPoint26(
|
|
2766
2798
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2767
2799
|
[p.x, p.y]
|
|
2768
2800
|
);
|
|
@@ -2777,7 +2809,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2777
2809
|
});
|
|
2778
2810
|
}
|
|
2779
2811
|
for (const text of texts) {
|
|
2780
|
-
const screenTextPos =
|
|
2812
|
+
const screenTextPos = applyToPoint26(
|
|
2781
2813
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2782
2814
|
text
|
|
2783
2815
|
);
|
|
@@ -2823,7 +2855,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2823
2855
|
});
|
|
2824
2856
|
}
|
|
2825
2857
|
for (const box of boxes) {
|
|
2826
|
-
const screenBoxPos =
|
|
2858
|
+
const screenBoxPos = applyToPoint26(
|
|
2827
2859
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2828
2860
|
box
|
|
2829
2861
|
);
|
|
@@ -2846,7 +2878,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2846
2878
|
});
|
|
2847
2879
|
}
|
|
2848
2880
|
for (const port of symbol.ports) {
|
|
2849
|
-
const screenPortPos =
|
|
2881
|
+
const screenPortPos = applyToPoint26(
|
|
2850
2882
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2851
2883
|
port
|
|
2852
2884
|
);
|
|
@@ -2866,7 +2898,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2866
2898
|
});
|
|
2867
2899
|
}
|
|
2868
2900
|
for (const circle of circles) {
|
|
2869
|
-
const screenCirclePos =
|
|
2901
|
+
const screenCirclePos = applyToPoint26(
|
|
2870
2902
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2871
2903
|
circle
|
|
2872
2904
|
);
|
|
@@ -2893,14 +2925,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2893
2925
|
import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
2894
2926
|
import "schematic-symbols";
|
|
2895
2927
|
import "svgson";
|
|
2896
|
-
import { applyToPoint as
|
|
2928
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
2897
2929
|
|
|
2898
2930
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
2899
2931
|
import "transformation-matrix";
|
|
2900
2932
|
import "@tscircuit/circuit-json-util";
|
|
2901
2933
|
|
|
2902
2934
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
2903
|
-
import { applyToPoint as
|
|
2935
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
2904
2936
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
2905
2937
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
2906
2938
|
var createSvgObjectsForSchPortBoxLine = ({
|
|
@@ -2930,8 +2962,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
2930
2962
|
realEdgePos.y += realPinLineLength;
|
|
2931
2963
|
break;
|
|
2932
2964
|
}
|
|
2933
|
-
const screenSchPortPos =
|
|
2934
|
-
const screenRealEdgePos =
|
|
2965
|
+
const screenSchPortPos = applyToPoint27(transform, schPort.center);
|
|
2966
|
+
const screenRealEdgePos = applyToPoint27(transform, realEdgePos);
|
|
2935
2967
|
const realLineEnd = { ...schPort.center };
|
|
2936
2968
|
switch (schPort.side_of_component) {
|
|
2937
2969
|
case "left":
|
|
@@ -2947,7 +2979,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
2947
2979
|
realLineEnd.y += PIN_CIRCLE_RADIUS_MM;
|
|
2948
2980
|
break;
|
|
2949
2981
|
}
|
|
2950
|
-
const screenLineEnd =
|
|
2982
|
+
const screenLineEnd = applyToPoint27(transform, realLineEnd);
|
|
2951
2983
|
svgObjects.push({
|
|
2952
2984
|
name: "line",
|
|
2953
2985
|
type: "element",
|
|
@@ -2994,7 +3026,7 @@ var getUnitVectorFromOutsideToEdge = (side) => {
|
|
|
2994
3026
|
};
|
|
2995
3027
|
|
|
2996
3028
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
2997
|
-
import { applyToPoint as
|
|
3029
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
2998
3030
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
2999
3031
|
const svgObjects = [];
|
|
3000
3032
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -3012,7 +3044,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
3012
3044
|
} else {
|
|
3013
3045
|
realPinNumberPos.y += 0.02;
|
|
3014
3046
|
}
|
|
3015
|
-
const screenPinNumberTextPos =
|
|
3047
|
+
const screenPinNumberTextPos = applyToPoint28(transform, realPinNumberPos);
|
|
3016
3048
|
svgObjects.push({
|
|
3017
3049
|
name: "text",
|
|
3018
3050
|
type: "element",
|
|
@@ -3042,7 +3074,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
3042
3074
|
};
|
|
3043
3075
|
|
|
3044
3076
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
3045
|
-
import { applyToPoint as
|
|
3077
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
3046
3078
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
3047
3079
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
3048
3080
|
const svgObjects = [];
|
|
@@ -3056,7 +3088,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
3056
3088
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
3057
3089
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
3058
3090
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
3059
|
-
const screenPinNumberTextPos =
|
|
3091
|
+
const screenPinNumberTextPos = applyToPoint29(transform, realPinNumberPos);
|
|
3060
3092
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
3061
3093
|
if (!label) return [];
|
|
3062
3094
|
svgObjects.push({
|
|
@@ -3098,13 +3130,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
3098
3130
|
};
|
|
3099
3131
|
|
|
3100
3132
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
3101
|
-
import { applyToPoint as
|
|
3133
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
3102
3134
|
var createSvgSchText = ({
|
|
3103
3135
|
elm,
|
|
3104
3136
|
transform,
|
|
3105
3137
|
colorMap: colorMap2
|
|
3106
3138
|
}) => {
|
|
3107
|
-
const center =
|
|
3139
|
+
const center = applyToPoint31(transform, elm.position);
|
|
3108
3140
|
const textAnchorMap = {
|
|
3109
3141
|
center: "middle",
|
|
3110
3142
|
center_right: "end",
|
|
@@ -3169,11 +3201,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
3169
3201
|
colorMap: colorMap2
|
|
3170
3202
|
}) => {
|
|
3171
3203
|
const svgObjects = [];
|
|
3172
|
-
const componentScreenTopLeft =
|
|
3204
|
+
const componentScreenTopLeft = applyToPoint32(transform, {
|
|
3173
3205
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
3174
3206
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
3175
3207
|
});
|
|
3176
|
-
const componentScreenBottomRight =
|
|
3208
|
+
const componentScreenBottomRight = applyToPoint32(transform, {
|
|
3177
3209
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
3178
3210
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
3179
3211
|
});
|
|
@@ -3256,13 +3288,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
3256
3288
|
}
|
|
3257
3289
|
|
|
3258
3290
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
3259
|
-
import { applyToPoint as
|
|
3291
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
3260
3292
|
function createSvgObjectsFromSchVoltageProbe({
|
|
3261
3293
|
probe,
|
|
3262
3294
|
transform,
|
|
3263
3295
|
colorMap: colorMap2
|
|
3264
3296
|
}) {
|
|
3265
|
-
const [screenX, screenY] =
|
|
3297
|
+
const [screenX, screenY] = applyToPoint33(transform, [
|
|
3266
3298
|
probe.position.x,
|
|
3267
3299
|
probe.position.y
|
|
3268
3300
|
]);
|
|
@@ -3322,17 +3354,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
3322
3354
|
}
|
|
3323
3355
|
|
|
3324
3356
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
3325
|
-
import { applyToPoint as
|
|
3357
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
3326
3358
|
function createSvgObjectsFromSchDebugObject({
|
|
3327
3359
|
debugObject,
|
|
3328
3360
|
transform
|
|
3329
3361
|
}) {
|
|
3330
3362
|
if (debugObject.shape === "rect") {
|
|
3331
|
-
let [screenLeft, screenTop] =
|
|
3363
|
+
let [screenLeft, screenTop] = applyToPoint34(transform, [
|
|
3332
3364
|
debugObject.center.x - debugObject.size.width / 2,
|
|
3333
3365
|
debugObject.center.y - debugObject.size.height / 2
|
|
3334
3366
|
]);
|
|
3335
|
-
let [screenRight, screenBottom] =
|
|
3367
|
+
let [screenRight, screenBottom] = applyToPoint34(transform, [
|
|
3336
3368
|
debugObject.center.x + debugObject.size.width / 2,
|
|
3337
3369
|
debugObject.center.y + debugObject.size.height / 2
|
|
3338
3370
|
]);
|
|
@@ -3342,7 +3374,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
3342
3374
|
];
|
|
3343
3375
|
const width = Math.abs(screenRight - screenLeft);
|
|
3344
3376
|
const height = Math.abs(screenBottom - screenTop);
|
|
3345
|
-
const [screenCenterX, screenCenterY] =
|
|
3377
|
+
const [screenCenterX, screenCenterY] = applyToPoint34(transform, [
|
|
3346
3378
|
debugObject.center.x,
|
|
3347
3379
|
debugObject.center.y
|
|
3348
3380
|
]);
|
|
@@ -3388,11 +3420,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
3388
3420
|
];
|
|
3389
3421
|
}
|
|
3390
3422
|
if (debugObject.shape === "line") {
|
|
3391
|
-
const [screenStartX, screenStartY] =
|
|
3423
|
+
const [screenStartX, screenStartY] = applyToPoint34(transform, [
|
|
3392
3424
|
debugObject.start.x,
|
|
3393
3425
|
debugObject.start.y
|
|
3394
3426
|
]);
|
|
3395
|
-
const [screenEndX, screenEndY] =
|
|
3427
|
+
const [screenEndX, screenEndY] = applyToPoint34(transform, [
|
|
3396
3428
|
debugObject.end.x,
|
|
3397
3429
|
debugObject.end.y
|
|
3398
3430
|
]);
|
|
@@ -3442,7 +3474,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
3442
3474
|
}
|
|
3443
3475
|
|
|
3444
3476
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
3445
|
-
import { applyToPoint as
|
|
3477
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
3446
3478
|
function createSchematicTrace({
|
|
3447
3479
|
trace,
|
|
3448
3480
|
transform,
|
|
@@ -3455,11 +3487,11 @@ function createSchematicTrace({
|
|
|
3455
3487
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
3456
3488
|
const edge = edges[edgeIndex];
|
|
3457
3489
|
if (edge.is_crossing) continue;
|
|
3458
|
-
const [screenFromX, screenFromY] =
|
|
3490
|
+
const [screenFromX, screenFromY] = applyToPoint35(transform, [
|
|
3459
3491
|
edge.from.x,
|
|
3460
3492
|
edge.from.y
|
|
3461
3493
|
]);
|
|
3462
|
-
const [screenToX, screenToY] =
|
|
3494
|
+
const [screenToX, screenToY] = applyToPoint35(transform, [
|
|
3463
3495
|
edge.to.x,
|
|
3464
3496
|
edge.to.y
|
|
3465
3497
|
]);
|
|
@@ -3471,11 +3503,11 @@ function createSchematicTrace({
|
|
|
3471
3503
|
}
|
|
3472
3504
|
for (const edge of edges) {
|
|
3473
3505
|
if (!edge.is_crossing) continue;
|
|
3474
|
-
const [screenFromX, screenFromY] =
|
|
3506
|
+
const [screenFromX, screenFromY] = applyToPoint35(transform, [
|
|
3475
3507
|
edge.from.x,
|
|
3476
3508
|
edge.from.y
|
|
3477
3509
|
]);
|
|
3478
|
-
const [screenToX, screenToY] =
|
|
3510
|
+
const [screenToX, screenToY] = applyToPoint35(transform, [
|
|
3479
3511
|
edge.to.x,
|
|
3480
3512
|
edge.to.y
|
|
3481
3513
|
]);
|
|
@@ -3551,7 +3583,7 @@ function createSchematicTrace({
|
|
|
3551
3583
|
}
|
|
3552
3584
|
if (trace.junctions) {
|
|
3553
3585
|
for (const junction of trace.junctions) {
|
|
3554
|
-
const [screenX, screenY] =
|
|
3586
|
+
const [screenX, screenY] = applyToPoint35(transform, [
|
|
3555
3587
|
junction.x,
|
|
3556
3588
|
junction.y
|
|
3557
3589
|
]);
|
|
@@ -3586,7 +3618,7 @@ function createSchematicTrace({
|
|
|
3586
3618
|
|
|
3587
3619
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
3588
3620
|
import {
|
|
3589
|
-
applyToPoint as
|
|
3621
|
+
applyToPoint as applyToPoint37,
|
|
3590
3622
|
compose as compose9,
|
|
3591
3623
|
rotate as rotate5,
|
|
3592
3624
|
scale as scale6,
|
|
@@ -4374,7 +4406,7 @@ var estimateTextWidth = (text) => {
|
|
|
4374
4406
|
|
|
4375
4407
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
4376
4408
|
import {
|
|
4377
|
-
applyToPoint as
|
|
4409
|
+
applyToPoint as applyToPoint36,
|
|
4378
4410
|
compose as compose8,
|
|
4379
4411
|
rotate as rotate4,
|
|
4380
4412
|
scale as scale5,
|
|
@@ -4498,7 +4530,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4498
4530
|
x: symbolBounds.minX,
|
|
4499
4531
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
4500
4532
|
};
|
|
4501
|
-
const rotatedSymbolEnd =
|
|
4533
|
+
const rotatedSymbolEnd = applyToPoint36(rotationMatrix, symbolEndPoint);
|
|
4502
4534
|
const symbolToRealTransform = compose8(
|
|
4503
4535
|
translate8(
|
|
4504
4536
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -4508,11 +4540,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4508
4540
|
scale5(1)
|
|
4509
4541
|
// Use full symbol size
|
|
4510
4542
|
);
|
|
4511
|
-
const [screenMinX, screenMinY] =
|
|
4543
|
+
const [screenMinX, screenMinY] = applyToPoint36(
|
|
4512
4544
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4513
4545
|
[bounds.minX, bounds.minY]
|
|
4514
4546
|
);
|
|
4515
|
-
const [screenMaxX, screenMaxY] =
|
|
4547
|
+
const [screenMaxX, screenMaxY] = applyToPoint36(
|
|
4516
4548
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4517
4549
|
[bounds.maxX, bounds.maxY]
|
|
4518
4550
|
);
|
|
@@ -4536,7 +4568,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4536
4568
|
});
|
|
4537
4569
|
for (const path of symbolPaths) {
|
|
4538
4570
|
const symbolPath = path.points.map((p, i) => {
|
|
4539
|
-
const [x, y] =
|
|
4571
|
+
const [x, y] = applyToPoint36(
|
|
4540
4572
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4541
4573
|
[p.x, p.y]
|
|
4542
4574
|
);
|
|
@@ -4556,7 +4588,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4556
4588
|
});
|
|
4557
4589
|
}
|
|
4558
4590
|
for (const text of symbolTexts) {
|
|
4559
|
-
const screenTextPos =
|
|
4591
|
+
const screenTextPos = applyToPoint36(
|
|
4560
4592
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4561
4593
|
text
|
|
4562
4594
|
);
|
|
@@ -4598,7 +4630,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4598
4630
|
});
|
|
4599
4631
|
}
|
|
4600
4632
|
for (const box of symbolBoxes) {
|
|
4601
|
-
const screenBoxPos =
|
|
4633
|
+
const screenBoxPos = applyToPoint36(
|
|
4602
4634
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4603
4635
|
box
|
|
4604
4636
|
);
|
|
@@ -4621,7 +4653,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4621
4653
|
});
|
|
4622
4654
|
}
|
|
4623
4655
|
for (const circle of symbolCircles) {
|
|
4624
|
-
const screenCirclePos =
|
|
4656
|
+
const screenCirclePos = applyToPoint36(
|
|
4625
4657
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4626
4658
|
circle
|
|
4627
4659
|
);
|
|
@@ -4665,14 +4697,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
4665
4697
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
4666
4698
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
4667
4699
|
const textWidthFSR = estimateTextWidth(schNetLabel.text || "");
|
|
4668
|
-
const screenCenter =
|
|
4700
|
+
const screenCenter = applyToPoint37(realToScreenTransform, schNetLabel.center);
|
|
4669
4701
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
4670
4702
|
schNetLabel.anchor_side
|
|
4671
4703
|
);
|
|
4672
4704
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
4673
4705
|
screenTextGrowthVec.y *= -1;
|
|
4674
4706
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * schNetLabel.text.length + END_PADDING_FSR;
|
|
4675
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
4707
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint37(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
4676
4708
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
4677
4709
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
4678
4710
|
};
|
|
@@ -4713,7 +4745,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
4713
4745
|
y: -0.6
|
|
4714
4746
|
}
|
|
4715
4747
|
].map(
|
|
4716
|
-
(fontRelativePoint) =>
|
|
4748
|
+
(fontRelativePoint) => applyToPoint37(
|
|
4717
4749
|
compose9(
|
|
4718
4750
|
realToScreenTransform,
|
|
4719
4751
|
translate9(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -4790,17 +4822,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
4790
4822
|
};
|
|
4791
4823
|
|
|
4792
4824
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
4793
|
-
import { applyToPoint as
|
|
4825
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
4794
4826
|
var createSvgObjectsFromSchematicBox = ({
|
|
4795
4827
|
schematicBox,
|
|
4796
4828
|
transform,
|
|
4797
4829
|
colorMap: colorMap2
|
|
4798
4830
|
}) => {
|
|
4799
|
-
const topLeft =
|
|
4831
|
+
const topLeft = applyToPoint38(transform, {
|
|
4800
4832
|
x: schematicBox.x,
|
|
4801
4833
|
y: schematicBox.y
|
|
4802
4834
|
});
|
|
4803
|
-
const bottomRight =
|
|
4835
|
+
const bottomRight = applyToPoint38(transform, {
|
|
4804
4836
|
x: schematicBox.x + schematicBox.width,
|
|
4805
4837
|
y: schematicBox.y + schematicBox.height
|
|
4806
4838
|
});
|
|
@@ -5034,18 +5066,18 @@ var circuitJsonToSchematicSvg = convertCircuitJsonToSchematicSvg;
|
|
|
5034
5066
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
5035
5067
|
import { stringify as stringify4 } from "svgson";
|
|
5036
5068
|
import {
|
|
5037
|
-
applyToPoint as
|
|
5069
|
+
applyToPoint as applyToPoint41,
|
|
5038
5070
|
compose as compose11,
|
|
5039
5071
|
scale as scale8,
|
|
5040
5072
|
translate as translate11
|
|
5041
5073
|
} from "transformation-matrix";
|
|
5042
5074
|
|
|
5043
5075
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
5044
|
-
import { applyToPoint as
|
|
5076
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
5045
5077
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
5046
5078
|
const { transform, layer: layerFilter } = ctx;
|
|
5047
5079
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
5048
|
-
const [x, y] =
|
|
5080
|
+
const [x, y] = applyToPoint40(transform, [solderPaste.x, solderPaste.y]);
|
|
5049
5081
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
5050
5082
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
5051
5083
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -5240,8 +5272,8 @@ function createSvgObjects3({ elm, ctx }) {
|
|
|
5240
5272
|
}
|
|
5241
5273
|
}
|
|
5242
5274
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
5243
|
-
const [x1, y1] =
|
|
5244
|
-
const [x2, y2] =
|
|
5275
|
+
const [x1, y1] = applyToPoint41(transform, [minX, minY]);
|
|
5276
|
+
const [x2, y2] = applyToPoint41(transform, [maxX, maxY]);
|
|
5245
5277
|
const width = Math.abs(x2 - x1);
|
|
5246
5278
|
const height = Math.abs(y2 - y1);
|
|
5247
5279
|
const x = Math.min(x1, x2);
|