circuit-to-svg 0.0.143 → 0.0.145
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 +144 -125
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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;
|
|
@@ -1348,6 +1356,43 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
1348
1356
|
return [];
|
|
1349
1357
|
}
|
|
1350
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
|
+
|
|
1351
1396
|
// lib/pcb/convert-circuit-json-to-pcb-svg.ts
|
|
1352
1397
|
var OBJECT_ORDER = [
|
|
1353
1398
|
"pcb_trace_error",
|
|
@@ -1377,7 +1422,15 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
1377
1422
|
top: colorOverrides?.silkscreen?.top ?? DEFAULT_PCB_COLOR_MAP.silkscreen.top,
|
|
1378
1423
|
bottom: colorOverrides?.silkscreen?.bottom ?? DEFAULT_PCB_COLOR_MAP.silkscreen.bottom
|
|
1379
1424
|
},
|
|
1380
|
-
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
|
+
}
|
|
1381
1434
|
};
|
|
1382
1435
|
let minX = Number.POSITIVE_INFINITY;
|
|
1383
1436
|
let minY = Number.POSITIVE_INFINITY;
|
|
@@ -1413,8 +1466,12 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
1413
1466
|
}
|
|
1414
1467
|
}
|
|
1415
1468
|
const padding = drawPaddingOutsideBoard ? 1 : 0;
|
|
1416
|
-
const
|
|
1417
|
-
const
|
|
1469
|
+
const boundsMinX = drawPaddingOutsideBoard || !isFinite(boardMinX) ? minX : boardMinX;
|
|
1470
|
+
const boundsMinY = drawPaddingOutsideBoard || !isFinite(boardMinY) ? minY : boardMinY;
|
|
1471
|
+
const boundsMaxX = drawPaddingOutsideBoard || !isFinite(boardMaxX) ? maxX : boardMaxX;
|
|
1472
|
+
const boundsMaxY = drawPaddingOutsideBoard || !isFinite(boardMaxY) ? maxY : boardMaxY;
|
|
1473
|
+
const circuitWidth = boundsMaxX - boundsMinX + 2 * padding;
|
|
1474
|
+
const circuitHeight = boundsMaxY - boundsMinY + 2 * padding;
|
|
1418
1475
|
let svgWidth = options?.width ?? 800;
|
|
1419
1476
|
let svgHeight = options?.height ?? 600;
|
|
1420
1477
|
if (options?.matchBoardAspectRatio) {
|
|
@@ -1444,8 +1501,8 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
1444
1501
|
const offsetY = (svgHeight - circuitHeight * scaleFactor) / 2;
|
|
1445
1502
|
const transform = compose4(
|
|
1446
1503
|
translate4(
|
|
1447
|
-
offsetX -
|
|
1448
|
-
svgHeight - offsetY +
|
|
1504
|
+
offsetX - boundsMinX * scaleFactor + padding * scaleFactor,
|
|
1505
|
+
svgHeight - offsetY + boundsMinY * scaleFactor - padding * scaleFactor
|
|
1449
1506
|
),
|
|
1450
1507
|
scale2(scaleFactor, -scaleFactor)
|
|
1451
1508
|
// Flip in y-direction
|
|
@@ -1594,14 +1651,13 @@ function createSvgObjects({
|
|
|
1594
1651
|
circuitJson,
|
|
1595
1652
|
ctx
|
|
1596
1653
|
}) {
|
|
1597
|
-
const { transform, layer: layerFilter, shouldDrawErrors } = ctx;
|
|
1598
1654
|
switch (elm.type) {
|
|
1599
1655
|
case "pcb_trace_error":
|
|
1600
1656
|
return createSvgObjectsFromPcbTraceError(elm, circuitJson, ctx).filter(
|
|
1601
1657
|
Boolean
|
|
1602
1658
|
);
|
|
1603
1659
|
case "pcb_component":
|
|
1604
|
-
return
|
|
1660
|
+
return createSvgObjectsFromPcbComponent(elm, ctx).filter(Boolean);
|
|
1605
1661
|
case "pcb_trace":
|
|
1606
1662
|
return createSvgObjectsFromPcbTrace(elm, ctx);
|
|
1607
1663
|
case "pcb_plated_hole":
|
|
@@ -1634,46 +1690,9 @@ function createSvgObjects({
|
|
|
1634
1690
|
return [];
|
|
1635
1691
|
}
|
|
1636
1692
|
}
|
|
1637
|
-
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
1638
|
-
const { transform } = ctx;
|
|
1639
|
-
const { center, width, height, rotation = 0 } = component;
|
|
1640
|
-
const [x, y] = applyToPoint17(transform, [center.x, center.y]);
|
|
1641
|
-
const scaledWidth = width * Math.abs(transform.a);
|
|
1642
|
-
const scaledHeight = height * Math.abs(transform.d);
|
|
1643
|
-
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
1644
|
-
return {
|
|
1645
|
-
name: "g",
|
|
1646
|
-
type: "element",
|
|
1647
|
-
attributes: { transform: transformStr },
|
|
1648
|
-
children: [
|
|
1649
|
-
{
|
|
1650
|
-
name: "rect",
|
|
1651
|
-
type: "element",
|
|
1652
|
-
attributes: {
|
|
1653
|
-
class: "pcb-component",
|
|
1654
|
-
x: (-scaledWidth / 2).toString(),
|
|
1655
|
-
y: (-scaledHeight / 2).toString(),
|
|
1656
|
-
width: scaledWidth.toString(),
|
|
1657
|
-
height: scaledHeight.toString()
|
|
1658
|
-
}
|
|
1659
|
-
},
|
|
1660
|
-
{
|
|
1661
|
-
name: "rect",
|
|
1662
|
-
type: "element",
|
|
1663
|
-
attributes: {
|
|
1664
|
-
class: "pcb-component-outline",
|
|
1665
|
-
x: (-scaledWidth / 2).toString(),
|
|
1666
|
-
y: (-scaledHeight / 2).toString(),
|
|
1667
|
-
width: scaledWidth.toString(),
|
|
1668
|
-
height: scaledHeight.toString()
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
]
|
|
1672
|
-
};
|
|
1673
|
-
}
|
|
1674
1693
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
1675
|
-
const [x1, y1] =
|
|
1676
|
-
const [x2, y2] =
|
|
1694
|
+
const [x1, y1] = applyToPoint18(transform, [minX, minY]);
|
|
1695
|
+
const [x2, y2] = applyToPoint18(transform, [maxX, maxY]);
|
|
1677
1696
|
const width = Math.abs(x2 - x1);
|
|
1678
1697
|
const height = Math.abs(y2 - y1);
|
|
1679
1698
|
const x = Math.min(x1, x2);
|
|
@@ -1701,14 +1720,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
1701
1720
|
import { stringify as stringify2 } from "svgson";
|
|
1702
1721
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
1703
1722
|
import {
|
|
1704
|
-
applyToPoint as
|
|
1723
|
+
applyToPoint as applyToPoint22,
|
|
1705
1724
|
compose as compose5,
|
|
1706
1725
|
scale as scale3,
|
|
1707
1726
|
translate as translate5
|
|
1708
1727
|
} from "transformation-matrix";
|
|
1709
1728
|
|
|
1710
1729
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
1711
|
-
import { applyToPoint as
|
|
1730
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
1712
1731
|
var DEFAULT_BOARD_STYLE = {
|
|
1713
1732
|
fill: "none",
|
|
1714
1733
|
stroke: "rgb(0,0,0)",
|
|
@@ -1720,25 +1739,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
1720
1739
|
let path;
|
|
1721
1740
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
1722
1741
|
path = outline.map((point, index) => {
|
|
1723
|
-
const [x, y] =
|
|
1742
|
+
const [x, y] = applyToPoint19(transform, [point.x, point.y]);
|
|
1724
1743
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
1725
1744
|
}).join(" ");
|
|
1726
1745
|
} else {
|
|
1727
1746
|
const halfWidth = width / 2;
|
|
1728
1747
|
const halfHeight = height / 2;
|
|
1729
|
-
const topLeft =
|
|
1748
|
+
const topLeft = applyToPoint19(transform, [
|
|
1730
1749
|
center.x - halfWidth,
|
|
1731
1750
|
center.y - halfHeight
|
|
1732
1751
|
]);
|
|
1733
|
-
const topRight =
|
|
1752
|
+
const topRight = applyToPoint19(transform, [
|
|
1734
1753
|
center.x + halfWidth,
|
|
1735
1754
|
center.y - halfHeight
|
|
1736
1755
|
]);
|
|
1737
|
-
const bottomRight =
|
|
1756
|
+
const bottomRight = applyToPoint19(transform, [
|
|
1738
1757
|
center.x + halfWidth,
|
|
1739
1758
|
center.y + halfHeight
|
|
1740
1759
|
]);
|
|
1741
|
-
const bottomLeft =
|
|
1760
|
+
const bottomLeft = applyToPoint19(transform, [
|
|
1742
1761
|
center.x - halfWidth,
|
|
1743
1762
|
center.y + halfHeight
|
|
1744
1763
|
]);
|
|
@@ -1764,7 +1783,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
1764
1783
|
}
|
|
1765
1784
|
|
|
1766
1785
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
1767
|
-
import { applyToPoint as
|
|
1786
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
1768
1787
|
|
|
1769
1788
|
// lib/utils/get-sch-font-size.ts
|
|
1770
1789
|
import "transformation-matrix";
|
|
@@ -1782,8 +1801,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
1782
1801
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
1783
1802
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
1784
1803
|
return null;
|
|
1785
|
-
const [x, y] =
|
|
1786
|
-
const [pinX, pinY] =
|
|
1804
|
+
const [x, y] = applyToPoint21(transform, [center.x, center.y]);
|
|
1805
|
+
const [pinX, pinY] = applyToPoint21(transform, [portPosition.x, portPosition.y]);
|
|
1787
1806
|
const scaledWidth = width * Math.abs(transform.a);
|
|
1788
1807
|
const scaledHeight = height * Math.abs(transform.d);
|
|
1789
1808
|
const isTopLayer = layer === "top";
|
|
@@ -2080,8 +2099,8 @@ function createSvgObjects2(elm, transform, soup) {
|
|
|
2080
2099
|
}
|
|
2081
2100
|
}
|
|
2082
2101
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
2083
|
-
const [x1, y1] =
|
|
2084
|
-
const [x2, y2] =
|
|
2102
|
+
const [x1, y1] = applyToPoint22(transform, [minX, minY]);
|
|
2103
|
+
const [x2, y2] = applyToPoint22(transform, [maxX, maxY]);
|
|
2085
2104
|
const width = Math.abs(x2 - x1);
|
|
2086
2105
|
const height = Math.abs(y2 - y1);
|
|
2087
2106
|
const x = Math.min(x1, x2);
|
|
@@ -2347,14 +2366,14 @@ import {
|
|
|
2347
2366
|
} from "transformation-matrix";
|
|
2348
2367
|
|
|
2349
2368
|
// lib/sch/draw-schematic-grid.ts
|
|
2350
|
-
import { applyToPoint as
|
|
2369
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
2351
2370
|
function drawSchematicGrid(params) {
|
|
2352
2371
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
2353
2372
|
const cellSize = params.cellSize ?? 1;
|
|
2354
2373
|
const labelCells = params.labelCells ?? false;
|
|
2355
2374
|
const gridLines = [];
|
|
2356
2375
|
const transformPoint = (x, y) => {
|
|
2357
|
-
const [transformedX, transformedY] =
|
|
2376
|
+
const [transformedX, transformedY] = applyToPoint23(params.transform, [x, y]);
|
|
2358
2377
|
return { x: transformedX, y: transformedY };
|
|
2359
2378
|
};
|
|
2360
2379
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -2435,15 +2454,15 @@ function drawSchematicGrid(params) {
|
|
|
2435
2454
|
}
|
|
2436
2455
|
|
|
2437
2456
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
2438
|
-
import { applyToPoint as
|
|
2457
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
2439
2458
|
function drawSchematicLabeledPoints(params) {
|
|
2440
2459
|
const { points, transform } = params;
|
|
2441
2460
|
const labeledPointsGroup = [];
|
|
2442
2461
|
for (const point of points) {
|
|
2443
|
-
const [x1, y1] =
|
|
2444
|
-
const [x2, y2] =
|
|
2445
|
-
const [x3, y3] =
|
|
2446
|
-
const [x4, y4] =
|
|
2462
|
+
const [x1, y1] = applyToPoint24(transform, [point.x - 0.1, point.y - 0.1]);
|
|
2463
|
+
const [x2, y2] = applyToPoint24(transform, [point.x + 0.1, point.y + 0.1]);
|
|
2464
|
+
const [x3, y3] = applyToPoint24(transform, [point.x - 0.1, point.y + 0.1]);
|
|
2465
|
+
const [x4, y4] = applyToPoint24(transform, [point.x + 0.1, point.y - 0.1]);
|
|
2447
2466
|
labeledPointsGroup.push({
|
|
2448
2467
|
name: "path",
|
|
2449
2468
|
type: "element",
|
|
@@ -2454,7 +2473,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
2454
2473
|
"stroke-opacity": "0.7"
|
|
2455
2474
|
}
|
|
2456
2475
|
});
|
|
2457
|
-
const [labelX, labelY] =
|
|
2476
|
+
const [labelX, labelY] = applyToPoint24(transform, [
|
|
2458
2477
|
point.x + 0.15,
|
|
2459
2478
|
point.y - 0.15
|
|
2460
2479
|
]);
|
|
@@ -2565,7 +2584,7 @@ import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
|
2565
2584
|
import { symbols } from "schematic-symbols";
|
|
2566
2585
|
import "svgson";
|
|
2567
2586
|
import {
|
|
2568
|
-
applyToPoint as
|
|
2587
|
+
applyToPoint as applyToPoint26,
|
|
2569
2588
|
compose as compose7
|
|
2570
2589
|
} from "transformation-matrix";
|
|
2571
2590
|
|
|
@@ -2649,13 +2668,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
2649
2668
|
}
|
|
2650
2669
|
|
|
2651
2670
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
2652
|
-
import { applyToPoint as
|
|
2671
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
2653
2672
|
var createSvgSchErrorText = ({
|
|
2654
2673
|
text,
|
|
2655
2674
|
realCenter,
|
|
2656
2675
|
realToScreenTransform
|
|
2657
2676
|
}) => {
|
|
2658
|
-
const screenCenter =
|
|
2677
|
+
const screenCenter = applyToPoint25(realToScreenTransform, realCenter);
|
|
2659
2678
|
return {
|
|
2660
2679
|
type: "element",
|
|
2661
2680
|
name: "text",
|
|
@@ -2746,11 +2765,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2746
2765
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
2747
2766
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
2748
2767
|
};
|
|
2749
|
-
const [screenMinX, screenMinY] =
|
|
2768
|
+
const [screenMinX, screenMinY] = applyToPoint26(
|
|
2750
2769
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2751
2770
|
[bounds.minX, bounds.minY]
|
|
2752
2771
|
);
|
|
2753
|
-
const [screenMaxX, screenMaxY] =
|
|
2772
|
+
const [screenMaxX, screenMaxY] = applyToPoint26(
|
|
2754
2773
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2755
2774
|
[bounds.maxX, bounds.maxY]
|
|
2756
2775
|
);
|
|
@@ -2779,7 +2798,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2779
2798
|
name: "path",
|
|
2780
2799
|
attributes: {
|
|
2781
2800
|
d: points.map((p, i) => {
|
|
2782
|
-
const [x, y] =
|
|
2801
|
+
const [x, y] = applyToPoint26(
|
|
2783
2802
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2784
2803
|
[p.x, p.y]
|
|
2785
2804
|
);
|
|
@@ -2794,7 +2813,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2794
2813
|
});
|
|
2795
2814
|
}
|
|
2796
2815
|
for (const text of texts) {
|
|
2797
|
-
const screenTextPos =
|
|
2816
|
+
const screenTextPos = applyToPoint26(
|
|
2798
2817
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2799
2818
|
text
|
|
2800
2819
|
);
|
|
@@ -2840,7 +2859,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2840
2859
|
});
|
|
2841
2860
|
}
|
|
2842
2861
|
for (const box of boxes) {
|
|
2843
|
-
const screenBoxPos =
|
|
2862
|
+
const screenBoxPos = applyToPoint26(
|
|
2844
2863
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2845
2864
|
box
|
|
2846
2865
|
);
|
|
@@ -2863,7 +2882,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2863
2882
|
});
|
|
2864
2883
|
}
|
|
2865
2884
|
for (const port of symbol.ports) {
|
|
2866
|
-
const screenPortPos =
|
|
2885
|
+
const screenPortPos = applyToPoint26(
|
|
2867
2886
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2868
2887
|
port
|
|
2869
2888
|
);
|
|
@@ -2883,7 +2902,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2883
2902
|
});
|
|
2884
2903
|
}
|
|
2885
2904
|
for (const circle of circles) {
|
|
2886
|
-
const screenCirclePos =
|
|
2905
|
+
const screenCirclePos = applyToPoint26(
|
|
2887
2906
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
2888
2907
|
circle
|
|
2889
2908
|
);
|
|
@@ -2910,14 +2929,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
2910
2929
|
import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
2911
2930
|
import "schematic-symbols";
|
|
2912
2931
|
import "svgson";
|
|
2913
|
-
import { applyToPoint as
|
|
2932
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
2914
2933
|
|
|
2915
2934
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
2916
2935
|
import "transformation-matrix";
|
|
2917
2936
|
import "@tscircuit/circuit-json-util";
|
|
2918
2937
|
|
|
2919
2938
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
2920
|
-
import { applyToPoint as
|
|
2939
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
2921
2940
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
2922
2941
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
2923
2942
|
var createSvgObjectsForSchPortBoxLine = ({
|
|
@@ -2947,8 +2966,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
2947
2966
|
realEdgePos.y += realPinLineLength;
|
|
2948
2967
|
break;
|
|
2949
2968
|
}
|
|
2950
|
-
const screenSchPortPos =
|
|
2951
|
-
const screenRealEdgePos =
|
|
2969
|
+
const screenSchPortPos = applyToPoint27(transform, schPort.center);
|
|
2970
|
+
const screenRealEdgePos = applyToPoint27(transform, realEdgePos);
|
|
2952
2971
|
const realLineEnd = { ...schPort.center };
|
|
2953
2972
|
switch (schPort.side_of_component) {
|
|
2954
2973
|
case "left":
|
|
@@ -2964,7 +2983,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
2964
2983
|
realLineEnd.y += PIN_CIRCLE_RADIUS_MM;
|
|
2965
2984
|
break;
|
|
2966
2985
|
}
|
|
2967
|
-
const screenLineEnd =
|
|
2986
|
+
const screenLineEnd = applyToPoint27(transform, realLineEnd);
|
|
2968
2987
|
svgObjects.push({
|
|
2969
2988
|
name: "line",
|
|
2970
2989
|
type: "element",
|
|
@@ -3011,7 +3030,7 @@ var getUnitVectorFromOutsideToEdge = (side) => {
|
|
|
3011
3030
|
};
|
|
3012
3031
|
|
|
3013
3032
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
3014
|
-
import { applyToPoint as
|
|
3033
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
3015
3034
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
3016
3035
|
const svgObjects = [];
|
|
3017
3036
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -3029,7 +3048,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
3029
3048
|
} else {
|
|
3030
3049
|
realPinNumberPos.y += 0.02;
|
|
3031
3050
|
}
|
|
3032
|
-
const screenPinNumberTextPos =
|
|
3051
|
+
const screenPinNumberTextPos = applyToPoint28(transform, realPinNumberPos);
|
|
3033
3052
|
svgObjects.push({
|
|
3034
3053
|
name: "text",
|
|
3035
3054
|
type: "element",
|
|
@@ -3059,7 +3078,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
3059
3078
|
};
|
|
3060
3079
|
|
|
3061
3080
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
3062
|
-
import { applyToPoint as
|
|
3081
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
3063
3082
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
3064
3083
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
3065
3084
|
const svgObjects = [];
|
|
@@ -3073,7 +3092,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
3073
3092
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
3074
3093
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
3075
3094
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
3076
|
-
const screenPinNumberTextPos =
|
|
3095
|
+
const screenPinNumberTextPos = applyToPoint29(transform, realPinNumberPos);
|
|
3077
3096
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
3078
3097
|
if (!label) return [];
|
|
3079
3098
|
svgObjects.push({
|
|
@@ -3115,13 +3134,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
3115
3134
|
};
|
|
3116
3135
|
|
|
3117
3136
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
3118
|
-
import { applyToPoint as
|
|
3137
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
3119
3138
|
var createSvgSchText = ({
|
|
3120
3139
|
elm,
|
|
3121
3140
|
transform,
|
|
3122
3141
|
colorMap: colorMap2
|
|
3123
3142
|
}) => {
|
|
3124
|
-
const center =
|
|
3143
|
+
const center = applyToPoint31(transform, elm.position);
|
|
3125
3144
|
const textAnchorMap = {
|
|
3126
3145
|
center: "middle",
|
|
3127
3146
|
center_right: "end",
|
|
@@ -3186,11 +3205,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
3186
3205
|
colorMap: colorMap2
|
|
3187
3206
|
}) => {
|
|
3188
3207
|
const svgObjects = [];
|
|
3189
|
-
const componentScreenTopLeft =
|
|
3208
|
+
const componentScreenTopLeft = applyToPoint32(transform, {
|
|
3190
3209
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
3191
3210
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
3192
3211
|
});
|
|
3193
|
-
const componentScreenBottomRight =
|
|
3212
|
+
const componentScreenBottomRight = applyToPoint32(transform, {
|
|
3194
3213
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
3195
3214
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
3196
3215
|
});
|
|
@@ -3273,13 +3292,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
3273
3292
|
}
|
|
3274
3293
|
|
|
3275
3294
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
3276
|
-
import { applyToPoint as
|
|
3295
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
3277
3296
|
function createSvgObjectsFromSchVoltageProbe({
|
|
3278
3297
|
probe,
|
|
3279
3298
|
transform,
|
|
3280
3299
|
colorMap: colorMap2
|
|
3281
3300
|
}) {
|
|
3282
|
-
const [screenX, screenY] =
|
|
3301
|
+
const [screenX, screenY] = applyToPoint33(transform, [
|
|
3283
3302
|
probe.position.x,
|
|
3284
3303
|
probe.position.y
|
|
3285
3304
|
]);
|
|
@@ -3339,17 +3358,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
3339
3358
|
}
|
|
3340
3359
|
|
|
3341
3360
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
3342
|
-
import { applyToPoint as
|
|
3361
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
3343
3362
|
function createSvgObjectsFromSchDebugObject({
|
|
3344
3363
|
debugObject,
|
|
3345
3364
|
transform
|
|
3346
3365
|
}) {
|
|
3347
3366
|
if (debugObject.shape === "rect") {
|
|
3348
|
-
let [screenLeft, screenTop] =
|
|
3367
|
+
let [screenLeft, screenTop] = applyToPoint34(transform, [
|
|
3349
3368
|
debugObject.center.x - debugObject.size.width / 2,
|
|
3350
3369
|
debugObject.center.y - debugObject.size.height / 2
|
|
3351
3370
|
]);
|
|
3352
|
-
let [screenRight, screenBottom] =
|
|
3371
|
+
let [screenRight, screenBottom] = applyToPoint34(transform, [
|
|
3353
3372
|
debugObject.center.x + debugObject.size.width / 2,
|
|
3354
3373
|
debugObject.center.y + debugObject.size.height / 2
|
|
3355
3374
|
]);
|
|
@@ -3359,7 +3378,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
3359
3378
|
];
|
|
3360
3379
|
const width = Math.abs(screenRight - screenLeft);
|
|
3361
3380
|
const height = Math.abs(screenBottom - screenTop);
|
|
3362
|
-
const [screenCenterX, screenCenterY] =
|
|
3381
|
+
const [screenCenterX, screenCenterY] = applyToPoint34(transform, [
|
|
3363
3382
|
debugObject.center.x,
|
|
3364
3383
|
debugObject.center.y
|
|
3365
3384
|
]);
|
|
@@ -3405,11 +3424,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
3405
3424
|
];
|
|
3406
3425
|
}
|
|
3407
3426
|
if (debugObject.shape === "line") {
|
|
3408
|
-
const [screenStartX, screenStartY] =
|
|
3427
|
+
const [screenStartX, screenStartY] = applyToPoint34(transform, [
|
|
3409
3428
|
debugObject.start.x,
|
|
3410
3429
|
debugObject.start.y
|
|
3411
3430
|
]);
|
|
3412
|
-
const [screenEndX, screenEndY] =
|
|
3431
|
+
const [screenEndX, screenEndY] = applyToPoint34(transform, [
|
|
3413
3432
|
debugObject.end.x,
|
|
3414
3433
|
debugObject.end.y
|
|
3415
3434
|
]);
|
|
@@ -3459,7 +3478,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
3459
3478
|
}
|
|
3460
3479
|
|
|
3461
3480
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
3462
|
-
import { applyToPoint as
|
|
3481
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
3463
3482
|
function createSchematicTrace({
|
|
3464
3483
|
trace,
|
|
3465
3484
|
transform,
|
|
@@ -3472,11 +3491,11 @@ function createSchematicTrace({
|
|
|
3472
3491
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
3473
3492
|
const edge = edges[edgeIndex];
|
|
3474
3493
|
if (edge.is_crossing) continue;
|
|
3475
|
-
const [screenFromX, screenFromY] =
|
|
3494
|
+
const [screenFromX, screenFromY] = applyToPoint35(transform, [
|
|
3476
3495
|
edge.from.x,
|
|
3477
3496
|
edge.from.y
|
|
3478
3497
|
]);
|
|
3479
|
-
const [screenToX, screenToY] =
|
|
3498
|
+
const [screenToX, screenToY] = applyToPoint35(transform, [
|
|
3480
3499
|
edge.to.x,
|
|
3481
3500
|
edge.to.y
|
|
3482
3501
|
]);
|
|
@@ -3488,11 +3507,11 @@ function createSchematicTrace({
|
|
|
3488
3507
|
}
|
|
3489
3508
|
for (const edge of edges) {
|
|
3490
3509
|
if (!edge.is_crossing) continue;
|
|
3491
|
-
const [screenFromX, screenFromY] =
|
|
3510
|
+
const [screenFromX, screenFromY] = applyToPoint35(transform, [
|
|
3492
3511
|
edge.from.x,
|
|
3493
3512
|
edge.from.y
|
|
3494
3513
|
]);
|
|
3495
|
-
const [screenToX, screenToY] =
|
|
3514
|
+
const [screenToX, screenToY] = applyToPoint35(transform, [
|
|
3496
3515
|
edge.to.x,
|
|
3497
3516
|
edge.to.y
|
|
3498
3517
|
]);
|
|
@@ -3568,7 +3587,7 @@ function createSchematicTrace({
|
|
|
3568
3587
|
}
|
|
3569
3588
|
if (trace.junctions) {
|
|
3570
3589
|
for (const junction of trace.junctions) {
|
|
3571
|
-
const [screenX, screenY] =
|
|
3590
|
+
const [screenX, screenY] = applyToPoint35(transform, [
|
|
3572
3591
|
junction.x,
|
|
3573
3592
|
junction.y
|
|
3574
3593
|
]);
|
|
@@ -3603,7 +3622,7 @@ function createSchematicTrace({
|
|
|
3603
3622
|
|
|
3604
3623
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
3605
3624
|
import {
|
|
3606
|
-
applyToPoint as
|
|
3625
|
+
applyToPoint as applyToPoint37,
|
|
3607
3626
|
compose as compose9,
|
|
3608
3627
|
rotate as rotate5,
|
|
3609
3628
|
scale as scale6,
|
|
@@ -4391,7 +4410,7 @@ var estimateTextWidth = (text) => {
|
|
|
4391
4410
|
|
|
4392
4411
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
4393
4412
|
import {
|
|
4394
|
-
applyToPoint as
|
|
4413
|
+
applyToPoint as applyToPoint36,
|
|
4395
4414
|
compose as compose8,
|
|
4396
4415
|
rotate as rotate4,
|
|
4397
4416
|
scale as scale5,
|
|
@@ -4515,7 +4534,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4515
4534
|
x: symbolBounds.minX,
|
|
4516
4535
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
4517
4536
|
};
|
|
4518
|
-
const rotatedSymbolEnd =
|
|
4537
|
+
const rotatedSymbolEnd = applyToPoint36(rotationMatrix, symbolEndPoint);
|
|
4519
4538
|
const symbolToRealTransform = compose8(
|
|
4520
4539
|
translate8(
|
|
4521
4540
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -4525,11 +4544,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4525
4544
|
scale5(1)
|
|
4526
4545
|
// Use full symbol size
|
|
4527
4546
|
);
|
|
4528
|
-
const [screenMinX, screenMinY] =
|
|
4547
|
+
const [screenMinX, screenMinY] = applyToPoint36(
|
|
4529
4548
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4530
4549
|
[bounds.minX, bounds.minY]
|
|
4531
4550
|
);
|
|
4532
|
-
const [screenMaxX, screenMaxY] =
|
|
4551
|
+
const [screenMaxX, screenMaxY] = applyToPoint36(
|
|
4533
4552
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4534
4553
|
[bounds.maxX, bounds.maxY]
|
|
4535
4554
|
);
|
|
@@ -4553,7 +4572,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4553
4572
|
});
|
|
4554
4573
|
for (const path of symbolPaths) {
|
|
4555
4574
|
const symbolPath = path.points.map((p, i) => {
|
|
4556
|
-
const [x, y] =
|
|
4575
|
+
const [x, y] = applyToPoint36(
|
|
4557
4576
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4558
4577
|
[p.x, p.y]
|
|
4559
4578
|
);
|
|
@@ -4573,7 +4592,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4573
4592
|
});
|
|
4574
4593
|
}
|
|
4575
4594
|
for (const text of symbolTexts) {
|
|
4576
|
-
const screenTextPos =
|
|
4595
|
+
const screenTextPos = applyToPoint36(
|
|
4577
4596
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4578
4597
|
text
|
|
4579
4598
|
);
|
|
@@ -4615,7 +4634,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4615
4634
|
});
|
|
4616
4635
|
}
|
|
4617
4636
|
for (const box of symbolBoxes) {
|
|
4618
|
-
const screenBoxPos =
|
|
4637
|
+
const screenBoxPos = applyToPoint36(
|
|
4619
4638
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4620
4639
|
box
|
|
4621
4640
|
);
|
|
@@ -4638,7 +4657,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
4638
4657
|
});
|
|
4639
4658
|
}
|
|
4640
4659
|
for (const circle of symbolCircles) {
|
|
4641
|
-
const screenCirclePos =
|
|
4660
|
+
const screenCirclePos = applyToPoint36(
|
|
4642
4661
|
compose8(realToScreenTransform, symbolToRealTransform),
|
|
4643
4662
|
circle
|
|
4644
4663
|
);
|
|
@@ -4682,14 +4701,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
4682
4701
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
4683
4702
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
4684
4703
|
const textWidthFSR = estimateTextWidth(schNetLabel.text || "");
|
|
4685
|
-
const screenCenter =
|
|
4704
|
+
const screenCenter = applyToPoint37(realToScreenTransform, schNetLabel.center);
|
|
4686
4705
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
4687
4706
|
schNetLabel.anchor_side
|
|
4688
4707
|
);
|
|
4689
4708
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
4690
4709
|
screenTextGrowthVec.y *= -1;
|
|
4691
4710
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * schNetLabel.text.length + END_PADDING_FSR;
|
|
4692
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
4711
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint37(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
4693
4712
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
4694
4713
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
4695
4714
|
};
|
|
@@ -4730,7 +4749,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
4730
4749
|
y: -0.6
|
|
4731
4750
|
}
|
|
4732
4751
|
].map(
|
|
4733
|
-
(fontRelativePoint) =>
|
|
4752
|
+
(fontRelativePoint) => applyToPoint37(
|
|
4734
4753
|
compose9(
|
|
4735
4754
|
realToScreenTransform,
|
|
4736
4755
|
translate9(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -4807,17 +4826,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
4807
4826
|
};
|
|
4808
4827
|
|
|
4809
4828
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
4810
|
-
import { applyToPoint as
|
|
4829
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
4811
4830
|
var createSvgObjectsFromSchematicBox = ({
|
|
4812
4831
|
schematicBox,
|
|
4813
4832
|
transform,
|
|
4814
4833
|
colorMap: colorMap2
|
|
4815
4834
|
}) => {
|
|
4816
|
-
const topLeft =
|
|
4835
|
+
const topLeft = applyToPoint38(transform, {
|
|
4817
4836
|
x: schematicBox.x,
|
|
4818
4837
|
y: schematicBox.y
|
|
4819
4838
|
});
|
|
4820
|
-
const bottomRight =
|
|
4839
|
+
const bottomRight = applyToPoint38(transform, {
|
|
4821
4840
|
x: schematicBox.x + schematicBox.width,
|
|
4822
4841
|
y: schematicBox.y + schematicBox.height
|
|
4823
4842
|
});
|
|
@@ -5051,18 +5070,18 @@ var circuitJsonToSchematicSvg = convertCircuitJsonToSchematicSvg;
|
|
|
5051
5070
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
5052
5071
|
import { stringify as stringify4 } from "svgson";
|
|
5053
5072
|
import {
|
|
5054
|
-
applyToPoint as
|
|
5073
|
+
applyToPoint as applyToPoint41,
|
|
5055
5074
|
compose as compose11,
|
|
5056
5075
|
scale as scale8,
|
|
5057
5076
|
translate as translate11
|
|
5058
5077
|
} from "transformation-matrix";
|
|
5059
5078
|
|
|
5060
5079
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
5061
|
-
import { applyToPoint as
|
|
5080
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
5062
5081
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
5063
5082
|
const { transform, layer: layerFilter } = ctx;
|
|
5064
5083
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
5065
|
-
const [x, y] =
|
|
5084
|
+
const [x, y] = applyToPoint40(transform, [solderPaste.x, solderPaste.y]);
|
|
5066
5085
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
5067
5086
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
5068
5087
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -5257,8 +5276,8 @@ function createSvgObjects3({ elm, ctx }) {
|
|
|
5257
5276
|
}
|
|
5258
5277
|
}
|
|
5259
5278
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
5260
|
-
const [x1, y1] =
|
|
5261
|
-
const [x2, y2] =
|
|
5279
|
+
const [x1, y1] = applyToPoint41(transform, [minX, minY]);
|
|
5280
|
+
const [x2, y2] = applyToPoint41(transform, [maxX, maxY]);
|
|
5262
5281
|
const width = Math.abs(x2 - x1);
|
|
5263
5282
|
const height = Math.abs(y2 - y1);
|
|
5264
5283
|
const x = Math.min(x1, x2);
|