circuit-to-svg 0.0.303 → 0.0.305
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 +208 -156
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { distance as distance2 } from "circuit-json";
|
|
3
3
|
import { stringify } from "svgson";
|
|
4
4
|
import {
|
|
5
|
-
applyToPoint as
|
|
5
|
+
applyToPoint as applyToPoint37,
|
|
6
6
|
compose as compose7,
|
|
7
7
|
scale as scale3,
|
|
8
8
|
translate as translate7
|
|
@@ -2646,7 +2646,8 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2646
2646
|
is_filled,
|
|
2647
2647
|
has_stroke,
|
|
2648
2648
|
is_stroke_dashed,
|
|
2649
|
-
corner_radius
|
|
2649
|
+
corner_radius,
|
|
2650
|
+
ccw_rotation = 0
|
|
2650
2651
|
} = pcbSilkscreenRect;
|
|
2651
2652
|
if (layerFilter && layer !== layerFilter) return [];
|
|
2652
2653
|
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
@@ -2665,8 +2666,8 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2665
2666
|
const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
|
|
2666
2667
|
const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
|
|
2667
2668
|
const attributes = {
|
|
2668
|
-
x: (
|
|
2669
|
-
y: (
|
|
2669
|
+
x: (-transformedWidth / 2).toString(),
|
|
2670
|
+
y: (-transformedHeight / 2).toString(),
|
|
2670
2671
|
width: transformedWidth.toString(),
|
|
2671
2672
|
height: transformedHeight.toString(),
|
|
2672
2673
|
class: `pcb-silkscreen-rect pcb-silkscreen-${layer}`,
|
|
@@ -2674,6 +2675,12 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2674
2675
|
"data-type": "pcb_silkscreen_rect",
|
|
2675
2676
|
"data-pcb-layer": layer
|
|
2676
2677
|
};
|
|
2678
|
+
if (typeof ccw_rotation === "number" && ccw_rotation !== 0) {
|
|
2679
|
+
attributes.transform = `translate(${transformedX} ${transformedY}) rotate(${-ccw_rotation})`;
|
|
2680
|
+
} else {
|
|
2681
|
+
attributes.x = (transformedX - transformedWidth / 2).toString();
|
|
2682
|
+
attributes.y = (transformedY - transformedHeight / 2).toString();
|
|
2683
|
+
}
|
|
2677
2684
|
if (transformedCornerRadiusX > 0) {
|
|
2678
2685
|
attributes.rx = transformedCornerRadiusX.toString();
|
|
2679
2686
|
}
|
|
@@ -5183,9 +5190,39 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5183
5190
|
return [];
|
|
5184
5191
|
}
|
|
5185
5192
|
|
|
5193
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout-path.ts
|
|
5194
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
5195
|
+
function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
|
|
5196
|
+
const { transform, colorMap: colorMap2 } = ctx;
|
|
5197
|
+
if (!cutoutPath.route || !Array.isArray(cutoutPath.route)) return [];
|
|
5198
|
+
const firstPoint = cutoutPath.route[0];
|
|
5199
|
+
const lastPoint = cutoutPath.route[cutoutPath.route.length - 1];
|
|
5200
|
+
const isClosed = firstPoint && lastPoint && firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
|
|
5201
|
+
const path = cutoutPath.route.slice(0, isClosed ? -1 : void 0).map((point, index) => {
|
|
5202
|
+
const [x, y] = applyToPoint31(transform, [point.x, point.y]);
|
|
5203
|
+
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5204
|
+
}).join(" ") + (isClosed ? " Z" : "");
|
|
5205
|
+
return [
|
|
5206
|
+
{
|
|
5207
|
+
name: "path",
|
|
5208
|
+
type: "element",
|
|
5209
|
+
attributes: {
|
|
5210
|
+
class: "pcb-cutout pcb-cutout-path",
|
|
5211
|
+
d: path,
|
|
5212
|
+
fill: colorMap2.drill,
|
|
5213
|
+
"data-type": "pcb_cutout_path",
|
|
5214
|
+
"data-pcb-cutout-id": cutoutPath.pcb_cutout_id,
|
|
5215
|
+
"data-pcb-layer": "drill"
|
|
5216
|
+
},
|
|
5217
|
+
value: "",
|
|
5218
|
+
children: []
|
|
5219
|
+
}
|
|
5220
|
+
];
|
|
5221
|
+
}
|
|
5222
|
+
|
|
5186
5223
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-keepout.ts
|
|
5187
5224
|
import {
|
|
5188
|
-
applyToPoint as
|
|
5225
|
+
applyToPoint as applyToPoint32,
|
|
5189
5226
|
compose as compose5,
|
|
5190
5227
|
translate as translate5,
|
|
5191
5228
|
toString as matrixToString8
|
|
@@ -5202,7 +5239,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5202
5239
|
}
|
|
5203
5240
|
if (keepout.shape === "rect") {
|
|
5204
5241
|
const rectKeepout = keepout;
|
|
5205
|
-
const [cx, cy] =
|
|
5242
|
+
const [cx, cy] = applyToPoint32(transform, [
|
|
5206
5243
|
rectKeepout.center.x,
|
|
5207
5244
|
rectKeepout.center.y
|
|
5208
5245
|
]);
|
|
@@ -5236,7 +5273,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5236
5273
|
});
|
|
5237
5274
|
} else if (keepout.shape === "circle") {
|
|
5238
5275
|
const circleKeepout = keepout;
|
|
5239
|
-
const [cx, cy] =
|
|
5276
|
+
const [cx, cy] = applyToPoint32(transform, [
|
|
5240
5277
|
circleKeepout.center.x,
|
|
5241
5278
|
circleKeepout.center.y
|
|
5242
5279
|
]);
|
|
@@ -5272,7 +5309,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5272
5309
|
|
|
5273
5310
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
5274
5311
|
import {
|
|
5275
|
-
applyToPoint as
|
|
5312
|
+
applyToPoint as applyToPoint34,
|
|
5276
5313
|
compose as compose6,
|
|
5277
5314
|
rotate as rotate5,
|
|
5278
5315
|
toString as matrixToString9,
|
|
@@ -5280,11 +5317,11 @@ import {
|
|
|
5280
5317
|
} from "transformation-matrix";
|
|
5281
5318
|
|
|
5282
5319
|
// lib/utils/ring-to-path-d.ts
|
|
5283
|
-
import { applyToPoint as
|
|
5320
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
5284
5321
|
function ringToPathD(vertices, transform) {
|
|
5285
5322
|
if (vertices.length === 0) return "";
|
|
5286
5323
|
const transformedVertices = vertices.map((v) => {
|
|
5287
|
-
const [x, y] =
|
|
5324
|
+
const [x, y] = applyToPoint33(transform, [v.x, v.y]);
|
|
5288
5325
|
return { ...v, x, y };
|
|
5289
5326
|
});
|
|
5290
5327
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -5373,7 +5410,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5373
5410
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
5374
5411
|
const maskOverlayOpacity = "0.9";
|
|
5375
5412
|
if (pour.shape === "rect") {
|
|
5376
|
-
const [cx, cy] =
|
|
5413
|
+
const [cx, cy] = applyToPoint34(transform, [pour.center.x, pour.center.y]);
|
|
5377
5414
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
5378
5415
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
5379
5416
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -5425,7 +5462,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5425
5462
|
if (pour.shape === "polygon") {
|
|
5426
5463
|
if (!pour.points || pour.points.length === 0) return [];
|
|
5427
5464
|
const transformedPoints = pour.points.map(
|
|
5428
|
-
(p) =>
|
|
5465
|
+
(p) => applyToPoint34(transform, [p.x, p.y])
|
|
5429
5466
|
);
|
|
5430
5467
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5431
5468
|
const copperPolygon = {
|
|
@@ -5648,11 +5685,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
5648
5685
|
}
|
|
5649
5686
|
|
|
5650
5687
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
5651
|
-
import { applyToPoint as
|
|
5688
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
5652
5689
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
5653
5690
|
const { transform, circuitJson } = ctx;
|
|
5654
5691
|
const { center, width, height, rotation = 0 } = component;
|
|
5655
|
-
const [x, y] =
|
|
5692
|
+
const [x, y] = applyToPoint35(transform, [center.x, center.y]);
|
|
5656
5693
|
const scaledWidth = width * Math.abs(transform.a);
|
|
5657
5694
|
const scaledHeight = height * Math.abs(transform.d);
|
|
5658
5695
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -5724,7 +5761,7 @@ function getParentAnchorPosition(component, circuitJson) {
|
|
|
5724
5761
|
}
|
|
5725
5762
|
|
|
5726
5763
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
5727
|
-
import { applyToPoint as
|
|
5764
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
5728
5765
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
5729
5766
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
5730
5767
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -5768,7 +5805,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5768
5805
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
5769
5806
|
)) {
|
|
5770
5807
|
const path = outline.map((point, index) => {
|
|
5771
|
-
const [x, y] =
|
|
5808
|
+
const [x, y] = applyToPoint36(transform, [point.x, point.y]);
|
|
5772
5809
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5773
5810
|
}).join(" ");
|
|
5774
5811
|
svgObjects.push({
|
|
@@ -5789,11 +5826,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5789
5826
|
}
|
|
5790
5827
|
const halfWidth = width / 2;
|
|
5791
5828
|
const halfHeight = height / 2;
|
|
5792
|
-
const [topLeftX, topLeftY] =
|
|
5829
|
+
const [topLeftX, topLeftY] = applyToPoint36(transform, [
|
|
5793
5830
|
center.x - halfWidth,
|
|
5794
5831
|
center.y + halfHeight
|
|
5795
5832
|
]);
|
|
5796
|
-
const [bottomRightX, bottomRightY] =
|
|
5833
|
+
const [bottomRightX, bottomRightY] = applyToPoint36(transform, [
|
|
5797
5834
|
center.x + halfWidth,
|
|
5798
5835
|
center.y - halfHeight
|
|
5799
5836
|
]);
|
|
@@ -5847,7 +5884,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5847
5884
|
var package_default = {
|
|
5848
5885
|
name: "circuit-to-svg",
|
|
5849
5886
|
type: "module",
|
|
5850
|
-
version: "0.0.
|
|
5887
|
+
version: "0.0.304",
|
|
5851
5888
|
description: "Convert Circuit JSON to SVG",
|
|
5852
5889
|
main: "dist/index.js",
|
|
5853
5890
|
files: [
|
|
@@ -5904,6 +5941,7 @@ var TYPE_PRIORITY = {
|
|
|
5904
5941
|
pcb_panel: 5,
|
|
5905
5942
|
pcb_board: 10,
|
|
5906
5943
|
pcb_cutout: 15,
|
|
5944
|
+
pcb_cutout_path: 15,
|
|
5907
5945
|
pcb_keepout: 16,
|
|
5908
5946
|
pcb_hole: 18,
|
|
5909
5947
|
pcb_plated_hole_drill: 19,
|
|
@@ -6140,6 +6178,11 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6140
6178
|
}
|
|
6141
6179
|
} else if (cutout.shape === "polygon") {
|
|
6142
6180
|
updateTraceBounds(cutout.points);
|
|
6181
|
+
} else if (cutout.shape === "path") {
|
|
6182
|
+
const cutoutPath = cutout;
|
|
6183
|
+
if (cutoutPath.route && Array.isArray(cutoutPath.route)) {
|
|
6184
|
+
updateTraceBounds(cutoutPath.route);
|
|
6185
|
+
}
|
|
6143
6186
|
}
|
|
6144
6187
|
} else if (circuitJsonElm.type === "pcb_keepout") {
|
|
6145
6188
|
const keepout = circuitJsonElm;
|
|
@@ -6432,6 +6475,11 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6432
6475
|
}
|
|
6433
6476
|
} else if (cutout.shape === "polygon") {
|
|
6434
6477
|
updateTraceBounds(cutout.points);
|
|
6478
|
+
} else if (cutout.shape === "path") {
|
|
6479
|
+
const cutoutPath = cutout;
|
|
6480
|
+
if (cutoutPath.route && Array.isArray(cutoutPath.route)) {
|
|
6481
|
+
updateTraceBounds(cutoutPath.route);
|
|
6482
|
+
}
|
|
6435
6483
|
}
|
|
6436
6484
|
}
|
|
6437
6485
|
}
|
|
@@ -6508,6 +6556,10 @@ function createSvgObjects({
|
|
|
6508
6556
|
case "pcb_via":
|
|
6509
6557
|
return createSvgObjectsFromPcbVia(elm, ctx);
|
|
6510
6558
|
case "pcb_cutout":
|
|
6559
|
+
const cutout = elm;
|
|
6560
|
+
if (cutout.shape === "path") {
|
|
6561
|
+
return createSvgObjectsFromPcbCutoutPath(cutout, ctx);
|
|
6562
|
+
}
|
|
6511
6563
|
return createSvgObjectsFromPcbCutout(elm, ctx);
|
|
6512
6564
|
case "pcb_keepout":
|
|
6513
6565
|
return createSvgObjectsFromPcbKeepout(
|
|
@@ -6521,8 +6573,8 @@ function createSvgObjects({
|
|
|
6521
6573
|
}
|
|
6522
6574
|
}
|
|
6523
6575
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
6524
|
-
const [x1, y1] =
|
|
6525
|
-
const [x2, y2] =
|
|
6576
|
+
const [x1, y1] = applyToPoint37(transform, [minX, minY]);
|
|
6577
|
+
const [x2, y2] = applyToPoint37(transform, [maxX, maxY]);
|
|
6526
6578
|
const width = Math.abs(x2 - x1);
|
|
6527
6579
|
const height = Math.abs(y2 - y1);
|
|
6528
6580
|
const x = Math.min(x1, x2);
|
|
@@ -6552,14 +6604,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
6552
6604
|
import { stringify as stringify2 } from "svgson";
|
|
6553
6605
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
6554
6606
|
import {
|
|
6555
|
-
applyToPoint as
|
|
6607
|
+
applyToPoint as applyToPoint44,
|
|
6556
6608
|
compose as compose8,
|
|
6557
6609
|
scale as scale4,
|
|
6558
6610
|
translate as translate8
|
|
6559
6611
|
} from "transformation-matrix";
|
|
6560
6612
|
|
|
6561
6613
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
6562
|
-
import { applyToPoint as
|
|
6614
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
6563
6615
|
var DEFAULT_BOARD_STYLE = {
|
|
6564
6616
|
fill: "none",
|
|
6565
6617
|
stroke: "rgb(0,0,0)",
|
|
@@ -6571,25 +6623,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6571
6623
|
let path;
|
|
6572
6624
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
6573
6625
|
path = outline.map((point, index) => {
|
|
6574
|
-
const [x, y] =
|
|
6626
|
+
const [x, y] = applyToPoint38(transform, [point.x, point.y]);
|
|
6575
6627
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
6576
6628
|
}).join(" ");
|
|
6577
6629
|
} else {
|
|
6578
6630
|
const halfWidth = width / 2;
|
|
6579
6631
|
const halfHeight = height / 2;
|
|
6580
|
-
const topLeft =
|
|
6632
|
+
const topLeft = applyToPoint38(transform, [
|
|
6581
6633
|
center.x - halfWidth,
|
|
6582
6634
|
center.y - halfHeight
|
|
6583
6635
|
]);
|
|
6584
|
-
const topRight =
|
|
6636
|
+
const topRight = applyToPoint38(transform, [
|
|
6585
6637
|
center.x + halfWidth,
|
|
6586
6638
|
center.y - halfHeight
|
|
6587
6639
|
]);
|
|
6588
|
-
const bottomRight =
|
|
6640
|
+
const bottomRight = applyToPoint38(transform, [
|
|
6589
6641
|
center.x + halfWidth,
|
|
6590
6642
|
center.y + halfHeight
|
|
6591
6643
|
]);
|
|
6592
|
-
const bottomLeft =
|
|
6644
|
+
const bottomLeft = applyToPoint38(transform, [
|
|
6593
6645
|
center.x - halfWidth,
|
|
6594
6646
|
center.y + halfHeight
|
|
6595
6647
|
]);
|
|
@@ -6615,7 +6667,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6615
6667
|
}
|
|
6616
6668
|
|
|
6617
6669
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
6618
|
-
import { applyToPoint as
|
|
6670
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
6619
6671
|
|
|
6620
6672
|
// lib/utils/get-sch-font-size.ts
|
|
6621
6673
|
import "transformation-matrix";
|
|
@@ -6641,8 +6693,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
6641
6693
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
6642
6694
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
6643
6695
|
return null;
|
|
6644
|
-
const [x, y] =
|
|
6645
|
-
const [pinX, pinY] =
|
|
6696
|
+
const [x, y] = applyToPoint40(transform, [center.x, center.y]);
|
|
6697
|
+
const [pinX, pinY] = applyToPoint40(transform, [portPosition.x, portPosition.y]);
|
|
6646
6698
|
const scaledWidth = width * Math.abs(transform.a);
|
|
6647
6699
|
const scaledHeight = height * Math.abs(transform.d);
|
|
6648
6700
|
const isTopLayer = layer === "top";
|
|
@@ -6804,11 +6856,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
6804
6856
|
}
|
|
6805
6857
|
|
|
6806
6858
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
6807
|
-
import { applyToPoint as
|
|
6859
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
6808
6860
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
6809
6861
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
6810
6862
|
const { transform } = ctx;
|
|
6811
|
-
const [x, y] =
|
|
6863
|
+
const [x, y] = applyToPoint41(transform, [hole.x, hole.y]);
|
|
6812
6864
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
6813
6865
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
6814
6866
|
const radius = scaledDiameter / 2;
|
|
@@ -6872,12 +6924,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
6872
6924
|
}
|
|
6873
6925
|
|
|
6874
6926
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
6875
|
-
import { applyToPoint as
|
|
6927
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
6876
6928
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
6877
6929
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
6878
6930
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
6879
6931
|
const { transform } = ctx;
|
|
6880
|
-
const [x, y] =
|
|
6932
|
+
const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
|
|
6881
6933
|
if (hole.shape === "pill") {
|
|
6882
6934
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
6883
6935
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -6972,7 +7024,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6972
7024
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
6973
7025
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
6974
7026
|
const holeRadius = scaledHoleDiameter / 2;
|
|
6975
|
-
const [holeCx, holeCy] =
|
|
7027
|
+
const [holeCx, holeCy] = applyToPoint42(transform, [
|
|
6976
7028
|
circularHole.x + circularHole.hole_offset_x,
|
|
6977
7029
|
circularHole.y + circularHole.hole_offset_y
|
|
6978
7030
|
]);
|
|
@@ -7030,7 +7082,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7030
7082
|
const pillHoleWithOffsets = pillHole;
|
|
7031
7083
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
7032
7084
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
7033
|
-
const [holeCenterX, holeCenterY] =
|
|
7085
|
+
const [holeCenterX, holeCenterY] = applyToPoint42(transform, [
|
|
7034
7086
|
pillHole.x + holeOffsetX,
|
|
7035
7087
|
pillHole.y + holeOffsetY
|
|
7036
7088
|
]);
|
|
@@ -7092,7 +7144,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7092
7144
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
7093
7145
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
7094
7146
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
7095
|
-
const [holeCenterX, holeCenterY] =
|
|
7147
|
+
const [holeCenterX, holeCenterY] = applyToPoint42(transform, [
|
|
7096
7148
|
rotatedHole.x + holeOffsetX,
|
|
7097
7149
|
rotatedHole.y + holeOffsetY
|
|
7098
7150
|
]);
|
|
@@ -7148,14 +7200,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7148
7200
|
}
|
|
7149
7201
|
|
|
7150
7202
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
7151
|
-
import { applyToPoint as
|
|
7203
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
7152
7204
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
7153
7205
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
7154
7206
|
const { transform } = ctx;
|
|
7155
7207
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7156
7208
|
const width = pad.width * Math.abs(transform.a);
|
|
7157
7209
|
const height = pad.height * Math.abs(transform.d);
|
|
7158
|
-
const [x, y] =
|
|
7210
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7159
7211
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
7160
7212
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7161
7213
|
return [
|
|
@@ -7207,7 +7259,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7207
7259
|
const width = pad.width * Math.abs(transform.a);
|
|
7208
7260
|
const height = pad.height * Math.abs(transform.d);
|
|
7209
7261
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7210
|
-
const [x, y] =
|
|
7262
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7211
7263
|
return [
|
|
7212
7264
|
{
|
|
7213
7265
|
name: "rect",
|
|
@@ -7230,7 +7282,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7230
7282
|
}
|
|
7231
7283
|
if (pad.shape === "circle") {
|
|
7232
7284
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7233
|
-
const [x, y] =
|
|
7285
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7234
7286
|
return [
|
|
7235
7287
|
{
|
|
7236
7288
|
name: "circle",
|
|
@@ -7250,7 +7302,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7250
7302
|
}
|
|
7251
7303
|
if (pad.shape === "polygon") {
|
|
7252
7304
|
const points = (pad.points ?? []).map(
|
|
7253
|
-
(point) =>
|
|
7305
|
+
(point) => applyToPoint43(transform, [point.x, point.y])
|
|
7254
7306
|
);
|
|
7255
7307
|
return [
|
|
7256
7308
|
{
|
|
@@ -7434,8 +7486,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
7434
7486
|
}
|
|
7435
7487
|
}
|
|
7436
7488
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
7437
|
-
const [x1, y1] =
|
|
7438
|
-
const [x2, y2] =
|
|
7489
|
+
const [x1, y1] = applyToPoint44(transform, [minX, minY]);
|
|
7490
|
+
const [x2, y2] = applyToPoint44(transform, [maxX, maxY]);
|
|
7439
7491
|
const width = Math.abs(x2 - x1);
|
|
7440
7492
|
const height = Math.abs(y2 - y1);
|
|
7441
7493
|
const x = Math.min(x1, x2);
|
|
@@ -7464,7 +7516,7 @@ import {
|
|
|
7464
7516
|
} from "transformation-matrix";
|
|
7465
7517
|
|
|
7466
7518
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
7467
|
-
import { applyToPoint as
|
|
7519
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
7468
7520
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
7469
7521
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
7470
7522
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -7478,25 +7530,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7478
7530
|
let path;
|
|
7479
7531
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
7480
7532
|
path = outline.map((point, index) => {
|
|
7481
|
-
const [x, y] =
|
|
7533
|
+
const [x, y] = applyToPoint45(transform, [point.x, point.y]);
|
|
7482
7534
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
7483
7535
|
}).join(" ");
|
|
7484
7536
|
} else {
|
|
7485
7537
|
const halfWidth = width / 2;
|
|
7486
7538
|
const halfHeight = height / 2;
|
|
7487
|
-
const topLeft =
|
|
7539
|
+
const topLeft = applyToPoint45(transform, [
|
|
7488
7540
|
center.x - halfWidth,
|
|
7489
7541
|
center.y - halfHeight
|
|
7490
7542
|
]);
|
|
7491
|
-
const topRight =
|
|
7543
|
+
const topRight = applyToPoint45(transform, [
|
|
7492
7544
|
center.x + halfWidth,
|
|
7493
7545
|
center.y - halfHeight
|
|
7494
7546
|
]);
|
|
7495
|
-
const bottomRight =
|
|
7547
|
+
const bottomRight = applyToPoint45(transform, [
|
|
7496
7548
|
center.x + halfWidth,
|
|
7497
7549
|
center.y + halfHeight
|
|
7498
7550
|
]);
|
|
7499
|
-
const bottomLeft =
|
|
7551
|
+
const bottomLeft = applyToPoint45(transform, [
|
|
7500
7552
|
center.x - halfWidth,
|
|
7501
7553
|
center.y + halfHeight
|
|
7502
7554
|
]);
|
|
@@ -7514,10 +7566,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7514
7566
|
const halfWidth = width2 / 2;
|
|
7515
7567
|
const halfHeight = height2 / 2;
|
|
7516
7568
|
const [tl, tr, br, bl] = [
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7569
|
+
applyToPoint45(transform, [x - halfWidth, y - halfHeight]),
|
|
7570
|
+
applyToPoint45(transform, [x + halfWidth, y - halfHeight]),
|
|
7571
|
+
applyToPoint45(transform, [x + halfWidth, y + halfHeight]),
|
|
7572
|
+
applyToPoint45(transform, [x - halfWidth, y + halfHeight])
|
|
7521
7573
|
];
|
|
7522
7574
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
7523
7575
|
} else if (cutout.shape === "circle") {
|
|
@@ -7567,7 +7619,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7567
7619
|
|
|
7568
7620
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
7569
7621
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
7570
|
-
import { applyToPoint as
|
|
7622
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
7571
7623
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
7572
7624
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
7573
7625
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -7577,7 +7629,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7577
7629
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
7578
7630
|
return [];
|
|
7579
7631
|
}
|
|
7580
|
-
const [x, y] =
|
|
7632
|
+
const [x, y] = applyToPoint46(transform, [center.x, center.y]);
|
|
7581
7633
|
const scaledWidth = width * Math.abs(transform.a);
|
|
7582
7634
|
const scaledHeight = height * Math.abs(transform.d);
|
|
7583
7635
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -7638,11 +7690,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7638
7690
|
}
|
|
7639
7691
|
|
|
7640
7692
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
7641
|
-
import { applyToPoint as
|
|
7693
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7642
7694
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
7643
7695
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
7644
7696
|
const { transform } = ctx;
|
|
7645
|
-
const [x, y] =
|
|
7697
|
+
const [x, y] = applyToPoint47(transform, [hole.x, hole.y]);
|
|
7646
7698
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
7647
7699
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
7648
7700
|
const radius = scaledDiameter / 2;
|
|
@@ -7706,12 +7758,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
7706
7758
|
}
|
|
7707
7759
|
|
|
7708
7760
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
7709
|
-
import { applyToPoint as
|
|
7761
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7710
7762
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
7711
7763
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
7712
7764
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
7713
7765
|
const { transform } = ctx;
|
|
7714
|
-
const [x, y] =
|
|
7766
|
+
const [x, y] = applyToPoint48(transform, [hole.x, hole.y]);
|
|
7715
7767
|
if (hole.shape === "pill") {
|
|
7716
7768
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
7717
7769
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -7946,14 +7998,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
7946
7998
|
}
|
|
7947
7999
|
|
|
7948
8000
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
7949
|
-
import { applyToPoint as
|
|
8001
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7950
8002
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
7951
8003
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
7952
8004
|
const { transform } = ctx;
|
|
7953
8005
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7954
8006
|
const width = pad.width * Math.abs(transform.a);
|
|
7955
8007
|
const height = pad.height * Math.abs(transform.d);
|
|
7956
|
-
const [x, y] =
|
|
8008
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
7957
8009
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7958
8010
|
return [
|
|
7959
8011
|
{
|
|
@@ -7996,7 +8048,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7996
8048
|
const width = pad.width * Math.abs(transform.a);
|
|
7997
8049
|
const height = pad.height * Math.abs(transform.d);
|
|
7998
8050
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7999
|
-
const [x, y] =
|
|
8051
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
8000
8052
|
return [
|
|
8001
8053
|
{
|
|
8002
8054
|
name: "rect",
|
|
@@ -8019,7 +8071,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8019
8071
|
}
|
|
8020
8072
|
if (pad.shape === "circle") {
|
|
8021
8073
|
const radius = pad.radius * Math.abs(transform.a);
|
|
8022
|
-
const [x, y] =
|
|
8074
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
8023
8075
|
return [
|
|
8024
8076
|
{
|
|
8025
8077
|
name: "circle",
|
|
@@ -8039,7 +8091,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8039
8091
|
}
|
|
8040
8092
|
if (pad.shape === "polygon") {
|
|
8041
8093
|
const points = (pad.points ?? []).map(
|
|
8042
|
-
(point) =>
|
|
8094
|
+
(point) => applyToPoint49(transform, [point.x, point.y])
|
|
8043
8095
|
);
|
|
8044
8096
|
return [
|
|
8045
8097
|
{
|
|
@@ -8060,7 +8112,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8060
8112
|
}
|
|
8061
8113
|
|
|
8062
8114
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
8063
|
-
import { applyToPoint as
|
|
8115
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
8064
8116
|
import { calculateElbow } from "calculate-elbow";
|
|
8065
8117
|
|
|
8066
8118
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -8137,7 +8189,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8137
8189
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
8138
8190
|
if (!label_info) return [];
|
|
8139
8191
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
8140
|
-
const [port_x, port_y] =
|
|
8192
|
+
const [port_x, port_y] = applyToPoint50(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
8141
8193
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
8142
8194
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
8143
8195
|
const elbow_path = calculateElbow(
|
|
@@ -8278,7 +8330,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8278
8330
|
}
|
|
8279
8331
|
|
|
8280
8332
|
// lib/pinout/calculate-label-positions.ts
|
|
8281
|
-
import { applyToPoint as
|
|
8333
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
8282
8334
|
|
|
8283
8335
|
// lib/pinout/constants.ts
|
|
8284
8336
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -8316,7 +8368,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8316
8368
|
);
|
|
8317
8369
|
const mapToEdgePort = (pinout_label) => ({
|
|
8318
8370
|
pcb_port: pinout_label.pcb_port,
|
|
8319
|
-
y:
|
|
8371
|
+
y: applyToPoint51(transform, [
|
|
8320
8372
|
pinout_label.pcb_port.x,
|
|
8321
8373
|
pinout_label.pcb_port.y
|
|
8322
8374
|
])[1],
|
|
@@ -8331,7 +8383,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8331
8383
|
} else {
|
|
8332
8384
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
8333
8385
|
pcb_port: pinout_label.pcb_port,
|
|
8334
|
-
y:
|
|
8386
|
+
y: applyToPoint51(transform, [
|
|
8335
8387
|
pinout_label.pcb_port.x,
|
|
8336
8388
|
pinout_label.pcb_port.y
|
|
8337
8389
|
])[1],
|
|
@@ -8339,7 +8391,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8339
8391
|
})).sort((a, b) => a.y - b.y);
|
|
8340
8392
|
}
|
|
8341
8393
|
if (edge_ports.length === 0) return;
|
|
8342
|
-
const board_edge_x =
|
|
8394
|
+
const board_edge_x = applyToPoint51(transform, [
|
|
8343
8395
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
8344
8396
|
0
|
|
8345
8397
|
])[0];
|
|
@@ -8761,14 +8813,14 @@ import {
|
|
|
8761
8813
|
} from "transformation-matrix";
|
|
8762
8814
|
|
|
8763
8815
|
// lib/sch/draw-schematic-grid.ts
|
|
8764
|
-
import { applyToPoint as
|
|
8816
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
8765
8817
|
function drawSchematicGrid(params) {
|
|
8766
8818
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
8767
8819
|
const cellSize = params.cellSize ?? 1;
|
|
8768
8820
|
const labelCells = params.labelCells ?? false;
|
|
8769
8821
|
const gridLines = [];
|
|
8770
8822
|
const transformPoint = (x, y) => {
|
|
8771
|
-
const [transformedX, transformedY] =
|
|
8823
|
+
const [transformedX, transformedY] = applyToPoint52(params.transform, [x, y]);
|
|
8772
8824
|
return { x: transformedX, y: transformedY };
|
|
8773
8825
|
};
|
|
8774
8826
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -8849,15 +8901,15 @@ function drawSchematicGrid(params) {
|
|
|
8849
8901
|
}
|
|
8850
8902
|
|
|
8851
8903
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
8852
|
-
import { applyToPoint as
|
|
8904
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
8853
8905
|
function drawSchematicLabeledPoints(params) {
|
|
8854
8906
|
const { points, transform } = params;
|
|
8855
8907
|
const labeledPointsGroup = [];
|
|
8856
8908
|
for (const point of points) {
|
|
8857
|
-
const [x1, y1] =
|
|
8858
|
-
const [x2, y2] =
|
|
8859
|
-
const [x3, y3] =
|
|
8860
|
-
const [x4, y4] =
|
|
8909
|
+
const [x1, y1] = applyToPoint53(transform, [point.x - 0.1, point.y - 0.1]);
|
|
8910
|
+
const [x2, y2] = applyToPoint53(transform, [point.x + 0.1, point.y + 0.1]);
|
|
8911
|
+
const [x3, y3] = applyToPoint53(transform, [point.x - 0.1, point.y + 0.1]);
|
|
8912
|
+
const [x4, y4] = applyToPoint53(transform, [point.x + 0.1, point.y - 0.1]);
|
|
8861
8913
|
labeledPointsGroup.push({
|
|
8862
8914
|
name: "path",
|
|
8863
8915
|
type: "element",
|
|
@@ -8868,7 +8920,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
8868
8920
|
"stroke-opacity": "0.7"
|
|
8869
8921
|
}
|
|
8870
8922
|
});
|
|
8871
|
-
const [labelX, labelY] =
|
|
8923
|
+
const [labelX, labelY] = applyToPoint53(transform, [
|
|
8872
8924
|
point.x + 0.15,
|
|
8873
8925
|
point.y - 0.15
|
|
8874
8926
|
]);
|
|
@@ -9986,7 +10038,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
9986
10038
|
import { symbols } from "schematic-symbols";
|
|
9987
10039
|
import "svgson";
|
|
9988
10040
|
import {
|
|
9989
|
-
applyToPoint as
|
|
10041
|
+
applyToPoint as applyToPoint55,
|
|
9990
10042
|
compose as compose11
|
|
9991
10043
|
} from "transformation-matrix";
|
|
9992
10044
|
|
|
@@ -10070,13 +10122,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
10070
10122
|
}
|
|
10071
10123
|
|
|
10072
10124
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
10073
|
-
import { applyToPoint as
|
|
10125
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
10074
10126
|
var createSvgSchErrorText = ({
|
|
10075
10127
|
text,
|
|
10076
10128
|
realCenter,
|
|
10077
10129
|
realToScreenTransform
|
|
10078
10130
|
}) => {
|
|
10079
|
-
const screenCenter =
|
|
10131
|
+
const screenCenter = applyToPoint54(realToScreenTransform, realCenter);
|
|
10080
10132
|
return {
|
|
10081
10133
|
type: "element",
|
|
10082
10134
|
name: "text",
|
|
@@ -10185,11 +10237,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10185
10237
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
10186
10238
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
10187
10239
|
};
|
|
10188
|
-
const [screenMinX, screenMinY] =
|
|
10240
|
+
const [screenMinX, screenMinY] = applyToPoint55(
|
|
10189
10241
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10190
10242
|
[bounds.minX, bounds.minY]
|
|
10191
10243
|
);
|
|
10192
|
-
const [screenMaxX, screenMaxY] =
|
|
10244
|
+
const [screenMaxX, screenMaxY] = applyToPoint55(
|
|
10193
10245
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10194
10246
|
[bounds.maxX, bounds.maxY]
|
|
10195
10247
|
);
|
|
@@ -10218,7 +10270,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10218
10270
|
name: "path",
|
|
10219
10271
|
attributes: {
|
|
10220
10272
|
d: points.map((p, i) => {
|
|
10221
|
-
const [x, y] =
|
|
10273
|
+
const [x, y] = applyToPoint55(
|
|
10222
10274
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10223
10275
|
[p.x, p.y]
|
|
10224
10276
|
);
|
|
@@ -10234,7 +10286,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10234
10286
|
});
|
|
10235
10287
|
}
|
|
10236
10288
|
for (const text of texts) {
|
|
10237
|
-
const screenTextPos =
|
|
10289
|
+
const screenTextPos = applyToPoint55(
|
|
10238
10290
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10239
10291
|
text
|
|
10240
10292
|
);
|
|
@@ -10286,7 +10338,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10286
10338
|
});
|
|
10287
10339
|
}
|
|
10288
10340
|
for (const box of boxes) {
|
|
10289
|
-
const screenBoxPos =
|
|
10341
|
+
const screenBoxPos = applyToPoint55(
|
|
10290
10342
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10291
10343
|
box
|
|
10292
10344
|
);
|
|
@@ -10310,7 +10362,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10310
10362
|
}
|
|
10311
10363
|
for (const port of symbol.ports) {
|
|
10312
10364
|
if (connectedSymbolPorts.has(port)) continue;
|
|
10313
|
-
const screenPortPos =
|
|
10365
|
+
const screenPortPos = applyToPoint55(
|
|
10314
10366
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10315
10367
|
port
|
|
10316
10368
|
);
|
|
@@ -10330,7 +10382,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10330
10382
|
});
|
|
10331
10383
|
}
|
|
10332
10384
|
for (const circle of circles) {
|
|
10333
|
-
const screenCirclePos =
|
|
10385
|
+
const screenCirclePos = applyToPoint55(
|
|
10334
10386
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10335
10387
|
circle
|
|
10336
10388
|
);
|
|
@@ -10357,14 +10409,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10357
10409
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
10358
10410
|
import "schematic-symbols";
|
|
10359
10411
|
import "svgson";
|
|
10360
|
-
import { applyToPoint as
|
|
10412
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
10361
10413
|
|
|
10362
10414
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
10363
10415
|
import "transformation-matrix";
|
|
10364
10416
|
import "@tscircuit/circuit-json-util";
|
|
10365
10417
|
|
|
10366
10418
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
10367
|
-
import { applyToPoint as
|
|
10419
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
10368
10420
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
10369
10421
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
10370
10422
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -10417,8 +10469,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10417
10469
|
realEdgePos.y += realPinLineLength;
|
|
10418
10470
|
break;
|
|
10419
10471
|
}
|
|
10420
|
-
const screenSchPortPos =
|
|
10421
|
-
const screenRealEdgePos =
|
|
10472
|
+
const screenSchPortPos = applyToPoint56(transform, schPort.center);
|
|
10473
|
+
const screenRealEdgePos = applyToPoint56(transform, realEdgePos);
|
|
10422
10474
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
10423
10475
|
const realLineEnd = { ...schPort.center };
|
|
10424
10476
|
if (!isConnected) {
|
|
@@ -10437,7 +10489,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10437
10489
|
break;
|
|
10438
10490
|
}
|
|
10439
10491
|
}
|
|
10440
|
-
const screenLineEnd =
|
|
10492
|
+
const screenLineEnd = applyToPoint56(transform, realLineEnd);
|
|
10441
10493
|
svgObjects.push({
|
|
10442
10494
|
name: "line",
|
|
10443
10495
|
type: "element",
|
|
@@ -10558,7 +10610,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10558
10610
|
};
|
|
10559
10611
|
|
|
10560
10612
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
10561
|
-
import { applyToPoint as
|
|
10613
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
10562
10614
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
10563
10615
|
const svgObjects = [];
|
|
10564
10616
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -10576,7 +10628,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10576
10628
|
} else {
|
|
10577
10629
|
realPinNumberPos.y += 0.02;
|
|
10578
10630
|
}
|
|
10579
|
-
const screenPinNumberTextPos =
|
|
10631
|
+
const screenPinNumberTextPos = applyToPoint57(transform, realPinNumberPos);
|
|
10580
10632
|
svgObjects.push({
|
|
10581
10633
|
name: "text",
|
|
10582
10634
|
type: "element",
|
|
@@ -10606,7 +10658,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10606
10658
|
};
|
|
10607
10659
|
|
|
10608
10660
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
10609
|
-
import { applyToPoint as
|
|
10661
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
10610
10662
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
10611
10663
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
10612
10664
|
const svgObjects = [];
|
|
@@ -10620,7 +10672,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
10620
10672
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
10621
10673
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10622
10674
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10623
|
-
const screenPinNumberTextPos =
|
|
10675
|
+
const screenPinNumberTextPos = applyToPoint58(transform, realPinNumberPos);
|
|
10624
10676
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
10625
10677
|
if (!label) return [];
|
|
10626
10678
|
const isNegated = label.startsWith("N_");
|
|
@@ -10668,13 +10720,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
10668
10720
|
};
|
|
10669
10721
|
|
|
10670
10722
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
10671
|
-
import { applyToPoint as
|
|
10723
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
10672
10724
|
var createSvgSchText = ({
|
|
10673
10725
|
elm,
|
|
10674
10726
|
transform,
|
|
10675
10727
|
colorMap: colorMap2
|
|
10676
10728
|
}) => {
|
|
10677
|
-
const center =
|
|
10729
|
+
const center = applyToPoint60(transform, elm.position);
|
|
10678
10730
|
const textAnchorMap = {
|
|
10679
10731
|
center: "middle",
|
|
10680
10732
|
center_right: "end",
|
|
@@ -10758,11 +10810,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
10758
10810
|
colorMap: colorMap2
|
|
10759
10811
|
}) => {
|
|
10760
10812
|
const svgObjects = [];
|
|
10761
|
-
const componentScreenTopLeft =
|
|
10813
|
+
const componentScreenTopLeft = applyToPoint61(transform, {
|
|
10762
10814
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
10763
10815
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
10764
10816
|
});
|
|
10765
|
-
const componentScreenBottomRight =
|
|
10817
|
+
const componentScreenBottomRight = applyToPoint61(transform, {
|
|
10766
10818
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
10767
10819
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
10768
10820
|
});
|
|
@@ -10848,13 +10900,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
10848
10900
|
}
|
|
10849
10901
|
|
|
10850
10902
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
10851
|
-
import { applyToPoint as
|
|
10903
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
10852
10904
|
function createSvgObjectsFromSchVoltageProbe({
|
|
10853
10905
|
probe,
|
|
10854
10906
|
transform,
|
|
10855
10907
|
colorMap: colorMap2
|
|
10856
10908
|
}) {
|
|
10857
|
-
const [screenX, screenY] =
|
|
10909
|
+
const [screenX, screenY] = applyToPoint62(transform, [
|
|
10858
10910
|
probe.position.x,
|
|
10859
10911
|
probe.position.y
|
|
10860
10912
|
]);
|
|
@@ -11028,17 +11080,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
11028
11080
|
}
|
|
11029
11081
|
|
|
11030
11082
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
11031
|
-
import { applyToPoint as
|
|
11083
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
11032
11084
|
function createSvgObjectsFromSchDebugObject({
|
|
11033
11085
|
debugObject,
|
|
11034
11086
|
transform
|
|
11035
11087
|
}) {
|
|
11036
11088
|
if (debugObject.shape === "rect") {
|
|
11037
|
-
let [screenLeft, screenTop] =
|
|
11089
|
+
let [screenLeft, screenTop] = applyToPoint63(transform, [
|
|
11038
11090
|
debugObject.center.x - debugObject.size.width / 2,
|
|
11039
11091
|
debugObject.center.y - debugObject.size.height / 2
|
|
11040
11092
|
]);
|
|
11041
|
-
let [screenRight, screenBottom] =
|
|
11093
|
+
let [screenRight, screenBottom] = applyToPoint63(transform, [
|
|
11042
11094
|
debugObject.center.x + debugObject.size.width / 2,
|
|
11043
11095
|
debugObject.center.y + debugObject.size.height / 2
|
|
11044
11096
|
]);
|
|
@@ -11048,7 +11100,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11048
11100
|
];
|
|
11049
11101
|
const width = Math.abs(screenRight - screenLeft);
|
|
11050
11102
|
const height = Math.abs(screenBottom - screenTop);
|
|
11051
|
-
const [screenCenterX, screenCenterY] =
|
|
11103
|
+
const [screenCenterX, screenCenterY] = applyToPoint63(transform, [
|
|
11052
11104
|
debugObject.center.x,
|
|
11053
11105
|
debugObject.center.y
|
|
11054
11106
|
]);
|
|
@@ -11094,11 +11146,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11094
11146
|
];
|
|
11095
11147
|
}
|
|
11096
11148
|
if (debugObject.shape === "line") {
|
|
11097
|
-
const [screenStartX, screenStartY] =
|
|
11149
|
+
const [screenStartX, screenStartY] = applyToPoint63(transform, [
|
|
11098
11150
|
debugObject.start.x,
|
|
11099
11151
|
debugObject.start.y
|
|
11100
11152
|
]);
|
|
11101
|
-
const [screenEndX, screenEndY] =
|
|
11153
|
+
const [screenEndX, screenEndY] = applyToPoint63(transform, [
|
|
11102
11154
|
debugObject.end.x,
|
|
11103
11155
|
debugObject.end.y
|
|
11104
11156
|
]);
|
|
@@ -11148,7 +11200,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11148
11200
|
}
|
|
11149
11201
|
|
|
11150
11202
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
11151
|
-
import { applyToPoint as
|
|
11203
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
11152
11204
|
function createSchematicTrace({
|
|
11153
11205
|
trace,
|
|
11154
11206
|
transform,
|
|
@@ -11162,11 +11214,11 @@ function createSchematicTrace({
|
|
|
11162
11214
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
11163
11215
|
const edge = edges[edgeIndex];
|
|
11164
11216
|
if (edge.is_crossing) continue;
|
|
11165
|
-
const [screenFromX, screenFromY] =
|
|
11217
|
+
const [screenFromX, screenFromY] = applyToPoint64(transform, [
|
|
11166
11218
|
edge.from.x,
|
|
11167
11219
|
edge.from.y
|
|
11168
11220
|
]);
|
|
11169
|
-
const [screenToX, screenToY] =
|
|
11221
|
+
const [screenToX, screenToY] = applyToPoint64(transform, [
|
|
11170
11222
|
edge.to.x,
|
|
11171
11223
|
edge.to.y
|
|
11172
11224
|
]);
|
|
@@ -11210,11 +11262,11 @@ function createSchematicTrace({
|
|
|
11210
11262
|
}
|
|
11211
11263
|
for (const edge of edges) {
|
|
11212
11264
|
if (!edge.is_crossing) continue;
|
|
11213
|
-
const [screenFromX, screenFromY] =
|
|
11265
|
+
const [screenFromX, screenFromY] = applyToPoint64(transform, [
|
|
11214
11266
|
edge.from.x,
|
|
11215
11267
|
edge.from.y
|
|
11216
11268
|
]);
|
|
11217
|
-
const [screenToX, screenToY] =
|
|
11269
|
+
const [screenToX, screenToY] = applyToPoint64(transform, [
|
|
11218
11270
|
edge.to.x,
|
|
11219
11271
|
edge.to.y
|
|
11220
11272
|
]);
|
|
@@ -11258,7 +11310,7 @@ function createSchematicTrace({
|
|
|
11258
11310
|
}
|
|
11259
11311
|
if (trace.junctions) {
|
|
11260
11312
|
for (const junction of trace.junctions) {
|
|
11261
|
-
const [screenX, screenY] =
|
|
11313
|
+
const [screenX, screenY] = applyToPoint64(transform, [
|
|
11262
11314
|
junction.x,
|
|
11263
11315
|
junction.y
|
|
11264
11316
|
]);
|
|
@@ -11313,7 +11365,7 @@ function createSchematicTrace({
|
|
|
11313
11365
|
|
|
11314
11366
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
11315
11367
|
import {
|
|
11316
|
-
applyToPoint as
|
|
11368
|
+
applyToPoint as applyToPoint66,
|
|
11317
11369
|
compose as compose13,
|
|
11318
11370
|
rotate as rotate7,
|
|
11319
11371
|
scale as scale7,
|
|
@@ -11322,7 +11374,7 @@ import {
|
|
|
11322
11374
|
|
|
11323
11375
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
11324
11376
|
import {
|
|
11325
|
-
applyToPoint as
|
|
11377
|
+
applyToPoint as applyToPoint65,
|
|
11326
11378
|
compose as compose12,
|
|
11327
11379
|
rotate as rotate6,
|
|
11328
11380
|
scale as scale6,
|
|
@@ -11397,7 +11449,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11397
11449
|
x: symbolBounds.minX,
|
|
11398
11450
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
11399
11451
|
};
|
|
11400
|
-
const rotatedSymbolEnd =
|
|
11452
|
+
const rotatedSymbolEnd = applyToPoint65(rotationMatrix, symbolEndPoint);
|
|
11401
11453
|
const symbolToRealTransform = compose12(
|
|
11402
11454
|
translate12(
|
|
11403
11455
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -11407,11 +11459,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11407
11459
|
scale6(1)
|
|
11408
11460
|
// Use full symbol size
|
|
11409
11461
|
);
|
|
11410
|
-
const [screenMinX, screenMinY] =
|
|
11462
|
+
const [screenMinX, screenMinY] = applyToPoint65(
|
|
11411
11463
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11412
11464
|
[bounds.minX, bounds.minY]
|
|
11413
11465
|
);
|
|
11414
|
-
const [screenMaxX, screenMaxY] =
|
|
11466
|
+
const [screenMaxX, screenMaxY] = applyToPoint65(
|
|
11415
11467
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11416
11468
|
[bounds.maxX, bounds.maxY]
|
|
11417
11469
|
);
|
|
@@ -11435,7 +11487,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11435
11487
|
});
|
|
11436
11488
|
for (const path of symbolPaths) {
|
|
11437
11489
|
const symbolPath = path.points.map((p, i) => {
|
|
11438
|
-
const [x, y] =
|
|
11490
|
+
const [x, y] = applyToPoint65(
|
|
11439
11491
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11440
11492
|
[p.x, p.y]
|
|
11441
11493
|
);
|
|
@@ -11456,7 +11508,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11456
11508
|
});
|
|
11457
11509
|
}
|
|
11458
11510
|
for (const text of symbolTexts) {
|
|
11459
|
-
const screenTextPos =
|
|
11511
|
+
const screenTextPos = applyToPoint65(
|
|
11460
11512
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11461
11513
|
text
|
|
11462
11514
|
);
|
|
@@ -11498,7 +11550,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11498
11550
|
});
|
|
11499
11551
|
}
|
|
11500
11552
|
for (const box of symbolBoxes) {
|
|
11501
|
-
const screenBoxPos =
|
|
11553
|
+
const screenBoxPos = applyToPoint65(
|
|
11502
11554
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11503
11555
|
box
|
|
11504
11556
|
);
|
|
@@ -11521,7 +11573,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11521
11573
|
});
|
|
11522
11574
|
}
|
|
11523
11575
|
for (const circle of symbolCircles) {
|
|
11524
|
-
const screenCirclePos =
|
|
11576
|
+
const screenCirclePos = applyToPoint65(
|
|
11525
11577
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11526
11578
|
circle
|
|
11527
11579
|
);
|
|
@@ -11566,14 +11618,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11566
11618
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
11567
11619
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
11568
11620
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
11569
|
-
const screenCenter =
|
|
11621
|
+
const screenCenter = applyToPoint66(realToScreenTransform, schNetLabel.center);
|
|
11570
11622
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
11571
11623
|
schNetLabel.anchor_side
|
|
11572
11624
|
);
|
|
11573
11625
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
11574
11626
|
screenTextGrowthVec.y *= -1;
|
|
11575
11627
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
11576
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
11628
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint66(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
11577
11629
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
11578
11630
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
11579
11631
|
};
|
|
@@ -11614,7 +11666,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11614
11666
|
y: -0.6
|
|
11615
11667
|
}
|
|
11616
11668
|
].map(
|
|
11617
|
-
(fontRelativePoint) =>
|
|
11669
|
+
(fontRelativePoint) => applyToPoint66(
|
|
11618
11670
|
compose13(
|
|
11619
11671
|
realToScreenTransform,
|
|
11620
11672
|
translate13(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -11691,17 +11743,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11691
11743
|
};
|
|
11692
11744
|
|
|
11693
11745
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
11694
|
-
import { applyToPoint as
|
|
11746
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
11695
11747
|
var createSvgObjectsFromSchematicBox = ({
|
|
11696
11748
|
schematicBox,
|
|
11697
11749
|
transform,
|
|
11698
11750
|
colorMap: colorMap2
|
|
11699
11751
|
}) => {
|
|
11700
|
-
const topLeft =
|
|
11752
|
+
const topLeft = applyToPoint67(transform, {
|
|
11701
11753
|
x: schematicBox.x,
|
|
11702
11754
|
y: schematicBox.y
|
|
11703
11755
|
});
|
|
11704
|
-
const bottomRight =
|
|
11756
|
+
const bottomRight = applyToPoint67(transform, {
|
|
11705
11757
|
x: schematicBox.x + schematicBox.width,
|
|
11706
11758
|
y: schematicBox.y + schematicBox.height
|
|
11707
11759
|
});
|
|
@@ -11737,7 +11789,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
11737
11789
|
};
|
|
11738
11790
|
|
|
11739
11791
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
11740
|
-
import { applyToPoint as
|
|
11792
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
11741
11793
|
var createSvgObjectsFromSchematicTable = ({
|
|
11742
11794
|
schematicTable,
|
|
11743
11795
|
transform,
|
|
@@ -11770,11 +11822,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11770
11822
|
const svgObjects = [];
|
|
11771
11823
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
11772
11824
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
11773
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
11825
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint68(transform, [
|
|
11774
11826
|
topLeftX,
|
|
11775
11827
|
topLeftY
|
|
11776
11828
|
]);
|
|
11777
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
11829
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint68(transform, [
|
|
11778
11830
|
topLeftX + totalWidth,
|
|
11779
11831
|
topLeftY - totalHeight
|
|
11780
11832
|
]);
|
|
@@ -11806,8 +11858,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11806
11858
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
11807
11859
|
);
|
|
11808
11860
|
if (!isMerged) {
|
|
11809
|
-
const start =
|
|
11810
|
-
const end =
|
|
11861
|
+
const start = applyToPoint68(transform, { x: currentX, y: segmentStartY });
|
|
11862
|
+
const end = applyToPoint68(transform, { x: currentX, y: segmentEndY });
|
|
11811
11863
|
svgObjects.push({
|
|
11812
11864
|
name: "line",
|
|
11813
11865
|
type: "element",
|
|
@@ -11836,11 +11888,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11836
11888
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
11837
11889
|
);
|
|
11838
11890
|
if (!isMerged) {
|
|
11839
|
-
const start =
|
|
11891
|
+
const start = applyToPoint68(transform, {
|
|
11840
11892
|
x: segmentStartX,
|
|
11841
11893
|
y: currentY
|
|
11842
11894
|
});
|
|
11843
|
-
const end =
|
|
11895
|
+
const end = applyToPoint68(transform, { x: segmentEndX, y: currentY });
|
|
11844
11896
|
svgObjects.push({
|
|
11845
11897
|
name: "line",
|
|
11846
11898
|
type: "element",
|
|
@@ -11882,7 +11934,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11882
11934
|
} else if (vertical_align === "bottom") {
|
|
11883
11935
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
11884
11936
|
}
|
|
11885
|
-
const screenTextAnchorPos =
|
|
11937
|
+
const screenTextAnchorPos = applyToPoint68(transform, realTextAnchorPos);
|
|
11886
11938
|
const fontSize = getSchScreenFontSize(
|
|
11887
11939
|
transform,
|
|
11888
11940
|
"reference_designator",
|
|
@@ -11938,13 +11990,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11938
11990
|
|
|
11939
11991
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
11940
11992
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
11941
|
-
import { applyToPoint as
|
|
11993
|
+
import { applyToPoint as applyToPoint69 } from "transformation-matrix";
|
|
11942
11994
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
11943
11995
|
var createSvgObjectsForSchPortHover = ({
|
|
11944
11996
|
schPort,
|
|
11945
11997
|
transform
|
|
11946
11998
|
}) => {
|
|
11947
|
-
const screenSchPortPos =
|
|
11999
|
+
const screenSchPortPos = applyToPoint69(transform, schPort.center);
|
|
11948
12000
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
11949
12001
|
return [
|
|
11950
12002
|
{
|
|
@@ -11989,14 +12041,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
11989
12041
|
};
|
|
11990
12042
|
|
|
11991
12043
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
11992
|
-
import { applyToPoint as
|
|
12044
|
+
import { applyToPoint as applyToPoint70 } from "transformation-matrix";
|
|
11993
12045
|
function createSvgObjectsFromSchematicLine({
|
|
11994
12046
|
schLine,
|
|
11995
12047
|
transform,
|
|
11996
12048
|
colorMap: colorMap2
|
|
11997
12049
|
}) {
|
|
11998
|
-
const p1 =
|
|
11999
|
-
const p2 =
|
|
12050
|
+
const p1 = applyToPoint70(transform, { x: schLine.x1, y: schLine.y1 });
|
|
12051
|
+
const p2 = applyToPoint70(transform, { x: schLine.x2, y: schLine.y2 });
|
|
12000
12052
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
12001
12053
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
12002
12054
|
return [
|
|
@@ -12025,13 +12077,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
12025
12077
|
}
|
|
12026
12078
|
|
|
12027
12079
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
12028
|
-
import { applyToPoint as
|
|
12080
|
+
import { applyToPoint as applyToPoint71 } from "transformation-matrix";
|
|
12029
12081
|
function createSvgObjectsFromSchematicCircle({
|
|
12030
12082
|
schCircle,
|
|
12031
12083
|
transform,
|
|
12032
12084
|
colorMap: colorMap2
|
|
12033
12085
|
}) {
|
|
12034
|
-
const center =
|
|
12086
|
+
const center = applyToPoint71(transform, schCircle.center);
|
|
12035
12087
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
12036
12088
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
12037
12089
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -12061,13 +12113,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
12061
12113
|
}
|
|
12062
12114
|
|
|
12063
12115
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
12064
|
-
import { applyToPoint as
|
|
12116
|
+
import { applyToPoint as applyToPoint72 } from "transformation-matrix";
|
|
12065
12117
|
function createSvgObjectsFromSchematicRect({
|
|
12066
12118
|
schRect,
|
|
12067
12119
|
transform,
|
|
12068
12120
|
colorMap: colorMap2
|
|
12069
12121
|
}) {
|
|
12070
|
-
const center =
|
|
12122
|
+
const center = applyToPoint72(transform, schRect.center);
|
|
12071
12123
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
12072
12124
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
12073
12125
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -12103,13 +12155,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
12103
12155
|
}
|
|
12104
12156
|
|
|
12105
12157
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
12106
|
-
import { applyToPoint as
|
|
12158
|
+
import { applyToPoint as applyToPoint73 } from "transformation-matrix";
|
|
12107
12159
|
function createSvgObjectsFromSchematicArc({
|
|
12108
12160
|
schArc,
|
|
12109
12161
|
transform,
|
|
12110
12162
|
colorMap: colorMap2
|
|
12111
12163
|
}) {
|
|
12112
|
-
const center =
|
|
12164
|
+
const center = applyToPoint73(transform, schArc.center);
|
|
12113
12165
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
12114
12166
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
12115
12167
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -13229,18 +13281,18 @@ function formatNumber2(value) {
|
|
|
13229
13281
|
import { distance as distance3 } from "circuit-json";
|
|
13230
13282
|
import { stringify as stringify7 } from "svgson";
|
|
13231
13283
|
import {
|
|
13232
|
-
applyToPoint as
|
|
13284
|
+
applyToPoint as applyToPoint76,
|
|
13233
13285
|
compose as compose16,
|
|
13234
13286
|
scale as scale9,
|
|
13235
13287
|
translate as translate16
|
|
13236
13288
|
} from "transformation-matrix";
|
|
13237
13289
|
|
|
13238
13290
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
13239
|
-
import { applyToPoint as
|
|
13291
|
+
import { applyToPoint as applyToPoint75 } from "transformation-matrix";
|
|
13240
13292
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
13241
13293
|
const { transform, layer: layerFilter } = ctx;
|
|
13242
13294
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
13243
|
-
const [x, y] =
|
|
13295
|
+
const [x, y] = applyToPoint75(transform, [solderPaste.x, solderPaste.y]);
|
|
13244
13296
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
13245
13297
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
13246
13298
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -13466,8 +13518,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
13466
13518
|
}
|
|
13467
13519
|
}
|
|
13468
13520
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
13469
|
-
const [x1, y1] =
|
|
13470
|
-
const [x2, y2] =
|
|
13521
|
+
const [x1, y1] = applyToPoint76(transform, [minX, minY]);
|
|
13522
|
+
const [x2, y2] = applyToPoint76(transform, [maxX, maxY]);
|
|
13471
13523
|
const width = Math.abs(x2 - x1);
|
|
13472
13524
|
const height = Math.abs(y2 - y1);
|
|
13473
13525
|
const x = Math.min(x1, x2);
|