circuit-to-svg 0.0.303 → 0.0.304
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 +198 -153
- 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
|
|
@@ -5183,9 +5183,39 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5183
5183
|
return [];
|
|
5184
5184
|
}
|
|
5185
5185
|
|
|
5186
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout-path.ts
|
|
5187
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
5188
|
+
function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
|
|
5189
|
+
const { transform, colorMap: colorMap2 } = ctx;
|
|
5190
|
+
if (!cutoutPath.route || !Array.isArray(cutoutPath.route)) return [];
|
|
5191
|
+
const firstPoint = cutoutPath.route[0];
|
|
5192
|
+
const lastPoint = cutoutPath.route[cutoutPath.route.length - 1];
|
|
5193
|
+
const isClosed = firstPoint && lastPoint && firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
|
|
5194
|
+
const path = cutoutPath.route.slice(0, isClosed ? -1 : void 0).map((point, index) => {
|
|
5195
|
+
const [x, y] = applyToPoint31(transform, [point.x, point.y]);
|
|
5196
|
+
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5197
|
+
}).join(" ") + (isClosed ? " Z" : "");
|
|
5198
|
+
return [
|
|
5199
|
+
{
|
|
5200
|
+
name: "path",
|
|
5201
|
+
type: "element",
|
|
5202
|
+
attributes: {
|
|
5203
|
+
class: "pcb-cutout pcb-cutout-path",
|
|
5204
|
+
d: path,
|
|
5205
|
+
fill: colorMap2.drill,
|
|
5206
|
+
"data-type": "pcb_cutout_path",
|
|
5207
|
+
"data-pcb-cutout-id": cutoutPath.pcb_cutout_id,
|
|
5208
|
+
"data-pcb-layer": "drill"
|
|
5209
|
+
},
|
|
5210
|
+
value: "",
|
|
5211
|
+
children: []
|
|
5212
|
+
}
|
|
5213
|
+
];
|
|
5214
|
+
}
|
|
5215
|
+
|
|
5186
5216
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-keepout.ts
|
|
5187
5217
|
import {
|
|
5188
|
-
applyToPoint as
|
|
5218
|
+
applyToPoint as applyToPoint32,
|
|
5189
5219
|
compose as compose5,
|
|
5190
5220
|
translate as translate5,
|
|
5191
5221
|
toString as matrixToString8
|
|
@@ -5202,7 +5232,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5202
5232
|
}
|
|
5203
5233
|
if (keepout.shape === "rect") {
|
|
5204
5234
|
const rectKeepout = keepout;
|
|
5205
|
-
const [cx, cy] =
|
|
5235
|
+
const [cx, cy] = applyToPoint32(transform, [
|
|
5206
5236
|
rectKeepout.center.x,
|
|
5207
5237
|
rectKeepout.center.y
|
|
5208
5238
|
]);
|
|
@@ -5236,7 +5266,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5236
5266
|
});
|
|
5237
5267
|
} else if (keepout.shape === "circle") {
|
|
5238
5268
|
const circleKeepout = keepout;
|
|
5239
|
-
const [cx, cy] =
|
|
5269
|
+
const [cx, cy] = applyToPoint32(transform, [
|
|
5240
5270
|
circleKeepout.center.x,
|
|
5241
5271
|
circleKeepout.center.y
|
|
5242
5272
|
]);
|
|
@@ -5272,7 +5302,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5272
5302
|
|
|
5273
5303
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
5274
5304
|
import {
|
|
5275
|
-
applyToPoint as
|
|
5305
|
+
applyToPoint as applyToPoint34,
|
|
5276
5306
|
compose as compose6,
|
|
5277
5307
|
rotate as rotate5,
|
|
5278
5308
|
toString as matrixToString9,
|
|
@@ -5280,11 +5310,11 @@ import {
|
|
|
5280
5310
|
} from "transformation-matrix";
|
|
5281
5311
|
|
|
5282
5312
|
// lib/utils/ring-to-path-d.ts
|
|
5283
|
-
import { applyToPoint as
|
|
5313
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
5284
5314
|
function ringToPathD(vertices, transform) {
|
|
5285
5315
|
if (vertices.length === 0) return "";
|
|
5286
5316
|
const transformedVertices = vertices.map((v) => {
|
|
5287
|
-
const [x, y] =
|
|
5317
|
+
const [x, y] = applyToPoint33(transform, [v.x, v.y]);
|
|
5288
5318
|
return { ...v, x, y };
|
|
5289
5319
|
});
|
|
5290
5320
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -5373,7 +5403,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5373
5403
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
5374
5404
|
const maskOverlayOpacity = "0.9";
|
|
5375
5405
|
if (pour.shape === "rect") {
|
|
5376
|
-
const [cx, cy] =
|
|
5406
|
+
const [cx, cy] = applyToPoint34(transform, [pour.center.x, pour.center.y]);
|
|
5377
5407
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
5378
5408
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
5379
5409
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -5425,7 +5455,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5425
5455
|
if (pour.shape === "polygon") {
|
|
5426
5456
|
if (!pour.points || pour.points.length === 0) return [];
|
|
5427
5457
|
const transformedPoints = pour.points.map(
|
|
5428
|
-
(p) =>
|
|
5458
|
+
(p) => applyToPoint34(transform, [p.x, p.y])
|
|
5429
5459
|
);
|
|
5430
5460
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5431
5461
|
const copperPolygon = {
|
|
@@ -5648,11 +5678,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
5648
5678
|
}
|
|
5649
5679
|
|
|
5650
5680
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
5651
|
-
import { applyToPoint as
|
|
5681
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
5652
5682
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
5653
5683
|
const { transform, circuitJson } = ctx;
|
|
5654
5684
|
const { center, width, height, rotation = 0 } = component;
|
|
5655
|
-
const [x, y] =
|
|
5685
|
+
const [x, y] = applyToPoint35(transform, [center.x, center.y]);
|
|
5656
5686
|
const scaledWidth = width * Math.abs(transform.a);
|
|
5657
5687
|
const scaledHeight = height * Math.abs(transform.d);
|
|
5658
5688
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -5724,7 +5754,7 @@ function getParentAnchorPosition(component, circuitJson) {
|
|
|
5724
5754
|
}
|
|
5725
5755
|
|
|
5726
5756
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
5727
|
-
import { applyToPoint as
|
|
5757
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
5728
5758
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
5729
5759
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
5730
5760
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -5768,7 +5798,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5768
5798
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
5769
5799
|
)) {
|
|
5770
5800
|
const path = outline.map((point, index) => {
|
|
5771
|
-
const [x, y] =
|
|
5801
|
+
const [x, y] = applyToPoint36(transform, [point.x, point.y]);
|
|
5772
5802
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5773
5803
|
}).join(" ");
|
|
5774
5804
|
svgObjects.push({
|
|
@@ -5789,11 +5819,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5789
5819
|
}
|
|
5790
5820
|
const halfWidth = width / 2;
|
|
5791
5821
|
const halfHeight = height / 2;
|
|
5792
|
-
const [topLeftX, topLeftY] =
|
|
5822
|
+
const [topLeftX, topLeftY] = applyToPoint36(transform, [
|
|
5793
5823
|
center.x - halfWidth,
|
|
5794
5824
|
center.y + halfHeight
|
|
5795
5825
|
]);
|
|
5796
|
-
const [bottomRightX, bottomRightY] =
|
|
5826
|
+
const [bottomRightX, bottomRightY] = applyToPoint36(transform, [
|
|
5797
5827
|
center.x + halfWidth,
|
|
5798
5828
|
center.y - halfHeight
|
|
5799
5829
|
]);
|
|
@@ -5847,7 +5877,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5847
5877
|
var package_default = {
|
|
5848
5878
|
name: "circuit-to-svg",
|
|
5849
5879
|
type: "module",
|
|
5850
|
-
version: "0.0.
|
|
5880
|
+
version: "0.0.303",
|
|
5851
5881
|
description: "Convert Circuit JSON to SVG",
|
|
5852
5882
|
main: "dist/index.js",
|
|
5853
5883
|
files: [
|
|
@@ -5904,6 +5934,7 @@ var TYPE_PRIORITY = {
|
|
|
5904
5934
|
pcb_panel: 5,
|
|
5905
5935
|
pcb_board: 10,
|
|
5906
5936
|
pcb_cutout: 15,
|
|
5937
|
+
pcb_cutout_path: 15,
|
|
5907
5938
|
pcb_keepout: 16,
|
|
5908
5939
|
pcb_hole: 18,
|
|
5909
5940
|
pcb_plated_hole_drill: 19,
|
|
@@ -6140,6 +6171,11 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6140
6171
|
}
|
|
6141
6172
|
} else if (cutout.shape === "polygon") {
|
|
6142
6173
|
updateTraceBounds(cutout.points);
|
|
6174
|
+
} else if (cutout.shape === "path") {
|
|
6175
|
+
const cutoutPath = cutout;
|
|
6176
|
+
if (cutoutPath.route && Array.isArray(cutoutPath.route)) {
|
|
6177
|
+
updateTraceBounds(cutoutPath.route);
|
|
6178
|
+
}
|
|
6143
6179
|
}
|
|
6144
6180
|
} else if (circuitJsonElm.type === "pcb_keepout") {
|
|
6145
6181
|
const keepout = circuitJsonElm;
|
|
@@ -6432,6 +6468,11 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6432
6468
|
}
|
|
6433
6469
|
} else if (cutout.shape === "polygon") {
|
|
6434
6470
|
updateTraceBounds(cutout.points);
|
|
6471
|
+
} else if (cutout.shape === "path") {
|
|
6472
|
+
const cutoutPath = cutout;
|
|
6473
|
+
if (cutoutPath.route && Array.isArray(cutoutPath.route)) {
|
|
6474
|
+
updateTraceBounds(cutoutPath.route);
|
|
6475
|
+
}
|
|
6435
6476
|
}
|
|
6436
6477
|
}
|
|
6437
6478
|
}
|
|
@@ -6508,6 +6549,10 @@ function createSvgObjects({
|
|
|
6508
6549
|
case "pcb_via":
|
|
6509
6550
|
return createSvgObjectsFromPcbVia(elm, ctx);
|
|
6510
6551
|
case "pcb_cutout":
|
|
6552
|
+
const cutout = elm;
|
|
6553
|
+
if (cutout.shape === "path") {
|
|
6554
|
+
return createSvgObjectsFromPcbCutoutPath(cutout, ctx);
|
|
6555
|
+
}
|
|
6511
6556
|
return createSvgObjectsFromPcbCutout(elm, ctx);
|
|
6512
6557
|
case "pcb_keepout":
|
|
6513
6558
|
return createSvgObjectsFromPcbKeepout(
|
|
@@ -6521,8 +6566,8 @@ function createSvgObjects({
|
|
|
6521
6566
|
}
|
|
6522
6567
|
}
|
|
6523
6568
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
6524
|
-
const [x1, y1] =
|
|
6525
|
-
const [x2, y2] =
|
|
6569
|
+
const [x1, y1] = applyToPoint37(transform, [minX, minY]);
|
|
6570
|
+
const [x2, y2] = applyToPoint37(transform, [maxX, maxY]);
|
|
6526
6571
|
const width = Math.abs(x2 - x1);
|
|
6527
6572
|
const height = Math.abs(y2 - y1);
|
|
6528
6573
|
const x = Math.min(x1, x2);
|
|
@@ -6552,14 +6597,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
6552
6597
|
import { stringify as stringify2 } from "svgson";
|
|
6553
6598
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
6554
6599
|
import {
|
|
6555
|
-
applyToPoint as
|
|
6600
|
+
applyToPoint as applyToPoint44,
|
|
6556
6601
|
compose as compose8,
|
|
6557
6602
|
scale as scale4,
|
|
6558
6603
|
translate as translate8
|
|
6559
6604
|
} from "transformation-matrix";
|
|
6560
6605
|
|
|
6561
6606
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
6562
|
-
import { applyToPoint as
|
|
6607
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
6563
6608
|
var DEFAULT_BOARD_STYLE = {
|
|
6564
6609
|
fill: "none",
|
|
6565
6610
|
stroke: "rgb(0,0,0)",
|
|
@@ -6571,25 +6616,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6571
6616
|
let path;
|
|
6572
6617
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
6573
6618
|
path = outline.map((point, index) => {
|
|
6574
|
-
const [x, y] =
|
|
6619
|
+
const [x, y] = applyToPoint38(transform, [point.x, point.y]);
|
|
6575
6620
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
6576
6621
|
}).join(" ");
|
|
6577
6622
|
} else {
|
|
6578
6623
|
const halfWidth = width / 2;
|
|
6579
6624
|
const halfHeight = height / 2;
|
|
6580
|
-
const topLeft =
|
|
6625
|
+
const topLeft = applyToPoint38(transform, [
|
|
6581
6626
|
center.x - halfWidth,
|
|
6582
6627
|
center.y - halfHeight
|
|
6583
6628
|
]);
|
|
6584
|
-
const topRight =
|
|
6629
|
+
const topRight = applyToPoint38(transform, [
|
|
6585
6630
|
center.x + halfWidth,
|
|
6586
6631
|
center.y - halfHeight
|
|
6587
6632
|
]);
|
|
6588
|
-
const bottomRight =
|
|
6633
|
+
const bottomRight = applyToPoint38(transform, [
|
|
6589
6634
|
center.x + halfWidth,
|
|
6590
6635
|
center.y + halfHeight
|
|
6591
6636
|
]);
|
|
6592
|
-
const bottomLeft =
|
|
6637
|
+
const bottomLeft = applyToPoint38(transform, [
|
|
6593
6638
|
center.x - halfWidth,
|
|
6594
6639
|
center.y + halfHeight
|
|
6595
6640
|
]);
|
|
@@ -6615,7 +6660,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6615
6660
|
}
|
|
6616
6661
|
|
|
6617
6662
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
6618
|
-
import { applyToPoint as
|
|
6663
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
6619
6664
|
|
|
6620
6665
|
// lib/utils/get-sch-font-size.ts
|
|
6621
6666
|
import "transformation-matrix";
|
|
@@ -6641,8 +6686,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
6641
6686
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
6642
6687
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
6643
6688
|
return null;
|
|
6644
|
-
const [x, y] =
|
|
6645
|
-
const [pinX, pinY] =
|
|
6689
|
+
const [x, y] = applyToPoint40(transform, [center.x, center.y]);
|
|
6690
|
+
const [pinX, pinY] = applyToPoint40(transform, [portPosition.x, portPosition.y]);
|
|
6646
6691
|
const scaledWidth = width * Math.abs(transform.a);
|
|
6647
6692
|
const scaledHeight = height * Math.abs(transform.d);
|
|
6648
6693
|
const isTopLayer = layer === "top";
|
|
@@ -6804,11 +6849,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
6804
6849
|
}
|
|
6805
6850
|
|
|
6806
6851
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
6807
|
-
import { applyToPoint as
|
|
6852
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
6808
6853
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
6809
6854
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
6810
6855
|
const { transform } = ctx;
|
|
6811
|
-
const [x, y] =
|
|
6856
|
+
const [x, y] = applyToPoint41(transform, [hole.x, hole.y]);
|
|
6812
6857
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
6813
6858
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
6814
6859
|
const radius = scaledDiameter / 2;
|
|
@@ -6872,12 +6917,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
6872
6917
|
}
|
|
6873
6918
|
|
|
6874
6919
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
6875
|
-
import { applyToPoint as
|
|
6920
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
6876
6921
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
6877
6922
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
6878
6923
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
6879
6924
|
const { transform } = ctx;
|
|
6880
|
-
const [x, y] =
|
|
6925
|
+
const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
|
|
6881
6926
|
if (hole.shape === "pill") {
|
|
6882
6927
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
6883
6928
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -6972,7 +7017,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6972
7017
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
6973
7018
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
6974
7019
|
const holeRadius = scaledHoleDiameter / 2;
|
|
6975
|
-
const [holeCx, holeCy] =
|
|
7020
|
+
const [holeCx, holeCy] = applyToPoint42(transform, [
|
|
6976
7021
|
circularHole.x + circularHole.hole_offset_x,
|
|
6977
7022
|
circularHole.y + circularHole.hole_offset_y
|
|
6978
7023
|
]);
|
|
@@ -7030,7 +7075,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7030
7075
|
const pillHoleWithOffsets = pillHole;
|
|
7031
7076
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
7032
7077
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
7033
|
-
const [holeCenterX, holeCenterY] =
|
|
7078
|
+
const [holeCenterX, holeCenterY] = applyToPoint42(transform, [
|
|
7034
7079
|
pillHole.x + holeOffsetX,
|
|
7035
7080
|
pillHole.y + holeOffsetY
|
|
7036
7081
|
]);
|
|
@@ -7092,7 +7137,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7092
7137
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
7093
7138
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
7094
7139
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
7095
|
-
const [holeCenterX, holeCenterY] =
|
|
7140
|
+
const [holeCenterX, holeCenterY] = applyToPoint42(transform, [
|
|
7096
7141
|
rotatedHole.x + holeOffsetX,
|
|
7097
7142
|
rotatedHole.y + holeOffsetY
|
|
7098
7143
|
]);
|
|
@@ -7148,14 +7193,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7148
7193
|
}
|
|
7149
7194
|
|
|
7150
7195
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
7151
|
-
import { applyToPoint as
|
|
7196
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
7152
7197
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
7153
7198
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
7154
7199
|
const { transform } = ctx;
|
|
7155
7200
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7156
7201
|
const width = pad.width * Math.abs(transform.a);
|
|
7157
7202
|
const height = pad.height * Math.abs(transform.d);
|
|
7158
|
-
const [x, y] =
|
|
7203
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7159
7204
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
7160
7205
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7161
7206
|
return [
|
|
@@ -7207,7 +7252,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7207
7252
|
const width = pad.width * Math.abs(transform.a);
|
|
7208
7253
|
const height = pad.height * Math.abs(transform.d);
|
|
7209
7254
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7210
|
-
const [x, y] =
|
|
7255
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7211
7256
|
return [
|
|
7212
7257
|
{
|
|
7213
7258
|
name: "rect",
|
|
@@ -7230,7 +7275,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7230
7275
|
}
|
|
7231
7276
|
if (pad.shape === "circle") {
|
|
7232
7277
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7233
|
-
const [x, y] =
|
|
7278
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7234
7279
|
return [
|
|
7235
7280
|
{
|
|
7236
7281
|
name: "circle",
|
|
@@ -7250,7 +7295,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7250
7295
|
}
|
|
7251
7296
|
if (pad.shape === "polygon") {
|
|
7252
7297
|
const points = (pad.points ?? []).map(
|
|
7253
|
-
(point) =>
|
|
7298
|
+
(point) => applyToPoint43(transform, [point.x, point.y])
|
|
7254
7299
|
);
|
|
7255
7300
|
return [
|
|
7256
7301
|
{
|
|
@@ -7434,8 +7479,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
7434
7479
|
}
|
|
7435
7480
|
}
|
|
7436
7481
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
7437
|
-
const [x1, y1] =
|
|
7438
|
-
const [x2, y2] =
|
|
7482
|
+
const [x1, y1] = applyToPoint44(transform, [minX, minY]);
|
|
7483
|
+
const [x2, y2] = applyToPoint44(transform, [maxX, maxY]);
|
|
7439
7484
|
const width = Math.abs(x2 - x1);
|
|
7440
7485
|
const height = Math.abs(y2 - y1);
|
|
7441
7486
|
const x = Math.min(x1, x2);
|
|
@@ -7464,7 +7509,7 @@ import {
|
|
|
7464
7509
|
} from "transformation-matrix";
|
|
7465
7510
|
|
|
7466
7511
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
7467
|
-
import { applyToPoint as
|
|
7512
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
7468
7513
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
7469
7514
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
7470
7515
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -7478,25 +7523,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7478
7523
|
let path;
|
|
7479
7524
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
7480
7525
|
path = outline.map((point, index) => {
|
|
7481
|
-
const [x, y] =
|
|
7526
|
+
const [x, y] = applyToPoint45(transform, [point.x, point.y]);
|
|
7482
7527
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
7483
7528
|
}).join(" ");
|
|
7484
7529
|
} else {
|
|
7485
7530
|
const halfWidth = width / 2;
|
|
7486
7531
|
const halfHeight = height / 2;
|
|
7487
|
-
const topLeft =
|
|
7532
|
+
const topLeft = applyToPoint45(transform, [
|
|
7488
7533
|
center.x - halfWidth,
|
|
7489
7534
|
center.y - halfHeight
|
|
7490
7535
|
]);
|
|
7491
|
-
const topRight =
|
|
7536
|
+
const topRight = applyToPoint45(transform, [
|
|
7492
7537
|
center.x + halfWidth,
|
|
7493
7538
|
center.y - halfHeight
|
|
7494
7539
|
]);
|
|
7495
|
-
const bottomRight =
|
|
7540
|
+
const bottomRight = applyToPoint45(transform, [
|
|
7496
7541
|
center.x + halfWidth,
|
|
7497
7542
|
center.y + halfHeight
|
|
7498
7543
|
]);
|
|
7499
|
-
const bottomLeft =
|
|
7544
|
+
const bottomLeft = applyToPoint45(transform, [
|
|
7500
7545
|
center.x - halfWidth,
|
|
7501
7546
|
center.y + halfHeight
|
|
7502
7547
|
]);
|
|
@@ -7514,10 +7559,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7514
7559
|
const halfWidth = width2 / 2;
|
|
7515
7560
|
const halfHeight = height2 / 2;
|
|
7516
7561
|
const [tl, tr, br, bl] = [
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7562
|
+
applyToPoint45(transform, [x - halfWidth, y - halfHeight]),
|
|
7563
|
+
applyToPoint45(transform, [x + halfWidth, y - halfHeight]),
|
|
7564
|
+
applyToPoint45(transform, [x + halfWidth, y + halfHeight]),
|
|
7565
|
+
applyToPoint45(transform, [x - halfWidth, y + halfHeight])
|
|
7521
7566
|
];
|
|
7522
7567
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
7523
7568
|
} else if (cutout.shape === "circle") {
|
|
@@ -7567,7 +7612,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7567
7612
|
|
|
7568
7613
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
7569
7614
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
7570
|
-
import { applyToPoint as
|
|
7615
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
7571
7616
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
7572
7617
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
7573
7618
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -7577,7 +7622,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7577
7622
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
7578
7623
|
return [];
|
|
7579
7624
|
}
|
|
7580
|
-
const [x, y] =
|
|
7625
|
+
const [x, y] = applyToPoint46(transform, [center.x, center.y]);
|
|
7581
7626
|
const scaledWidth = width * Math.abs(transform.a);
|
|
7582
7627
|
const scaledHeight = height * Math.abs(transform.d);
|
|
7583
7628
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -7638,11 +7683,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7638
7683
|
}
|
|
7639
7684
|
|
|
7640
7685
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
7641
|
-
import { applyToPoint as
|
|
7686
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7642
7687
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
7643
7688
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
7644
7689
|
const { transform } = ctx;
|
|
7645
|
-
const [x, y] =
|
|
7690
|
+
const [x, y] = applyToPoint47(transform, [hole.x, hole.y]);
|
|
7646
7691
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
7647
7692
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
7648
7693
|
const radius = scaledDiameter / 2;
|
|
@@ -7706,12 +7751,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
7706
7751
|
}
|
|
7707
7752
|
|
|
7708
7753
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
7709
|
-
import { applyToPoint as
|
|
7754
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7710
7755
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
7711
7756
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
7712
7757
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
7713
7758
|
const { transform } = ctx;
|
|
7714
|
-
const [x, y] =
|
|
7759
|
+
const [x, y] = applyToPoint48(transform, [hole.x, hole.y]);
|
|
7715
7760
|
if (hole.shape === "pill") {
|
|
7716
7761
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
7717
7762
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -7946,14 +7991,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
7946
7991
|
}
|
|
7947
7992
|
|
|
7948
7993
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
7949
|
-
import { applyToPoint as
|
|
7994
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7950
7995
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
7951
7996
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
7952
7997
|
const { transform } = ctx;
|
|
7953
7998
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7954
7999
|
const width = pad.width * Math.abs(transform.a);
|
|
7955
8000
|
const height = pad.height * Math.abs(transform.d);
|
|
7956
|
-
const [x, y] =
|
|
8001
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
7957
8002
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7958
8003
|
return [
|
|
7959
8004
|
{
|
|
@@ -7996,7 +8041,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7996
8041
|
const width = pad.width * Math.abs(transform.a);
|
|
7997
8042
|
const height = pad.height * Math.abs(transform.d);
|
|
7998
8043
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7999
|
-
const [x, y] =
|
|
8044
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
8000
8045
|
return [
|
|
8001
8046
|
{
|
|
8002
8047
|
name: "rect",
|
|
@@ -8019,7 +8064,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8019
8064
|
}
|
|
8020
8065
|
if (pad.shape === "circle") {
|
|
8021
8066
|
const radius = pad.radius * Math.abs(transform.a);
|
|
8022
|
-
const [x, y] =
|
|
8067
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
8023
8068
|
return [
|
|
8024
8069
|
{
|
|
8025
8070
|
name: "circle",
|
|
@@ -8039,7 +8084,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8039
8084
|
}
|
|
8040
8085
|
if (pad.shape === "polygon") {
|
|
8041
8086
|
const points = (pad.points ?? []).map(
|
|
8042
|
-
(point) =>
|
|
8087
|
+
(point) => applyToPoint49(transform, [point.x, point.y])
|
|
8043
8088
|
);
|
|
8044
8089
|
return [
|
|
8045
8090
|
{
|
|
@@ -8060,7 +8105,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8060
8105
|
}
|
|
8061
8106
|
|
|
8062
8107
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
8063
|
-
import { applyToPoint as
|
|
8108
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
8064
8109
|
import { calculateElbow } from "calculate-elbow";
|
|
8065
8110
|
|
|
8066
8111
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -8137,7 +8182,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8137
8182
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
8138
8183
|
if (!label_info) return [];
|
|
8139
8184
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
8140
|
-
const [port_x, port_y] =
|
|
8185
|
+
const [port_x, port_y] = applyToPoint50(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
8141
8186
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
8142
8187
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
8143
8188
|
const elbow_path = calculateElbow(
|
|
@@ -8278,7 +8323,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8278
8323
|
}
|
|
8279
8324
|
|
|
8280
8325
|
// lib/pinout/calculate-label-positions.ts
|
|
8281
|
-
import { applyToPoint as
|
|
8326
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
8282
8327
|
|
|
8283
8328
|
// lib/pinout/constants.ts
|
|
8284
8329
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -8316,7 +8361,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8316
8361
|
);
|
|
8317
8362
|
const mapToEdgePort = (pinout_label) => ({
|
|
8318
8363
|
pcb_port: pinout_label.pcb_port,
|
|
8319
|
-
y:
|
|
8364
|
+
y: applyToPoint51(transform, [
|
|
8320
8365
|
pinout_label.pcb_port.x,
|
|
8321
8366
|
pinout_label.pcb_port.y
|
|
8322
8367
|
])[1],
|
|
@@ -8331,7 +8376,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8331
8376
|
} else {
|
|
8332
8377
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
8333
8378
|
pcb_port: pinout_label.pcb_port,
|
|
8334
|
-
y:
|
|
8379
|
+
y: applyToPoint51(transform, [
|
|
8335
8380
|
pinout_label.pcb_port.x,
|
|
8336
8381
|
pinout_label.pcb_port.y
|
|
8337
8382
|
])[1],
|
|
@@ -8339,7 +8384,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8339
8384
|
})).sort((a, b) => a.y - b.y);
|
|
8340
8385
|
}
|
|
8341
8386
|
if (edge_ports.length === 0) return;
|
|
8342
|
-
const board_edge_x =
|
|
8387
|
+
const board_edge_x = applyToPoint51(transform, [
|
|
8343
8388
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
8344
8389
|
0
|
|
8345
8390
|
])[0];
|
|
@@ -8761,14 +8806,14 @@ import {
|
|
|
8761
8806
|
} from "transformation-matrix";
|
|
8762
8807
|
|
|
8763
8808
|
// lib/sch/draw-schematic-grid.ts
|
|
8764
|
-
import { applyToPoint as
|
|
8809
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
8765
8810
|
function drawSchematicGrid(params) {
|
|
8766
8811
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
8767
8812
|
const cellSize = params.cellSize ?? 1;
|
|
8768
8813
|
const labelCells = params.labelCells ?? false;
|
|
8769
8814
|
const gridLines = [];
|
|
8770
8815
|
const transformPoint = (x, y) => {
|
|
8771
|
-
const [transformedX, transformedY] =
|
|
8816
|
+
const [transformedX, transformedY] = applyToPoint52(params.transform, [x, y]);
|
|
8772
8817
|
return { x: transformedX, y: transformedY };
|
|
8773
8818
|
};
|
|
8774
8819
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -8849,15 +8894,15 @@ function drawSchematicGrid(params) {
|
|
|
8849
8894
|
}
|
|
8850
8895
|
|
|
8851
8896
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
8852
|
-
import { applyToPoint as
|
|
8897
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
8853
8898
|
function drawSchematicLabeledPoints(params) {
|
|
8854
8899
|
const { points, transform } = params;
|
|
8855
8900
|
const labeledPointsGroup = [];
|
|
8856
8901
|
for (const point of points) {
|
|
8857
|
-
const [x1, y1] =
|
|
8858
|
-
const [x2, y2] =
|
|
8859
|
-
const [x3, y3] =
|
|
8860
|
-
const [x4, y4] =
|
|
8902
|
+
const [x1, y1] = applyToPoint53(transform, [point.x - 0.1, point.y - 0.1]);
|
|
8903
|
+
const [x2, y2] = applyToPoint53(transform, [point.x + 0.1, point.y + 0.1]);
|
|
8904
|
+
const [x3, y3] = applyToPoint53(transform, [point.x - 0.1, point.y + 0.1]);
|
|
8905
|
+
const [x4, y4] = applyToPoint53(transform, [point.x + 0.1, point.y - 0.1]);
|
|
8861
8906
|
labeledPointsGroup.push({
|
|
8862
8907
|
name: "path",
|
|
8863
8908
|
type: "element",
|
|
@@ -8868,7 +8913,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
8868
8913
|
"stroke-opacity": "0.7"
|
|
8869
8914
|
}
|
|
8870
8915
|
});
|
|
8871
|
-
const [labelX, labelY] =
|
|
8916
|
+
const [labelX, labelY] = applyToPoint53(transform, [
|
|
8872
8917
|
point.x + 0.15,
|
|
8873
8918
|
point.y - 0.15
|
|
8874
8919
|
]);
|
|
@@ -9986,7 +10031,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
9986
10031
|
import { symbols } from "schematic-symbols";
|
|
9987
10032
|
import "svgson";
|
|
9988
10033
|
import {
|
|
9989
|
-
applyToPoint as
|
|
10034
|
+
applyToPoint as applyToPoint55,
|
|
9990
10035
|
compose as compose11
|
|
9991
10036
|
} from "transformation-matrix";
|
|
9992
10037
|
|
|
@@ -10070,13 +10115,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
10070
10115
|
}
|
|
10071
10116
|
|
|
10072
10117
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
10073
|
-
import { applyToPoint as
|
|
10118
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
10074
10119
|
var createSvgSchErrorText = ({
|
|
10075
10120
|
text,
|
|
10076
10121
|
realCenter,
|
|
10077
10122
|
realToScreenTransform
|
|
10078
10123
|
}) => {
|
|
10079
|
-
const screenCenter =
|
|
10124
|
+
const screenCenter = applyToPoint54(realToScreenTransform, realCenter);
|
|
10080
10125
|
return {
|
|
10081
10126
|
type: "element",
|
|
10082
10127
|
name: "text",
|
|
@@ -10185,11 +10230,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10185
10230
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
10186
10231
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
10187
10232
|
};
|
|
10188
|
-
const [screenMinX, screenMinY] =
|
|
10233
|
+
const [screenMinX, screenMinY] = applyToPoint55(
|
|
10189
10234
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10190
10235
|
[bounds.minX, bounds.minY]
|
|
10191
10236
|
);
|
|
10192
|
-
const [screenMaxX, screenMaxY] =
|
|
10237
|
+
const [screenMaxX, screenMaxY] = applyToPoint55(
|
|
10193
10238
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10194
10239
|
[bounds.maxX, bounds.maxY]
|
|
10195
10240
|
);
|
|
@@ -10218,7 +10263,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10218
10263
|
name: "path",
|
|
10219
10264
|
attributes: {
|
|
10220
10265
|
d: points.map((p, i) => {
|
|
10221
|
-
const [x, y] =
|
|
10266
|
+
const [x, y] = applyToPoint55(
|
|
10222
10267
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10223
10268
|
[p.x, p.y]
|
|
10224
10269
|
);
|
|
@@ -10234,7 +10279,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10234
10279
|
});
|
|
10235
10280
|
}
|
|
10236
10281
|
for (const text of texts) {
|
|
10237
|
-
const screenTextPos =
|
|
10282
|
+
const screenTextPos = applyToPoint55(
|
|
10238
10283
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10239
10284
|
text
|
|
10240
10285
|
);
|
|
@@ -10286,7 +10331,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10286
10331
|
});
|
|
10287
10332
|
}
|
|
10288
10333
|
for (const box of boxes) {
|
|
10289
|
-
const screenBoxPos =
|
|
10334
|
+
const screenBoxPos = applyToPoint55(
|
|
10290
10335
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10291
10336
|
box
|
|
10292
10337
|
);
|
|
@@ -10310,7 +10355,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10310
10355
|
}
|
|
10311
10356
|
for (const port of symbol.ports) {
|
|
10312
10357
|
if (connectedSymbolPorts.has(port)) continue;
|
|
10313
|
-
const screenPortPos =
|
|
10358
|
+
const screenPortPos = applyToPoint55(
|
|
10314
10359
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10315
10360
|
port
|
|
10316
10361
|
);
|
|
@@ -10330,7 +10375,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10330
10375
|
});
|
|
10331
10376
|
}
|
|
10332
10377
|
for (const circle of circles) {
|
|
10333
|
-
const screenCirclePos =
|
|
10378
|
+
const screenCirclePos = applyToPoint55(
|
|
10334
10379
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10335
10380
|
circle
|
|
10336
10381
|
);
|
|
@@ -10357,14 +10402,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10357
10402
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
10358
10403
|
import "schematic-symbols";
|
|
10359
10404
|
import "svgson";
|
|
10360
|
-
import { applyToPoint as
|
|
10405
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
10361
10406
|
|
|
10362
10407
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
10363
10408
|
import "transformation-matrix";
|
|
10364
10409
|
import "@tscircuit/circuit-json-util";
|
|
10365
10410
|
|
|
10366
10411
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
10367
|
-
import { applyToPoint as
|
|
10412
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
10368
10413
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
10369
10414
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
10370
10415
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -10417,8 +10462,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10417
10462
|
realEdgePos.y += realPinLineLength;
|
|
10418
10463
|
break;
|
|
10419
10464
|
}
|
|
10420
|
-
const screenSchPortPos =
|
|
10421
|
-
const screenRealEdgePos =
|
|
10465
|
+
const screenSchPortPos = applyToPoint56(transform, schPort.center);
|
|
10466
|
+
const screenRealEdgePos = applyToPoint56(transform, realEdgePos);
|
|
10422
10467
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
10423
10468
|
const realLineEnd = { ...schPort.center };
|
|
10424
10469
|
if (!isConnected) {
|
|
@@ -10437,7 +10482,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10437
10482
|
break;
|
|
10438
10483
|
}
|
|
10439
10484
|
}
|
|
10440
|
-
const screenLineEnd =
|
|
10485
|
+
const screenLineEnd = applyToPoint56(transform, realLineEnd);
|
|
10441
10486
|
svgObjects.push({
|
|
10442
10487
|
name: "line",
|
|
10443
10488
|
type: "element",
|
|
@@ -10558,7 +10603,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10558
10603
|
};
|
|
10559
10604
|
|
|
10560
10605
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
10561
|
-
import { applyToPoint as
|
|
10606
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
10562
10607
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
10563
10608
|
const svgObjects = [];
|
|
10564
10609
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -10576,7 +10621,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10576
10621
|
} else {
|
|
10577
10622
|
realPinNumberPos.y += 0.02;
|
|
10578
10623
|
}
|
|
10579
|
-
const screenPinNumberTextPos =
|
|
10624
|
+
const screenPinNumberTextPos = applyToPoint57(transform, realPinNumberPos);
|
|
10580
10625
|
svgObjects.push({
|
|
10581
10626
|
name: "text",
|
|
10582
10627
|
type: "element",
|
|
@@ -10606,7 +10651,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10606
10651
|
};
|
|
10607
10652
|
|
|
10608
10653
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
10609
|
-
import { applyToPoint as
|
|
10654
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
10610
10655
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
10611
10656
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
10612
10657
|
const svgObjects = [];
|
|
@@ -10620,7 +10665,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
10620
10665
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
10621
10666
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10622
10667
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10623
|
-
const screenPinNumberTextPos =
|
|
10668
|
+
const screenPinNumberTextPos = applyToPoint58(transform, realPinNumberPos);
|
|
10624
10669
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
10625
10670
|
if (!label) return [];
|
|
10626
10671
|
const isNegated = label.startsWith("N_");
|
|
@@ -10668,13 +10713,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
10668
10713
|
};
|
|
10669
10714
|
|
|
10670
10715
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
10671
|
-
import { applyToPoint as
|
|
10716
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
10672
10717
|
var createSvgSchText = ({
|
|
10673
10718
|
elm,
|
|
10674
10719
|
transform,
|
|
10675
10720
|
colorMap: colorMap2
|
|
10676
10721
|
}) => {
|
|
10677
|
-
const center =
|
|
10722
|
+
const center = applyToPoint60(transform, elm.position);
|
|
10678
10723
|
const textAnchorMap = {
|
|
10679
10724
|
center: "middle",
|
|
10680
10725
|
center_right: "end",
|
|
@@ -10758,11 +10803,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
10758
10803
|
colorMap: colorMap2
|
|
10759
10804
|
}) => {
|
|
10760
10805
|
const svgObjects = [];
|
|
10761
|
-
const componentScreenTopLeft =
|
|
10806
|
+
const componentScreenTopLeft = applyToPoint61(transform, {
|
|
10762
10807
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
10763
10808
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
10764
10809
|
});
|
|
10765
|
-
const componentScreenBottomRight =
|
|
10810
|
+
const componentScreenBottomRight = applyToPoint61(transform, {
|
|
10766
10811
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
10767
10812
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
10768
10813
|
});
|
|
@@ -10848,13 +10893,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
10848
10893
|
}
|
|
10849
10894
|
|
|
10850
10895
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
10851
|
-
import { applyToPoint as
|
|
10896
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
10852
10897
|
function createSvgObjectsFromSchVoltageProbe({
|
|
10853
10898
|
probe,
|
|
10854
10899
|
transform,
|
|
10855
10900
|
colorMap: colorMap2
|
|
10856
10901
|
}) {
|
|
10857
|
-
const [screenX, screenY] =
|
|
10902
|
+
const [screenX, screenY] = applyToPoint62(transform, [
|
|
10858
10903
|
probe.position.x,
|
|
10859
10904
|
probe.position.y
|
|
10860
10905
|
]);
|
|
@@ -11028,17 +11073,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
11028
11073
|
}
|
|
11029
11074
|
|
|
11030
11075
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
11031
|
-
import { applyToPoint as
|
|
11076
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
11032
11077
|
function createSvgObjectsFromSchDebugObject({
|
|
11033
11078
|
debugObject,
|
|
11034
11079
|
transform
|
|
11035
11080
|
}) {
|
|
11036
11081
|
if (debugObject.shape === "rect") {
|
|
11037
|
-
let [screenLeft, screenTop] =
|
|
11082
|
+
let [screenLeft, screenTop] = applyToPoint63(transform, [
|
|
11038
11083
|
debugObject.center.x - debugObject.size.width / 2,
|
|
11039
11084
|
debugObject.center.y - debugObject.size.height / 2
|
|
11040
11085
|
]);
|
|
11041
|
-
let [screenRight, screenBottom] =
|
|
11086
|
+
let [screenRight, screenBottom] = applyToPoint63(transform, [
|
|
11042
11087
|
debugObject.center.x + debugObject.size.width / 2,
|
|
11043
11088
|
debugObject.center.y + debugObject.size.height / 2
|
|
11044
11089
|
]);
|
|
@@ -11048,7 +11093,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11048
11093
|
];
|
|
11049
11094
|
const width = Math.abs(screenRight - screenLeft);
|
|
11050
11095
|
const height = Math.abs(screenBottom - screenTop);
|
|
11051
|
-
const [screenCenterX, screenCenterY] =
|
|
11096
|
+
const [screenCenterX, screenCenterY] = applyToPoint63(transform, [
|
|
11052
11097
|
debugObject.center.x,
|
|
11053
11098
|
debugObject.center.y
|
|
11054
11099
|
]);
|
|
@@ -11094,11 +11139,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11094
11139
|
];
|
|
11095
11140
|
}
|
|
11096
11141
|
if (debugObject.shape === "line") {
|
|
11097
|
-
const [screenStartX, screenStartY] =
|
|
11142
|
+
const [screenStartX, screenStartY] = applyToPoint63(transform, [
|
|
11098
11143
|
debugObject.start.x,
|
|
11099
11144
|
debugObject.start.y
|
|
11100
11145
|
]);
|
|
11101
|
-
const [screenEndX, screenEndY] =
|
|
11146
|
+
const [screenEndX, screenEndY] = applyToPoint63(transform, [
|
|
11102
11147
|
debugObject.end.x,
|
|
11103
11148
|
debugObject.end.y
|
|
11104
11149
|
]);
|
|
@@ -11148,7 +11193,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11148
11193
|
}
|
|
11149
11194
|
|
|
11150
11195
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
11151
|
-
import { applyToPoint as
|
|
11196
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
11152
11197
|
function createSchematicTrace({
|
|
11153
11198
|
trace,
|
|
11154
11199
|
transform,
|
|
@@ -11162,11 +11207,11 @@ function createSchematicTrace({
|
|
|
11162
11207
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
11163
11208
|
const edge = edges[edgeIndex];
|
|
11164
11209
|
if (edge.is_crossing) continue;
|
|
11165
|
-
const [screenFromX, screenFromY] =
|
|
11210
|
+
const [screenFromX, screenFromY] = applyToPoint64(transform, [
|
|
11166
11211
|
edge.from.x,
|
|
11167
11212
|
edge.from.y
|
|
11168
11213
|
]);
|
|
11169
|
-
const [screenToX, screenToY] =
|
|
11214
|
+
const [screenToX, screenToY] = applyToPoint64(transform, [
|
|
11170
11215
|
edge.to.x,
|
|
11171
11216
|
edge.to.y
|
|
11172
11217
|
]);
|
|
@@ -11210,11 +11255,11 @@ function createSchematicTrace({
|
|
|
11210
11255
|
}
|
|
11211
11256
|
for (const edge of edges) {
|
|
11212
11257
|
if (!edge.is_crossing) continue;
|
|
11213
|
-
const [screenFromX, screenFromY] =
|
|
11258
|
+
const [screenFromX, screenFromY] = applyToPoint64(transform, [
|
|
11214
11259
|
edge.from.x,
|
|
11215
11260
|
edge.from.y
|
|
11216
11261
|
]);
|
|
11217
|
-
const [screenToX, screenToY] =
|
|
11262
|
+
const [screenToX, screenToY] = applyToPoint64(transform, [
|
|
11218
11263
|
edge.to.x,
|
|
11219
11264
|
edge.to.y
|
|
11220
11265
|
]);
|
|
@@ -11258,7 +11303,7 @@ function createSchematicTrace({
|
|
|
11258
11303
|
}
|
|
11259
11304
|
if (trace.junctions) {
|
|
11260
11305
|
for (const junction of trace.junctions) {
|
|
11261
|
-
const [screenX, screenY] =
|
|
11306
|
+
const [screenX, screenY] = applyToPoint64(transform, [
|
|
11262
11307
|
junction.x,
|
|
11263
11308
|
junction.y
|
|
11264
11309
|
]);
|
|
@@ -11313,7 +11358,7 @@ function createSchematicTrace({
|
|
|
11313
11358
|
|
|
11314
11359
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
11315
11360
|
import {
|
|
11316
|
-
applyToPoint as
|
|
11361
|
+
applyToPoint as applyToPoint66,
|
|
11317
11362
|
compose as compose13,
|
|
11318
11363
|
rotate as rotate7,
|
|
11319
11364
|
scale as scale7,
|
|
@@ -11322,7 +11367,7 @@ import {
|
|
|
11322
11367
|
|
|
11323
11368
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
11324
11369
|
import {
|
|
11325
|
-
applyToPoint as
|
|
11370
|
+
applyToPoint as applyToPoint65,
|
|
11326
11371
|
compose as compose12,
|
|
11327
11372
|
rotate as rotate6,
|
|
11328
11373
|
scale as scale6,
|
|
@@ -11397,7 +11442,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11397
11442
|
x: symbolBounds.minX,
|
|
11398
11443
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
11399
11444
|
};
|
|
11400
|
-
const rotatedSymbolEnd =
|
|
11445
|
+
const rotatedSymbolEnd = applyToPoint65(rotationMatrix, symbolEndPoint);
|
|
11401
11446
|
const symbolToRealTransform = compose12(
|
|
11402
11447
|
translate12(
|
|
11403
11448
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -11407,11 +11452,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11407
11452
|
scale6(1)
|
|
11408
11453
|
// Use full symbol size
|
|
11409
11454
|
);
|
|
11410
|
-
const [screenMinX, screenMinY] =
|
|
11455
|
+
const [screenMinX, screenMinY] = applyToPoint65(
|
|
11411
11456
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11412
11457
|
[bounds.minX, bounds.minY]
|
|
11413
11458
|
);
|
|
11414
|
-
const [screenMaxX, screenMaxY] =
|
|
11459
|
+
const [screenMaxX, screenMaxY] = applyToPoint65(
|
|
11415
11460
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11416
11461
|
[bounds.maxX, bounds.maxY]
|
|
11417
11462
|
);
|
|
@@ -11435,7 +11480,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11435
11480
|
});
|
|
11436
11481
|
for (const path of symbolPaths) {
|
|
11437
11482
|
const symbolPath = path.points.map((p, i) => {
|
|
11438
|
-
const [x, y] =
|
|
11483
|
+
const [x, y] = applyToPoint65(
|
|
11439
11484
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11440
11485
|
[p.x, p.y]
|
|
11441
11486
|
);
|
|
@@ -11456,7 +11501,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11456
11501
|
});
|
|
11457
11502
|
}
|
|
11458
11503
|
for (const text of symbolTexts) {
|
|
11459
|
-
const screenTextPos =
|
|
11504
|
+
const screenTextPos = applyToPoint65(
|
|
11460
11505
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11461
11506
|
text
|
|
11462
11507
|
);
|
|
@@ -11498,7 +11543,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11498
11543
|
});
|
|
11499
11544
|
}
|
|
11500
11545
|
for (const box of symbolBoxes) {
|
|
11501
|
-
const screenBoxPos =
|
|
11546
|
+
const screenBoxPos = applyToPoint65(
|
|
11502
11547
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11503
11548
|
box
|
|
11504
11549
|
);
|
|
@@ -11521,7 +11566,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11521
11566
|
});
|
|
11522
11567
|
}
|
|
11523
11568
|
for (const circle of symbolCircles) {
|
|
11524
|
-
const screenCirclePos =
|
|
11569
|
+
const screenCirclePos = applyToPoint65(
|
|
11525
11570
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11526
11571
|
circle
|
|
11527
11572
|
);
|
|
@@ -11566,14 +11611,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11566
11611
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
11567
11612
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
11568
11613
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
11569
|
-
const screenCenter =
|
|
11614
|
+
const screenCenter = applyToPoint66(realToScreenTransform, schNetLabel.center);
|
|
11570
11615
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
11571
11616
|
schNetLabel.anchor_side
|
|
11572
11617
|
);
|
|
11573
11618
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
11574
11619
|
screenTextGrowthVec.y *= -1;
|
|
11575
11620
|
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 ?
|
|
11621
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint66(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
11577
11622
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
11578
11623
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
11579
11624
|
};
|
|
@@ -11614,7 +11659,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11614
11659
|
y: -0.6
|
|
11615
11660
|
}
|
|
11616
11661
|
].map(
|
|
11617
|
-
(fontRelativePoint) =>
|
|
11662
|
+
(fontRelativePoint) => applyToPoint66(
|
|
11618
11663
|
compose13(
|
|
11619
11664
|
realToScreenTransform,
|
|
11620
11665
|
translate13(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -11691,17 +11736,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11691
11736
|
};
|
|
11692
11737
|
|
|
11693
11738
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
11694
|
-
import { applyToPoint as
|
|
11739
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
11695
11740
|
var createSvgObjectsFromSchematicBox = ({
|
|
11696
11741
|
schematicBox,
|
|
11697
11742
|
transform,
|
|
11698
11743
|
colorMap: colorMap2
|
|
11699
11744
|
}) => {
|
|
11700
|
-
const topLeft =
|
|
11745
|
+
const topLeft = applyToPoint67(transform, {
|
|
11701
11746
|
x: schematicBox.x,
|
|
11702
11747
|
y: schematicBox.y
|
|
11703
11748
|
});
|
|
11704
|
-
const bottomRight =
|
|
11749
|
+
const bottomRight = applyToPoint67(transform, {
|
|
11705
11750
|
x: schematicBox.x + schematicBox.width,
|
|
11706
11751
|
y: schematicBox.y + schematicBox.height
|
|
11707
11752
|
});
|
|
@@ -11737,7 +11782,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
11737
11782
|
};
|
|
11738
11783
|
|
|
11739
11784
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
11740
|
-
import { applyToPoint as
|
|
11785
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
11741
11786
|
var createSvgObjectsFromSchematicTable = ({
|
|
11742
11787
|
schematicTable,
|
|
11743
11788
|
transform,
|
|
@@ -11770,11 +11815,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11770
11815
|
const svgObjects = [];
|
|
11771
11816
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
11772
11817
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
11773
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
11818
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint68(transform, [
|
|
11774
11819
|
topLeftX,
|
|
11775
11820
|
topLeftY
|
|
11776
11821
|
]);
|
|
11777
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
11822
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint68(transform, [
|
|
11778
11823
|
topLeftX + totalWidth,
|
|
11779
11824
|
topLeftY - totalHeight
|
|
11780
11825
|
]);
|
|
@@ -11806,8 +11851,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11806
11851
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
11807
11852
|
);
|
|
11808
11853
|
if (!isMerged) {
|
|
11809
|
-
const start =
|
|
11810
|
-
const end =
|
|
11854
|
+
const start = applyToPoint68(transform, { x: currentX, y: segmentStartY });
|
|
11855
|
+
const end = applyToPoint68(transform, { x: currentX, y: segmentEndY });
|
|
11811
11856
|
svgObjects.push({
|
|
11812
11857
|
name: "line",
|
|
11813
11858
|
type: "element",
|
|
@@ -11836,11 +11881,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11836
11881
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
11837
11882
|
);
|
|
11838
11883
|
if (!isMerged) {
|
|
11839
|
-
const start =
|
|
11884
|
+
const start = applyToPoint68(transform, {
|
|
11840
11885
|
x: segmentStartX,
|
|
11841
11886
|
y: currentY
|
|
11842
11887
|
});
|
|
11843
|
-
const end =
|
|
11888
|
+
const end = applyToPoint68(transform, { x: segmentEndX, y: currentY });
|
|
11844
11889
|
svgObjects.push({
|
|
11845
11890
|
name: "line",
|
|
11846
11891
|
type: "element",
|
|
@@ -11882,7 +11927,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11882
11927
|
} else if (vertical_align === "bottom") {
|
|
11883
11928
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
11884
11929
|
}
|
|
11885
|
-
const screenTextAnchorPos =
|
|
11930
|
+
const screenTextAnchorPos = applyToPoint68(transform, realTextAnchorPos);
|
|
11886
11931
|
const fontSize = getSchScreenFontSize(
|
|
11887
11932
|
transform,
|
|
11888
11933
|
"reference_designator",
|
|
@@ -11938,13 +11983,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11938
11983
|
|
|
11939
11984
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
11940
11985
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
11941
|
-
import { applyToPoint as
|
|
11986
|
+
import { applyToPoint as applyToPoint69 } from "transformation-matrix";
|
|
11942
11987
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
11943
11988
|
var createSvgObjectsForSchPortHover = ({
|
|
11944
11989
|
schPort,
|
|
11945
11990
|
transform
|
|
11946
11991
|
}) => {
|
|
11947
|
-
const screenSchPortPos =
|
|
11992
|
+
const screenSchPortPos = applyToPoint69(transform, schPort.center);
|
|
11948
11993
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
11949
11994
|
return [
|
|
11950
11995
|
{
|
|
@@ -11989,14 +12034,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
11989
12034
|
};
|
|
11990
12035
|
|
|
11991
12036
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
11992
|
-
import { applyToPoint as
|
|
12037
|
+
import { applyToPoint as applyToPoint70 } from "transformation-matrix";
|
|
11993
12038
|
function createSvgObjectsFromSchematicLine({
|
|
11994
12039
|
schLine,
|
|
11995
12040
|
transform,
|
|
11996
12041
|
colorMap: colorMap2
|
|
11997
12042
|
}) {
|
|
11998
|
-
const p1 =
|
|
11999
|
-
const p2 =
|
|
12043
|
+
const p1 = applyToPoint70(transform, { x: schLine.x1, y: schLine.y1 });
|
|
12044
|
+
const p2 = applyToPoint70(transform, { x: schLine.x2, y: schLine.y2 });
|
|
12000
12045
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
12001
12046
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
12002
12047
|
return [
|
|
@@ -12025,13 +12070,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
12025
12070
|
}
|
|
12026
12071
|
|
|
12027
12072
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
12028
|
-
import { applyToPoint as
|
|
12073
|
+
import { applyToPoint as applyToPoint71 } from "transformation-matrix";
|
|
12029
12074
|
function createSvgObjectsFromSchematicCircle({
|
|
12030
12075
|
schCircle,
|
|
12031
12076
|
transform,
|
|
12032
12077
|
colorMap: colorMap2
|
|
12033
12078
|
}) {
|
|
12034
|
-
const center =
|
|
12079
|
+
const center = applyToPoint71(transform, schCircle.center);
|
|
12035
12080
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
12036
12081
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
12037
12082
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -12061,13 +12106,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
12061
12106
|
}
|
|
12062
12107
|
|
|
12063
12108
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
12064
|
-
import { applyToPoint as
|
|
12109
|
+
import { applyToPoint as applyToPoint72 } from "transformation-matrix";
|
|
12065
12110
|
function createSvgObjectsFromSchematicRect({
|
|
12066
12111
|
schRect,
|
|
12067
12112
|
transform,
|
|
12068
12113
|
colorMap: colorMap2
|
|
12069
12114
|
}) {
|
|
12070
|
-
const center =
|
|
12115
|
+
const center = applyToPoint72(transform, schRect.center);
|
|
12071
12116
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
12072
12117
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
12073
12118
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -12103,13 +12148,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
12103
12148
|
}
|
|
12104
12149
|
|
|
12105
12150
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
12106
|
-
import { applyToPoint as
|
|
12151
|
+
import { applyToPoint as applyToPoint73 } from "transformation-matrix";
|
|
12107
12152
|
function createSvgObjectsFromSchematicArc({
|
|
12108
12153
|
schArc,
|
|
12109
12154
|
transform,
|
|
12110
12155
|
colorMap: colorMap2
|
|
12111
12156
|
}) {
|
|
12112
|
-
const center =
|
|
12157
|
+
const center = applyToPoint73(transform, schArc.center);
|
|
12113
12158
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
12114
12159
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
12115
12160
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -13229,18 +13274,18 @@ function formatNumber2(value) {
|
|
|
13229
13274
|
import { distance as distance3 } from "circuit-json";
|
|
13230
13275
|
import { stringify as stringify7 } from "svgson";
|
|
13231
13276
|
import {
|
|
13232
|
-
applyToPoint as
|
|
13277
|
+
applyToPoint as applyToPoint76,
|
|
13233
13278
|
compose as compose16,
|
|
13234
13279
|
scale as scale9,
|
|
13235
13280
|
translate as translate16
|
|
13236
13281
|
} from "transformation-matrix";
|
|
13237
13282
|
|
|
13238
13283
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
13239
|
-
import { applyToPoint as
|
|
13284
|
+
import { applyToPoint as applyToPoint75 } from "transformation-matrix";
|
|
13240
13285
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
13241
13286
|
const { transform, layer: layerFilter } = ctx;
|
|
13242
13287
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
13243
|
-
const [x, y] =
|
|
13288
|
+
const [x, y] = applyToPoint75(transform, [solderPaste.x, solderPaste.y]);
|
|
13244
13289
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
13245
13290
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
13246
13291
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -13466,8 +13511,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
13466
13511
|
}
|
|
13467
13512
|
}
|
|
13468
13513
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
13469
|
-
const [x1, y1] =
|
|
13470
|
-
const [x2, y2] =
|
|
13514
|
+
const [x1, y1] = applyToPoint76(transform, [minX, minY]);
|
|
13515
|
+
const [x2, y2] = applyToPoint76(transform, [maxX, maxY]);
|
|
13471
13516
|
const width = Math.abs(x2 - x1);
|
|
13472
13517
|
const height = Math.abs(y2 - y1);
|
|
13473
13518
|
const x = Math.min(x1, x2);
|