circuit-to-svg 0.0.306 → 0.0.308
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 +329 -189
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import "circuit-json";
|
|
3
3
|
import { stringify } from "svgson";
|
|
4
4
|
import {
|
|
5
|
-
applyToPoint as
|
|
5
|
+
applyToPoint as applyToPoint38,
|
|
6
6
|
compose as compose7,
|
|
7
7
|
scale as scale3,
|
|
8
8
|
translate as translate7
|
|
@@ -3274,6 +3274,49 @@ function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
|
|
|
3274
3274
|
return [svgObject];
|
|
3275
3275
|
}
|
|
3276
3276
|
|
|
3277
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-courtyard-polygon.ts
|
|
3278
|
+
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
3279
|
+
function createSvgObjectsFromPcbCourtyardPolygon(pcbCourtyardPolygon, ctx) {
|
|
3280
|
+
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
3281
|
+
const {
|
|
3282
|
+
layer = "top",
|
|
3283
|
+
pcb_courtyard_polygon_id,
|
|
3284
|
+
points,
|
|
3285
|
+
color
|
|
3286
|
+
} = pcbCourtyardPolygon;
|
|
3287
|
+
if (layerFilter && layer !== layerFilter) return [];
|
|
3288
|
+
if (!points || points.length === 0) {
|
|
3289
|
+
console.error("Invalid courtyard polygon data: no points", {
|
|
3290
|
+
pcb_courtyard_polygon_id
|
|
3291
|
+
});
|
|
3292
|
+
return [];
|
|
3293
|
+
}
|
|
3294
|
+
const transformedPoints = points.map(
|
|
3295
|
+
(p) => applyToPoint22(transform, [p.x, p.y])
|
|
3296
|
+
);
|
|
3297
|
+
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
3298
|
+
const transformedStrokeWidth = 0.05 * Math.abs(transform.a);
|
|
3299
|
+
const strokeColor = color ?? colorMap2.courtyard;
|
|
3300
|
+
const attributes = {
|
|
3301
|
+
points: pointsString,
|
|
3302
|
+
class: `pcb-courtyard-polygon pcb-courtyard-${layer}`,
|
|
3303
|
+
"data-pcb-courtyard-polygon-id": pcb_courtyard_polygon_id,
|
|
3304
|
+
"data-type": "pcb_courtyard_polygon",
|
|
3305
|
+
"data-pcb-layer": layer,
|
|
3306
|
+
fill: "none",
|
|
3307
|
+
stroke: strokeColor,
|
|
3308
|
+
"stroke-width": transformedStrokeWidth.toString()
|
|
3309
|
+
};
|
|
3310
|
+
const svgObject = {
|
|
3311
|
+
name: "polygon",
|
|
3312
|
+
type: "element",
|
|
3313
|
+
attributes,
|
|
3314
|
+
value: "",
|
|
3315
|
+
children: []
|
|
3316
|
+
};
|
|
3317
|
+
return [svgObject];
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3277
3320
|
// lib/utils/pairs.ts
|
|
3278
3321
|
function pairs(arr) {
|
|
3279
3322
|
const result = [];
|
|
@@ -3284,7 +3327,7 @@ function pairs(arr) {
|
|
|
3284
3327
|
}
|
|
3285
3328
|
|
|
3286
3329
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
|
|
3287
|
-
import { applyToPoint as
|
|
3330
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
3288
3331
|
function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
3289
3332
|
const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
|
|
3290
3333
|
if (!trace.route || !Array.isArray(trace.route) || trace.route.length < 2)
|
|
@@ -3292,8 +3335,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
3292
3335
|
const segments = pairs(trace.route);
|
|
3293
3336
|
const svgObjects = [];
|
|
3294
3337
|
for (const [start, end] of segments) {
|
|
3295
|
-
const startPoint =
|
|
3296
|
-
const endPoint =
|
|
3338
|
+
const startPoint = applyToPoint23(transform, [start.x, start.y]);
|
|
3339
|
+
const endPoint = applyToPoint23(transform, [end.x, end.y]);
|
|
3297
3340
|
const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
|
|
3298
3341
|
if (!layer) continue;
|
|
3299
3342
|
if (layerFilter && layer !== layerFilter) continue;
|
|
@@ -3348,7 +3391,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
3348
3391
|
}
|
|
3349
3392
|
|
|
3350
3393
|
// lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
|
|
3351
|
-
import { applyToPoint as
|
|
3394
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
3352
3395
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
3353
3396
|
const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
|
|
3354
3397
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
@@ -3359,7 +3402,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3359
3402
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
3360
3403
|
const width = pad.width * Math.abs(transform.a);
|
|
3361
3404
|
const height = pad.height * Math.abs(transform.d);
|
|
3362
|
-
const [x, y] =
|
|
3405
|
+
const [x, y] = applyToPoint24(transform, [pad.x, pad.y]);
|
|
3363
3406
|
const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
|
|
3364
3407
|
const scaledBorderRadius = cornerRadiusValue * Math.abs(transform.a);
|
|
3365
3408
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
@@ -3601,7 +3644,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3601
3644
|
const width = pad.width * Math.abs(transform.a);
|
|
3602
3645
|
const height = pad.height * Math.abs(transform.d);
|
|
3603
3646
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3604
|
-
const [x, y] =
|
|
3647
|
+
const [x, y] = applyToPoint24(transform, [pad.x, pad.y]);
|
|
3605
3648
|
const rotationTransformAttributes = isRotated ? {
|
|
3606
3649
|
transform: `translate(${x} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
|
|
3607
3650
|
} : void 0;
|
|
@@ -3719,7 +3762,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3719
3762
|
}
|
|
3720
3763
|
if (pad.shape === "circle") {
|
|
3721
3764
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3722
|
-
const [x, y] =
|
|
3765
|
+
const [x, y] = applyToPoint24(transform, [pad.x, pad.y]);
|
|
3723
3766
|
const padElement = {
|
|
3724
3767
|
name: "circle",
|
|
3725
3768
|
type: "element",
|
|
@@ -3809,7 +3852,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3809
3852
|
}
|
|
3810
3853
|
if (pad.shape === "polygon") {
|
|
3811
3854
|
const points = (pad.points ?? []).map(
|
|
3812
|
-
(point) =>
|
|
3855
|
+
(point) => applyToPoint24(transform, [point.x, point.y])
|
|
3813
3856
|
);
|
|
3814
3857
|
const padElement = {
|
|
3815
3858
|
name: "polygon",
|
|
@@ -3908,10 +3951,10 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3908
3951
|
}
|
|
3909
3952
|
|
|
3910
3953
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
|
|
3911
|
-
import { applyToPoint as
|
|
3954
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
3912
3955
|
|
|
3913
3956
|
// lib/utils/create-pcb-component-anchor-offset-indicators.ts
|
|
3914
|
-
import { applyToPoint as
|
|
3957
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
3915
3958
|
var OFFSET_THRESHOLD_MM = 0.05;
|
|
3916
3959
|
var TICK_SIZE_PX = 4;
|
|
3917
3960
|
var LABEL_GAP_PX = 8;
|
|
@@ -3938,11 +3981,11 @@ function createAnchorOffsetIndicators(params) {
|
|
|
3938
3981
|
displayYOffset
|
|
3939
3982
|
} = params;
|
|
3940
3983
|
const objects = [];
|
|
3941
|
-
const [screenGroupAnchorX, screenGroupAnchorY] =
|
|
3984
|
+
const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint25(transform, [
|
|
3942
3985
|
groupAnchorPosition.x,
|
|
3943
3986
|
groupAnchorPosition.y
|
|
3944
3987
|
]);
|
|
3945
|
-
const [screenComponentX, screenComponentY] =
|
|
3988
|
+
const [screenComponentX, screenComponentY] = applyToPoint25(transform, [
|
|
3946
3989
|
componentPosition.x,
|
|
3947
3990
|
componentPosition.y
|
|
3948
3991
|
]);
|
|
@@ -4293,25 +4336,25 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
4293
4336
|
let path;
|
|
4294
4337
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4295
4338
|
path = outline.map((point, index) => {
|
|
4296
|
-
const [x, y] =
|
|
4339
|
+
const [x, y] = applyToPoint26(transform, [point.x, point.y]);
|
|
4297
4340
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4298
4341
|
}).join(" ");
|
|
4299
4342
|
} else {
|
|
4300
4343
|
const halfWidth = width / 2;
|
|
4301
4344
|
const halfHeight = height / 2;
|
|
4302
|
-
const topLeft =
|
|
4345
|
+
const topLeft = applyToPoint26(transform, [
|
|
4303
4346
|
center.x - halfWidth,
|
|
4304
4347
|
center.y - halfHeight
|
|
4305
4348
|
]);
|
|
4306
|
-
const topRight =
|
|
4349
|
+
const topRight = applyToPoint26(transform, [
|
|
4307
4350
|
center.x + halfWidth,
|
|
4308
4351
|
center.y - halfHeight
|
|
4309
4352
|
]);
|
|
4310
|
-
const bottomRight =
|
|
4353
|
+
const bottomRight = applyToPoint26(transform, [
|
|
4311
4354
|
center.x + halfWidth,
|
|
4312
4355
|
center.y + halfHeight
|
|
4313
4356
|
]);
|
|
4314
|
-
const bottomLeft =
|
|
4357
|
+
const bottomLeft = applyToPoint26(transform, [
|
|
4315
4358
|
center.x - halfWidth,
|
|
4316
4359
|
center.y + halfHeight
|
|
4317
4360
|
]);
|
|
@@ -4378,7 +4421,7 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
4378
4421
|
}
|
|
4379
4422
|
|
|
4380
4423
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
|
|
4381
|
-
import { applyToPoint as
|
|
4424
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
4382
4425
|
function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
4383
4426
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
4384
4427
|
const width = Number(pcbPanel.width);
|
|
@@ -4386,19 +4429,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
4386
4429
|
const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
|
|
4387
4430
|
const halfWidth = width / 2;
|
|
4388
4431
|
const halfHeight = height / 2;
|
|
4389
|
-
const topLeft =
|
|
4432
|
+
const topLeft = applyToPoint27(transform, [
|
|
4390
4433
|
center.x - halfWidth,
|
|
4391
4434
|
center.y - halfHeight
|
|
4392
4435
|
]);
|
|
4393
|
-
const topRight =
|
|
4436
|
+
const topRight = applyToPoint27(transform, [
|
|
4394
4437
|
center.x + halfWidth,
|
|
4395
4438
|
center.y - halfHeight
|
|
4396
4439
|
]);
|
|
4397
|
-
const bottomRight =
|
|
4440
|
+
const bottomRight = applyToPoint27(transform, [
|
|
4398
4441
|
center.x + halfWidth,
|
|
4399
4442
|
center.y + halfHeight
|
|
4400
4443
|
]);
|
|
4401
|
-
const bottomLeft =
|
|
4444
|
+
const bottomLeft = applyToPoint27(transform, [
|
|
4402
4445
|
center.x - halfWidth,
|
|
4403
4446
|
center.y + halfHeight
|
|
4404
4447
|
]);
|
|
@@ -4427,10 +4470,10 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
4427
4470
|
}
|
|
4428
4471
|
|
|
4429
4472
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
4430
|
-
import { applyToPoint as
|
|
4473
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
4431
4474
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
4432
4475
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
4433
|
-
const [x, y] =
|
|
4476
|
+
const [x, y] = applyToPoint28(transform, [hole.x, hole.y]);
|
|
4434
4477
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
4435
4478
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
4436
4479
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -4476,11 +4519,11 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
4476
4519
|
}
|
|
4477
4520
|
|
|
4478
4521
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
4479
|
-
import { applyToPoint as
|
|
4522
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
4480
4523
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
4481
4524
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
4482
4525
|
const layer = ctx.layer ?? "top";
|
|
4483
|
-
const [x, y] =
|
|
4526
|
+
const [x, y] = applyToPoint29(transform, [hole.x, hole.y]);
|
|
4484
4527
|
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
4485
4528
|
const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
|
|
4486
4529
|
const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
|
|
@@ -4977,7 +5020,7 @@ import {
|
|
|
4977
5020
|
getFullConnectivityMapFromCircuitJson
|
|
4978
5021
|
} from "circuit-json-to-connectivity-map";
|
|
4979
5022
|
import "svgson";
|
|
4980
|
-
import { applyToPoint as
|
|
5023
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
4981
5024
|
|
|
4982
5025
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
4983
5026
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -5057,11 +5100,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
5057
5100
|
});
|
|
5058
5101
|
const svgObjects = [];
|
|
5059
5102
|
for (const line of ratsNestLines) {
|
|
5060
|
-
const transformedStart =
|
|
5103
|
+
const transformedStart = applyToPoint30(transform, [
|
|
5061
5104
|
line.startPoint.x,
|
|
5062
5105
|
line.startPoint.y
|
|
5063
5106
|
]);
|
|
5064
|
-
const transformedEnd =
|
|
5107
|
+
const transformedEnd = applyToPoint30(transform, [
|
|
5065
5108
|
line.endPoint.x,
|
|
5066
5109
|
line.endPoint.y
|
|
5067
5110
|
]);
|
|
@@ -5089,7 +5132,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
5089
5132
|
|
|
5090
5133
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
5091
5134
|
import {
|
|
5092
|
-
applyToPoint as
|
|
5135
|
+
applyToPoint as applyToPoint31,
|
|
5093
5136
|
compose as compose4,
|
|
5094
5137
|
rotate as rotate4,
|
|
5095
5138
|
translate as translate4,
|
|
@@ -5099,7 +5142,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5099
5142
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
5100
5143
|
if (cutout.shape === "rect") {
|
|
5101
5144
|
const rectCutout = cutout;
|
|
5102
|
-
const [cx, cy] =
|
|
5145
|
+
const [cx, cy] = applyToPoint31(transform, [
|
|
5103
5146
|
rectCutout.center.x,
|
|
5104
5147
|
rectCutout.center.y
|
|
5105
5148
|
]);
|
|
@@ -5141,7 +5184,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5141
5184
|
}
|
|
5142
5185
|
if (cutout.shape === "circle") {
|
|
5143
5186
|
const circleCutout = cutout;
|
|
5144
|
-
const [cx, cy] =
|
|
5187
|
+
const [cx, cy] = applyToPoint31(transform, [
|
|
5145
5188
|
circleCutout.center.x,
|
|
5146
5189
|
circleCutout.center.y
|
|
5147
5190
|
]);
|
|
@@ -5168,7 +5211,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5168
5211
|
const polygonCutout = cutout;
|
|
5169
5212
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
5170
5213
|
const transformedPoints = polygonCutout.points.map(
|
|
5171
|
-
(p) =>
|
|
5214
|
+
(p) => applyToPoint31(transform, [p.x, p.y])
|
|
5172
5215
|
);
|
|
5173
5216
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5174
5217
|
return [
|
|
@@ -5191,7 +5234,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5191
5234
|
}
|
|
5192
5235
|
|
|
5193
5236
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout-path.ts
|
|
5194
|
-
import { applyToPoint as
|
|
5237
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
5195
5238
|
function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
|
|
5196
5239
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
5197
5240
|
if (!cutoutPath.route || !Array.isArray(cutoutPath.route)) return [];
|
|
@@ -5199,7 +5242,7 @@ function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
|
|
|
5199
5242
|
const lastPoint = cutoutPath.route[cutoutPath.route.length - 1];
|
|
5200
5243
|
const isClosed = firstPoint && lastPoint && firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
|
|
5201
5244
|
const path = cutoutPath.route.slice(0, isClosed ? -1 : void 0).map((point, index) => {
|
|
5202
|
-
const [x, y] =
|
|
5245
|
+
const [x, y] = applyToPoint32(transform, [point.x, point.y]);
|
|
5203
5246
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5204
5247
|
}).join(" ") + (isClosed ? " Z" : "");
|
|
5205
5248
|
return [
|
|
@@ -5222,7 +5265,7 @@ function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
|
|
|
5222
5265
|
|
|
5223
5266
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-keepout.ts
|
|
5224
5267
|
import {
|
|
5225
|
-
applyToPoint as
|
|
5268
|
+
applyToPoint as applyToPoint33,
|
|
5226
5269
|
compose as compose5,
|
|
5227
5270
|
translate as translate5,
|
|
5228
5271
|
toString as matrixToString8
|
|
@@ -5239,7 +5282,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5239
5282
|
}
|
|
5240
5283
|
if (keepout.shape === "rect") {
|
|
5241
5284
|
const rectKeepout = keepout;
|
|
5242
|
-
const [cx, cy] =
|
|
5285
|
+
const [cx, cy] = applyToPoint33(transform, [
|
|
5243
5286
|
rectKeepout.center.x,
|
|
5244
5287
|
rectKeepout.center.y
|
|
5245
5288
|
]);
|
|
@@ -5273,7 +5316,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5273
5316
|
});
|
|
5274
5317
|
} else if (keepout.shape === "circle") {
|
|
5275
5318
|
const circleKeepout = keepout;
|
|
5276
|
-
const [cx, cy] =
|
|
5319
|
+
const [cx, cy] = applyToPoint33(transform, [
|
|
5277
5320
|
circleKeepout.center.x,
|
|
5278
5321
|
circleKeepout.center.y
|
|
5279
5322
|
]);
|
|
@@ -5309,7 +5352,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5309
5352
|
|
|
5310
5353
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
5311
5354
|
import {
|
|
5312
|
-
applyToPoint as
|
|
5355
|
+
applyToPoint as applyToPoint35,
|
|
5313
5356
|
compose as compose6,
|
|
5314
5357
|
rotate as rotate5,
|
|
5315
5358
|
toString as matrixToString9,
|
|
@@ -5317,11 +5360,11 @@ import {
|
|
|
5317
5360
|
} from "transformation-matrix";
|
|
5318
5361
|
|
|
5319
5362
|
// lib/utils/ring-to-path-d.ts
|
|
5320
|
-
import { applyToPoint as
|
|
5363
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
5321
5364
|
function ringToPathD(vertices, transform) {
|
|
5322
5365
|
if (vertices.length === 0) return "";
|
|
5323
5366
|
const transformedVertices = vertices.map((v) => {
|
|
5324
|
-
const [x, y] =
|
|
5367
|
+
const [x, y] = applyToPoint34(transform, [v.x, v.y]);
|
|
5325
5368
|
return { ...v, x, y };
|
|
5326
5369
|
});
|
|
5327
5370
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -5410,7 +5453,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5410
5453
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
5411
5454
|
const maskOverlayOpacity = "0.9";
|
|
5412
5455
|
if (pour.shape === "rect") {
|
|
5413
|
-
const [cx, cy] =
|
|
5456
|
+
const [cx, cy] = applyToPoint35(transform, [pour.center.x, pour.center.y]);
|
|
5414
5457
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
5415
5458
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
5416
5459
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -5462,7 +5505,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5462
5505
|
if (pour.shape === "polygon") {
|
|
5463
5506
|
if (!pour.points || pour.points.length === 0) return [];
|
|
5464
5507
|
const transformedPoints = pour.points.map(
|
|
5465
|
-
(p) =>
|
|
5508
|
+
(p) => applyToPoint35(transform, [p.x, p.y])
|
|
5466
5509
|
);
|
|
5467
5510
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5468
5511
|
const copperPolygon = {
|
|
@@ -5685,11 +5728,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
5685
5728
|
}
|
|
5686
5729
|
|
|
5687
5730
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
5688
|
-
import { applyToPoint as
|
|
5731
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
5689
5732
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
5690
5733
|
const { transform, circuitJson } = ctx;
|
|
5691
5734
|
const { center, width, height, rotation = 0 } = component;
|
|
5692
|
-
const [x, y] =
|
|
5735
|
+
const [x, y] = applyToPoint36(transform, [center.x, center.y]);
|
|
5693
5736
|
const scaledWidth = width * Math.abs(transform.a);
|
|
5694
5737
|
const scaledHeight = height * Math.abs(transform.d);
|
|
5695
5738
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -5761,7 +5804,7 @@ function getParentAnchorPosition(component, circuitJson) {
|
|
|
5761
5804
|
}
|
|
5762
5805
|
|
|
5763
5806
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
5764
|
-
import { applyToPoint as
|
|
5807
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
5765
5808
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
5766
5809
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
5767
5810
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -5805,7 +5848,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5805
5848
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
5806
5849
|
)) {
|
|
5807
5850
|
const path = outline.map((point, index) => {
|
|
5808
|
-
const [x, y] =
|
|
5851
|
+
const [x, y] = applyToPoint37(transform, [point.x, point.y]);
|
|
5809
5852
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5810
5853
|
}).join(" ");
|
|
5811
5854
|
svgObjects.push({
|
|
@@ -5826,11 +5869,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5826
5869
|
}
|
|
5827
5870
|
const halfWidth = width / 2;
|
|
5828
5871
|
const halfHeight = height / 2;
|
|
5829
|
-
const [topLeftX, topLeftY] =
|
|
5872
|
+
const [topLeftX, topLeftY] = applyToPoint37(transform, [
|
|
5830
5873
|
center.x - halfWidth,
|
|
5831
5874
|
center.y + halfHeight
|
|
5832
5875
|
]);
|
|
5833
|
-
const [bottomRightX, bottomRightY] =
|
|
5876
|
+
const [bottomRightX, bottomRightY] = applyToPoint37(transform, [
|
|
5834
5877
|
center.x + halfWidth,
|
|
5835
5878
|
center.y - halfHeight
|
|
5836
5879
|
]);
|
|
@@ -5884,7 +5927,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5884
5927
|
var package_default = {
|
|
5885
5928
|
name: "circuit-to-svg",
|
|
5886
5929
|
type: "module",
|
|
5887
|
-
version: "0.0.
|
|
5930
|
+
version: "0.0.307",
|
|
5888
5931
|
description: "Convert Circuit JSON to SVG",
|
|
5889
5932
|
main: "dist/index.js",
|
|
5890
5933
|
files: [
|
|
@@ -5907,7 +5950,7 @@ var package_default = {
|
|
|
5907
5950
|
"@vitejs/plugin-react": "5.0.0",
|
|
5908
5951
|
biome: "^0.3.3",
|
|
5909
5952
|
"bun-match-svg": "^0.0.12",
|
|
5910
|
-
"circuit-json": "^0.0.
|
|
5953
|
+
"circuit-json": "^0.0.351",
|
|
5911
5954
|
esbuild: "^0.20.2",
|
|
5912
5955
|
"performance-now": "^2.1.0",
|
|
5913
5956
|
react: "19.1.0",
|
|
@@ -6139,6 +6182,100 @@ function getPcbBoundsFromCircuitJson(circuitJson) {
|
|
|
6139
6182
|
width: circuitJsonElm.width,
|
|
6140
6183
|
height: circuitJsonElm.height
|
|
6141
6184
|
});
|
|
6185
|
+
} else if (circuitJsonElm.type === "pcb_note_dimension" || circuitJsonElm.type === "pcb_fabrication_note_dimension") {
|
|
6186
|
+
const dimension = circuitJsonElm;
|
|
6187
|
+
const {
|
|
6188
|
+
from,
|
|
6189
|
+
to,
|
|
6190
|
+
text,
|
|
6191
|
+
font_size = 1,
|
|
6192
|
+
arrow_size,
|
|
6193
|
+
offset_distance,
|
|
6194
|
+
offset_direction
|
|
6195
|
+
} = dimension;
|
|
6196
|
+
if (!from || !to || !arrow_size) continue;
|
|
6197
|
+
updateBounds({ center: from, width: 0, height: 0 });
|
|
6198
|
+
updateBounds({ center: to, width: 0, height: 0 });
|
|
6199
|
+
const normalize3 = (v) => {
|
|
6200
|
+
const l = Math.hypot(v.x, v.y) || 1;
|
|
6201
|
+
return { x: v.x / l, y: v.y / l };
|
|
6202
|
+
};
|
|
6203
|
+
const direction = normalize3({ x: to.x - from.x, y: to.y - from.y });
|
|
6204
|
+
if (Number.isNaN(direction.x) || Number.isNaN(direction.y)) continue;
|
|
6205
|
+
const perpendicular = { x: -direction.y, y: direction.x };
|
|
6206
|
+
const hasOffsetDirection = offset_direction && typeof offset_direction.x === "number" && typeof offset_direction.y === "number";
|
|
6207
|
+
const normalizedOffsetDirection = hasOffsetDirection ? normalize3(offset_direction) : { x: 0, y: 0 };
|
|
6208
|
+
const offsetMagnitude = typeof offset_distance === "number" ? offset_distance : 0;
|
|
6209
|
+
const offsetVector = {
|
|
6210
|
+
x: normalizedOffsetDirection.x * offsetMagnitude,
|
|
6211
|
+
y: normalizedOffsetDirection.y * offsetMagnitude
|
|
6212
|
+
};
|
|
6213
|
+
const fromOffset = {
|
|
6214
|
+
x: from.x + offsetVector.x,
|
|
6215
|
+
y: from.y + offsetVector.y
|
|
6216
|
+
};
|
|
6217
|
+
const toOffset = { x: to.x + offsetVector.x, y: to.y + offsetVector.y };
|
|
6218
|
+
updateBounds({ center: fromOffset, width: 0, height: 0 });
|
|
6219
|
+
updateBounds({ center: toOffset, width: 0, height: 0 });
|
|
6220
|
+
const extensionDirection = hasOffsetDirection && (Math.abs(normalizedOffsetDirection.x) > Number.EPSILON || Math.abs(normalizedOffsetDirection.y) > Number.EPSILON) ? normalizedOffsetDirection : perpendicular;
|
|
6221
|
+
const extensionLength = offsetMagnitude + arrow_size;
|
|
6222
|
+
const fromExtEnd = {
|
|
6223
|
+
x: from.x + extensionDirection.x * extensionLength,
|
|
6224
|
+
y: from.y + extensionDirection.y * extensionLength
|
|
6225
|
+
};
|
|
6226
|
+
const toExtEnd = {
|
|
6227
|
+
x: to.x + extensionDirection.x * extensionLength,
|
|
6228
|
+
y: to.y + extensionDirection.y * extensionLength
|
|
6229
|
+
};
|
|
6230
|
+
updateBounds({ center: fromExtEnd, width: 0, height: 0 });
|
|
6231
|
+
updateBounds({ center: toExtEnd, width: 0, height: 0 });
|
|
6232
|
+
const arrowHalfWidth = arrow_size / 2;
|
|
6233
|
+
const fromBase = {
|
|
6234
|
+
x: fromOffset.x + direction.x * arrow_size,
|
|
6235
|
+
y: fromOffset.y + direction.y * arrow_size
|
|
6236
|
+
};
|
|
6237
|
+
const toBase = {
|
|
6238
|
+
x: toOffset.x - direction.x * arrow_size,
|
|
6239
|
+
y: toOffset.y - direction.y * arrow_size
|
|
6240
|
+
};
|
|
6241
|
+
const fromArrowP2 = {
|
|
6242
|
+
x: fromBase.x + perpendicular.x * arrowHalfWidth,
|
|
6243
|
+
y: fromBase.y + perpendicular.y * arrowHalfWidth
|
|
6244
|
+
};
|
|
6245
|
+
const fromArrowP3 = {
|
|
6246
|
+
x: fromBase.x - perpendicular.x * arrowHalfWidth,
|
|
6247
|
+
y: fromBase.y - perpendicular.y * arrowHalfWidth
|
|
6248
|
+
};
|
|
6249
|
+
updateBounds({ center: fromArrowP2, width: 0, height: 0 });
|
|
6250
|
+
updateBounds({ center: fromArrowP3, width: 0, height: 0 });
|
|
6251
|
+
const toArrowP2 = {
|
|
6252
|
+
x: toBase.x + perpendicular.x * arrowHalfWidth,
|
|
6253
|
+
y: toBase.y + perpendicular.y * arrowHalfWidth
|
|
6254
|
+
};
|
|
6255
|
+
const toArrowP3 = {
|
|
6256
|
+
x: toBase.x - perpendicular.x * arrowHalfWidth,
|
|
6257
|
+
y: toBase.y - perpendicular.y * arrowHalfWidth
|
|
6258
|
+
};
|
|
6259
|
+
updateBounds({ center: toArrowP2, width: 0, height: 0 });
|
|
6260
|
+
updateBounds({ center: toArrowP3, width: 0, height: 0 });
|
|
6261
|
+
if (text) {
|
|
6262
|
+
const midPoint = {
|
|
6263
|
+
x: (from.x + to.x) / 2 + offsetVector.x,
|
|
6264
|
+
y: (from.y + to.y) / 2 + offsetVector.y
|
|
6265
|
+
};
|
|
6266
|
+
const textOffset = arrow_size * 1.5;
|
|
6267
|
+
const textPoint = {
|
|
6268
|
+
x: midPoint.x + perpendicular.x * textOffset,
|
|
6269
|
+
y: midPoint.y + perpendicular.y * textOffset
|
|
6270
|
+
};
|
|
6271
|
+
const textWidth = text.length * font_size * 0.6;
|
|
6272
|
+
const textHeight = font_size;
|
|
6273
|
+
updateBounds({
|
|
6274
|
+
center: textPoint,
|
|
6275
|
+
width: textWidth,
|
|
6276
|
+
height: textHeight
|
|
6277
|
+
});
|
|
6278
|
+
}
|
|
6142
6279
|
} else if (circuitJsonElm.type === "pcb_cutout") {
|
|
6143
6280
|
const cutout = circuitJsonElm;
|
|
6144
6281
|
if (cutout.shape === "rect") {
|
|
@@ -6617,6 +6754,9 @@ function createSvgObjects({
|
|
|
6617
6754
|
case "pcb_courtyard_rect":
|
|
6618
6755
|
if (!ctx.showCourtyards) return [];
|
|
6619
6756
|
return createSvgObjectsFromPcbCourtyardRect(elm, ctx);
|
|
6757
|
+
case "pcb_courtyard_polygon":
|
|
6758
|
+
if (!ctx.showCourtyards) return [];
|
|
6759
|
+
return createSvgObjectsFromPcbCourtyardPolygon(elm, ctx);
|
|
6620
6760
|
case "pcb_fabrication_note_path":
|
|
6621
6761
|
return createSvgObjectsFromPcbFabricationNotePath(elm, ctx);
|
|
6622
6762
|
case "pcb_fabrication_note_text":
|
|
@@ -6661,8 +6801,8 @@ function createSvgObjects({
|
|
|
6661
6801
|
}
|
|
6662
6802
|
}
|
|
6663
6803
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
6664
|
-
const [x1, y1] =
|
|
6665
|
-
const [x2, y2] =
|
|
6804
|
+
const [x1, y1] = applyToPoint38(transform, [minX, minY]);
|
|
6805
|
+
const [x2, y2] = applyToPoint38(transform, [maxX, maxY]);
|
|
6666
6806
|
const width = Math.abs(x2 - x1);
|
|
6667
6807
|
const height = Math.abs(y2 - y1);
|
|
6668
6808
|
const x = Math.min(x1, x2);
|
|
@@ -6692,14 +6832,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
6692
6832
|
import { stringify as stringify2 } from "svgson";
|
|
6693
6833
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
6694
6834
|
import {
|
|
6695
|
-
applyToPoint as
|
|
6835
|
+
applyToPoint as applyToPoint45,
|
|
6696
6836
|
compose as compose8,
|
|
6697
6837
|
scale as scale4,
|
|
6698
6838
|
translate as translate8
|
|
6699
6839
|
} from "transformation-matrix";
|
|
6700
6840
|
|
|
6701
6841
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
6702
|
-
import { applyToPoint as
|
|
6842
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
6703
6843
|
var DEFAULT_BOARD_STYLE = {
|
|
6704
6844
|
fill: "none",
|
|
6705
6845
|
stroke: "rgb(0,0,0)",
|
|
@@ -6711,25 +6851,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6711
6851
|
let path;
|
|
6712
6852
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
6713
6853
|
path = outline.map((point, index) => {
|
|
6714
|
-
const [x, y] =
|
|
6854
|
+
const [x, y] = applyToPoint39(transform, [point.x, point.y]);
|
|
6715
6855
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
6716
6856
|
}).join(" ");
|
|
6717
6857
|
} else {
|
|
6718
6858
|
const halfWidth = width / 2;
|
|
6719
6859
|
const halfHeight = height / 2;
|
|
6720
|
-
const topLeft =
|
|
6860
|
+
const topLeft = applyToPoint39(transform, [
|
|
6721
6861
|
center.x - halfWidth,
|
|
6722
6862
|
center.y - halfHeight
|
|
6723
6863
|
]);
|
|
6724
|
-
const topRight =
|
|
6864
|
+
const topRight = applyToPoint39(transform, [
|
|
6725
6865
|
center.x + halfWidth,
|
|
6726
6866
|
center.y - halfHeight
|
|
6727
6867
|
]);
|
|
6728
|
-
const bottomRight =
|
|
6868
|
+
const bottomRight = applyToPoint39(transform, [
|
|
6729
6869
|
center.x + halfWidth,
|
|
6730
6870
|
center.y + halfHeight
|
|
6731
6871
|
]);
|
|
6732
|
-
const bottomLeft =
|
|
6872
|
+
const bottomLeft = applyToPoint39(transform, [
|
|
6733
6873
|
center.x - halfWidth,
|
|
6734
6874
|
center.y + halfHeight
|
|
6735
6875
|
]);
|
|
@@ -6755,7 +6895,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6755
6895
|
}
|
|
6756
6896
|
|
|
6757
6897
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
6758
|
-
import { applyToPoint as
|
|
6898
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
6759
6899
|
|
|
6760
6900
|
// lib/utils/get-sch-font-size.ts
|
|
6761
6901
|
import "transformation-matrix";
|
|
@@ -6781,8 +6921,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
6781
6921
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
6782
6922
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
6783
6923
|
return null;
|
|
6784
|
-
const [x, y] =
|
|
6785
|
-
const [pinX, pinY] =
|
|
6924
|
+
const [x, y] = applyToPoint41(transform, [center.x, center.y]);
|
|
6925
|
+
const [pinX, pinY] = applyToPoint41(transform, [portPosition.x, portPosition.y]);
|
|
6786
6926
|
const scaledWidth = width * Math.abs(transform.a);
|
|
6787
6927
|
const scaledHeight = height * Math.abs(transform.d);
|
|
6788
6928
|
const isTopLayer = layer === "top";
|
|
@@ -6944,11 +7084,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
6944
7084
|
}
|
|
6945
7085
|
|
|
6946
7086
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
6947
|
-
import { applyToPoint as
|
|
7087
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
6948
7088
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
6949
7089
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
6950
7090
|
const { transform } = ctx;
|
|
6951
|
-
const [x, y] =
|
|
7091
|
+
const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
|
|
6952
7092
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
6953
7093
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
6954
7094
|
const radius = scaledDiameter / 2;
|
|
@@ -7012,12 +7152,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
7012
7152
|
}
|
|
7013
7153
|
|
|
7014
7154
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
7015
|
-
import { applyToPoint as
|
|
7155
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
7016
7156
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
7017
7157
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
7018
7158
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
7019
7159
|
const { transform } = ctx;
|
|
7020
|
-
const [x, y] =
|
|
7160
|
+
const [x, y] = applyToPoint43(transform, [hole.x, hole.y]);
|
|
7021
7161
|
if (hole.shape === "pill") {
|
|
7022
7162
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
7023
7163
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -7112,7 +7252,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7112
7252
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
7113
7253
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
7114
7254
|
const holeRadius = scaledHoleDiameter / 2;
|
|
7115
|
-
const [holeCx, holeCy] =
|
|
7255
|
+
const [holeCx, holeCy] = applyToPoint43(transform, [
|
|
7116
7256
|
circularHole.x + circularHole.hole_offset_x,
|
|
7117
7257
|
circularHole.y + circularHole.hole_offset_y
|
|
7118
7258
|
]);
|
|
@@ -7170,7 +7310,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7170
7310
|
const pillHoleWithOffsets = pillHole;
|
|
7171
7311
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
7172
7312
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
7173
|
-
const [holeCenterX, holeCenterY] =
|
|
7313
|
+
const [holeCenterX, holeCenterY] = applyToPoint43(transform, [
|
|
7174
7314
|
pillHole.x + holeOffsetX,
|
|
7175
7315
|
pillHole.y + holeOffsetY
|
|
7176
7316
|
]);
|
|
@@ -7232,7 +7372,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7232
7372
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
7233
7373
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
7234
7374
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
7235
|
-
const [holeCenterX, holeCenterY] =
|
|
7375
|
+
const [holeCenterX, holeCenterY] = applyToPoint43(transform, [
|
|
7236
7376
|
rotatedHole.x + holeOffsetX,
|
|
7237
7377
|
rotatedHole.y + holeOffsetY
|
|
7238
7378
|
]);
|
|
@@ -7288,14 +7428,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7288
7428
|
}
|
|
7289
7429
|
|
|
7290
7430
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
7291
|
-
import { applyToPoint as
|
|
7431
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
7292
7432
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
7293
7433
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
7294
7434
|
const { transform } = ctx;
|
|
7295
7435
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7296
7436
|
const width = pad.width * Math.abs(transform.a);
|
|
7297
7437
|
const height = pad.height * Math.abs(transform.d);
|
|
7298
|
-
const [x, y] =
|
|
7438
|
+
const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
|
|
7299
7439
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
7300
7440
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7301
7441
|
return [
|
|
@@ -7347,7 +7487,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7347
7487
|
const width = pad.width * Math.abs(transform.a);
|
|
7348
7488
|
const height = pad.height * Math.abs(transform.d);
|
|
7349
7489
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7350
|
-
const [x, y] =
|
|
7490
|
+
const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
|
|
7351
7491
|
return [
|
|
7352
7492
|
{
|
|
7353
7493
|
name: "rect",
|
|
@@ -7370,7 +7510,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7370
7510
|
}
|
|
7371
7511
|
if (pad.shape === "circle") {
|
|
7372
7512
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7373
|
-
const [x, y] =
|
|
7513
|
+
const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
|
|
7374
7514
|
return [
|
|
7375
7515
|
{
|
|
7376
7516
|
name: "circle",
|
|
@@ -7390,7 +7530,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7390
7530
|
}
|
|
7391
7531
|
if (pad.shape === "polygon") {
|
|
7392
7532
|
const points = (pad.points ?? []).map(
|
|
7393
|
-
(point) =>
|
|
7533
|
+
(point) => applyToPoint44(transform, [point.x, point.y])
|
|
7394
7534
|
);
|
|
7395
7535
|
return [
|
|
7396
7536
|
{
|
|
@@ -7574,8 +7714,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
7574
7714
|
}
|
|
7575
7715
|
}
|
|
7576
7716
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
7577
|
-
const [x1, y1] =
|
|
7578
|
-
const [x2, y2] =
|
|
7717
|
+
const [x1, y1] = applyToPoint45(transform, [minX, minY]);
|
|
7718
|
+
const [x2, y2] = applyToPoint45(transform, [maxX, maxY]);
|
|
7579
7719
|
const width = Math.abs(x2 - x1);
|
|
7580
7720
|
const height = Math.abs(y2 - y1);
|
|
7581
7721
|
const x = Math.min(x1, x2);
|
|
@@ -7604,7 +7744,7 @@ import {
|
|
|
7604
7744
|
} from "transformation-matrix";
|
|
7605
7745
|
|
|
7606
7746
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
7607
|
-
import { applyToPoint as
|
|
7747
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
7608
7748
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
7609
7749
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
7610
7750
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -7618,25 +7758,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7618
7758
|
let path;
|
|
7619
7759
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
7620
7760
|
path = outline.map((point, index) => {
|
|
7621
|
-
const [x, y] =
|
|
7761
|
+
const [x, y] = applyToPoint46(transform, [point.x, point.y]);
|
|
7622
7762
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
7623
7763
|
}).join(" ");
|
|
7624
7764
|
} else {
|
|
7625
7765
|
const halfWidth = width / 2;
|
|
7626
7766
|
const halfHeight = height / 2;
|
|
7627
|
-
const topLeft =
|
|
7767
|
+
const topLeft = applyToPoint46(transform, [
|
|
7628
7768
|
center.x - halfWidth,
|
|
7629
7769
|
center.y - halfHeight
|
|
7630
7770
|
]);
|
|
7631
|
-
const topRight =
|
|
7771
|
+
const topRight = applyToPoint46(transform, [
|
|
7632
7772
|
center.x + halfWidth,
|
|
7633
7773
|
center.y - halfHeight
|
|
7634
7774
|
]);
|
|
7635
|
-
const bottomRight =
|
|
7775
|
+
const bottomRight = applyToPoint46(transform, [
|
|
7636
7776
|
center.x + halfWidth,
|
|
7637
7777
|
center.y + halfHeight
|
|
7638
7778
|
]);
|
|
7639
|
-
const bottomLeft =
|
|
7779
|
+
const bottomLeft = applyToPoint46(transform, [
|
|
7640
7780
|
center.x - halfWidth,
|
|
7641
7781
|
center.y + halfHeight
|
|
7642
7782
|
]);
|
|
@@ -7654,10 +7794,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7654
7794
|
const halfWidth = width2 / 2;
|
|
7655
7795
|
const halfHeight = height2 / 2;
|
|
7656
7796
|
const [tl, tr, br, bl] = [
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7797
|
+
applyToPoint46(transform, [x - halfWidth, y - halfHeight]),
|
|
7798
|
+
applyToPoint46(transform, [x + halfWidth, y - halfHeight]),
|
|
7799
|
+
applyToPoint46(transform, [x + halfWidth, y + halfHeight]),
|
|
7800
|
+
applyToPoint46(transform, [x - halfWidth, y + halfHeight])
|
|
7661
7801
|
];
|
|
7662
7802
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
7663
7803
|
} else if (cutout.shape === "circle") {
|
|
@@ -7707,7 +7847,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7707
7847
|
|
|
7708
7848
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
7709
7849
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
7710
|
-
import { applyToPoint as
|
|
7850
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7711
7851
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
7712
7852
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
7713
7853
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -7717,7 +7857,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7717
7857
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
7718
7858
|
return [];
|
|
7719
7859
|
}
|
|
7720
|
-
const [x, y] =
|
|
7860
|
+
const [x, y] = applyToPoint47(transform, [center.x, center.y]);
|
|
7721
7861
|
const scaledWidth = width * Math.abs(transform.a);
|
|
7722
7862
|
const scaledHeight = height * Math.abs(transform.d);
|
|
7723
7863
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -7778,11 +7918,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7778
7918
|
}
|
|
7779
7919
|
|
|
7780
7920
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
7781
|
-
import { applyToPoint as
|
|
7921
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7782
7922
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
7783
7923
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
7784
7924
|
const { transform } = ctx;
|
|
7785
|
-
const [x, y] =
|
|
7925
|
+
const [x, y] = applyToPoint48(transform, [hole.x, hole.y]);
|
|
7786
7926
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
7787
7927
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
7788
7928
|
const radius = scaledDiameter / 2;
|
|
@@ -7846,12 +7986,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
7846
7986
|
}
|
|
7847
7987
|
|
|
7848
7988
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
7849
|
-
import { applyToPoint as
|
|
7989
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7850
7990
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
7851
7991
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
7852
7992
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
7853
7993
|
const { transform } = ctx;
|
|
7854
|
-
const [x, y] =
|
|
7994
|
+
const [x, y] = applyToPoint49(transform, [hole.x, hole.y]);
|
|
7855
7995
|
if (hole.shape === "pill") {
|
|
7856
7996
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
7857
7997
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -8086,14 +8226,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
8086
8226
|
}
|
|
8087
8227
|
|
|
8088
8228
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
8089
|
-
import { applyToPoint as
|
|
8229
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
8090
8230
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
8091
8231
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
8092
8232
|
const { transform } = ctx;
|
|
8093
8233
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
8094
8234
|
const width = pad.width * Math.abs(transform.a);
|
|
8095
8235
|
const height = pad.height * Math.abs(transform.d);
|
|
8096
|
-
const [x, y] =
|
|
8236
|
+
const [x, y] = applyToPoint50(transform, [pad.x, pad.y]);
|
|
8097
8237
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
8098
8238
|
return [
|
|
8099
8239
|
{
|
|
@@ -8136,7 +8276,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8136
8276
|
const width = pad.width * Math.abs(transform.a);
|
|
8137
8277
|
const height = pad.height * Math.abs(transform.d);
|
|
8138
8278
|
const radius = pad.radius * Math.abs(transform.a);
|
|
8139
|
-
const [x, y] =
|
|
8279
|
+
const [x, y] = applyToPoint50(transform, [pad.x, pad.y]);
|
|
8140
8280
|
return [
|
|
8141
8281
|
{
|
|
8142
8282
|
name: "rect",
|
|
@@ -8159,7 +8299,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8159
8299
|
}
|
|
8160
8300
|
if (pad.shape === "circle") {
|
|
8161
8301
|
const radius = pad.radius * Math.abs(transform.a);
|
|
8162
|
-
const [x, y] =
|
|
8302
|
+
const [x, y] = applyToPoint50(transform, [pad.x, pad.y]);
|
|
8163
8303
|
return [
|
|
8164
8304
|
{
|
|
8165
8305
|
name: "circle",
|
|
@@ -8179,7 +8319,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8179
8319
|
}
|
|
8180
8320
|
if (pad.shape === "polygon") {
|
|
8181
8321
|
const points = (pad.points ?? []).map(
|
|
8182
|
-
(point) =>
|
|
8322
|
+
(point) => applyToPoint50(transform, [point.x, point.y])
|
|
8183
8323
|
);
|
|
8184
8324
|
return [
|
|
8185
8325
|
{
|
|
@@ -8200,7 +8340,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
8200
8340
|
}
|
|
8201
8341
|
|
|
8202
8342
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
8203
|
-
import { applyToPoint as
|
|
8343
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
8204
8344
|
import { calculateElbow } from "calculate-elbow";
|
|
8205
8345
|
|
|
8206
8346
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -8277,7 +8417,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8277
8417
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
8278
8418
|
if (!label_info) return [];
|
|
8279
8419
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
8280
|
-
const [port_x, port_y] =
|
|
8420
|
+
const [port_x, port_y] = applyToPoint51(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
8281
8421
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
8282
8422
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
8283
8423
|
const elbow_path = calculateElbow(
|
|
@@ -8418,7 +8558,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8418
8558
|
}
|
|
8419
8559
|
|
|
8420
8560
|
// lib/pinout/calculate-label-positions.ts
|
|
8421
|
-
import { applyToPoint as
|
|
8561
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
8422
8562
|
|
|
8423
8563
|
// lib/pinout/constants.ts
|
|
8424
8564
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -8456,7 +8596,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8456
8596
|
);
|
|
8457
8597
|
const mapToEdgePort = (pinout_label) => ({
|
|
8458
8598
|
pcb_port: pinout_label.pcb_port,
|
|
8459
|
-
y:
|
|
8599
|
+
y: applyToPoint52(transform, [
|
|
8460
8600
|
pinout_label.pcb_port.x,
|
|
8461
8601
|
pinout_label.pcb_port.y
|
|
8462
8602
|
])[1],
|
|
@@ -8471,7 +8611,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8471
8611
|
} else {
|
|
8472
8612
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
8473
8613
|
pcb_port: pinout_label.pcb_port,
|
|
8474
|
-
y:
|
|
8614
|
+
y: applyToPoint52(transform, [
|
|
8475
8615
|
pinout_label.pcb_port.x,
|
|
8476
8616
|
pinout_label.pcb_port.y
|
|
8477
8617
|
])[1],
|
|
@@ -8479,7 +8619,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8479
8619
|
})).sort((a, b) => a.y - b.y);
|
|
8480
8620
|
}
|
|
8481
8621
|
if (edge_ports.length === 0) return;
|
|
8482
|
-
const board_edge_x =
|
|
8622
|
+
const board_edge_x = applyToPoint52(transform, [
|
|
8483
8623
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
8484
8624
|
0
|
|
8485
8625
|
])[0];
|
|
@@ -8901,14 +9041,14 @@ import {
|
|
|
8901
9041
|
} from "transformation-matrix";
|
|
8902
9042
|
|
|
8903
9043
|
// lib/sch/draw-schematic-grid.ts
|
|
8904
|
-
import { applyToPoint as
|
|
9044
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
8905
9045
|
function drawSchematicGrid(params) {
|
|
8906
9046
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
8907
9047
|
const cellSize = params.cellSize ?? 1;
|
|
8908
9048
|
const labelCells = params.labelCells ?? false;
|
|
8909
9049
|
const gridLines = [];
|
|
8910
9050
|
const transformPoint = (x, y) => {
|
|
8911
|
-
const [transformedX, transformedY] =
|
|
9051
|
+
const [transformedX, transformedY] = applyToPoint53(params.transform, [x, y]);
|
|
8912
9052
|
return { x: transformedX, y: transformedY };
|
|
8913
9053
|
};
|
|
8914
9054
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -8989,15 +9129,15 @@ function drawSchematicGrid(params) {
|
|
|
8989
9129
|
}
|
|
8990
9130
|
|
|
8991
9131
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
8992
|
-
import { applyToPoint as
|
|
9132
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
8993
9133
|
function drawSchematicLabeledPoints(params) {
|
|
8994
9134
|
const { points, transform } = params;
|
|
8995
9135
|
const labeledPointsGroup = [];
|
|
8996
9136
|
for (const point of points) {
|
|
8997
|
-
const [x1, y1] =
|
|
8998
|
-
const [x2, y2] =
|
|
8999
|
-
const [x3, y3] =
|
|
9000
|
-
const [x4, y4] =
|
|
9137
|
+
const [x1, y1] = applyToPoint54(transform, [point.x - 0.1, point.y - 0.1]);
|
|
9138
|
+
const [x2, y2] = applyToPoint54(transform, [point.x + 0.1, point.y + 0.1]);
|
|
9139
|
+
const [x3, y3] = applyToPoint54(transform, [point.x - 0.1, point.y + 0.1]);
|
|
9140
|
+
const [x4, y4] = applyToPoint54(transform, [point.x + 0.1, point.y - 0.1]);
|
|
9001
9141
|
labeledPointsGroup.push({
|
|
9002
9142
|
name: "path",
|
|
9003
9143
|
type: "element",
|
|
@@ -9008,7 +9148,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
9008
9148
|
"stroke-opacity": "0.7"
|
|
9009
9149
|
}
|
|
9010
9150
|
});
|
|
9011
|
-
const [labelX, labelY] =
|
|
9151
|
+
const [labelX, labelY] = applyToPoint54(transform, [
|
|
9012
9152
|
point.x + 0.15,
|
|
9013
9153
|
point.y - 0.15
|
|
9014
9154
|
]);
|
|
@@ -10126,7 +10266,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
10126
10266
|
import { symbols } from "schematic-symbols";
|
|
10127
10267
|
import "svgson";
|
|
10128
10268
|
import {
|
|
10129
|
-
applyToPoint as
|
|
10269
|
+
applyToPoint as applyToPoint56,
|
|
10130
10270
|
compose as compose11
|
|
10131
10271
|
} from "transformation-matrix";
|
|
10132
10272
|
|
|
@@ -10210,13 +10350,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
10210
10350
|
}
|
|
10211
10351
|
|
|
10212
10352
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
10213
|
-
import { applyToPoint as
|
|
10353
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
10214
10354
|
var createSvgSchErrorText = ({
|
|
10215
10355
|
text,
|
|
10216
10356
|
realCenter,
|
|
10217
10357
|
realToScreenTransform
|
|
10218
10358
|
}) => {
|
|
10219
|
-
const screenCenter =
|
|
10359
|
+
const screenCenter = applyToPoint55(realToScreenTransform, realCenter);
|
|
10220
10360
|
return {
|
|
10221
10361
|
type: "element",
|
|
10222
10362
|
name: "text",
|
|
@@ -10325,11 +10465,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10325
10465
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
10326
10466
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
10327
10467
|
};
|
|
10328
|
-
const [screenMinX, screenMinY] =
|
|
10468
|
+
const [screenMinX, screenMinY] = applyToPoint56(
|
|
10329
10469
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10330
10470
|
[bounds.minX, bounds.minY]
|
|
10331
10471
|
);
|
|
10332
|
-
const [screenMaxX, screenMaxY] =
|
|
10472
|
+
const [screenMaxX, screenMaxY] = applyToPoint56(
|
|
10333
10473
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10334
10474
|
[bounds.maxX, bounds.maxY]
|
|
10335
10475
|
);
|
|
@@ -10358,7 +10498,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10358
10498
|
name: "path",
|
|
10359
10499
|
attributes: {
|
|
10360
10500
|
d: points.map((p, i) => {
|
|
10361
|
-
const [x, y] =
|
|
10501
|
+
const [x, y] = applyToPoint56(
|
|
10362
10502
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10363
10503
|
[p.x, p.y]
|
|
10364
10504
|
);
|
|
@@ -10374,7 +10514,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10374
10514
|
});
|
|
10375
10515
|
}
|
|
10376
10516
|
for (const text of texts) {
|
|
10377
|
-
const screenTextPos =
|
|
10517
|
+
const screenTextPos = applyToPoint56(
|
|
10378
10518
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10379
10519
|
text
|
|
10380
10520
|
);
|
|
@@ -10426,7 +10566,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10426
10566
|
});
|
|
10427
10567
|
}
|
|
10428
10568
|
for (const box of boxes) {
|
|
10429
|
-
const screenBoxPos =
|
|
10569
|
+
const screenBoxPos = applyToPoint56(
|
|
10430
10570
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10431
10571
|
box
|
|
10432
10572
|
);
|
|
@@ -10450,7 +10590,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10450
10590
|
}
|
|
10451
10591
|
for (const port of symbol.ports) {
|
|
10452
10592
|
if (connectedSymbolPorts.has(port)) continue;
|
|
10453
|
-
const screenPortPos =
|
|
10593
|
+
const screenPortPos = applyToPoint56(
|
|
10454
10594
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10455
10595
|
port
|
|
10456
10596
|
);
|
|
@@ -10470,7 +10610,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10470
10610
|
});
|
|
10471
10611
|
}
|
|
10472
10612
|
for (const circle of circles) {
|
|
10473
|
-
const screenCirclePos =
|
|
10613
|
+
const screenCirclePos = applyToPoint56(
|
|
10474
10614
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10475
10615
|
circle
|
|
10476
10616
|
);
|
|
@@ -10497,14 +10637,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10497
10637
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
10498
10638
|
import "schematic-symbols";
|
|
10499
10639
|
import "svgson";
|
|
10500
|
-
import { applyToPoint as
|
|
10640
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
10501
10641
|
|
|
10502
10642
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
10503
10643
|
import "transformation-matrix";
|
|
10504
10644
|
import "@tscircuit/circuit-json-util";
|
|
10505
10645
|
|
|
10506
10646
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
10507
|
-
import { applyToPoint as
|
|
10647
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
10508
10648
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
10509
10649
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
10510
10650
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -10557,8 +10697,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10557
10697
|
realEdgePos.y += realPinLineLength;
|
|
10558
10698
|
break;
|
|
10559
10699
|
}
|
|
10560
|
-
const screenSchPortPos =
|
|
10561
|
-
const screenRealEdgePos =
|
|
10700
|
+
const screenSchPortPos = applyToPoint57(transform, schPort.center);
|
|
10701
|
+
const screenRealEdgePos = applyToPoint57(transform, realEdgePos);
|
|
10562
10702
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
10563
10703
|
const realLineEnd = { ...schPort.center };
|
|
10564
10704
|
if (!isConnected) {
|
|
@@ -10577,7 +10717,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10577
10717
|
break;
|
|
10578
10718
|
}
|
|
10579
10719
|
}
|
|
10580
|
-
const screenLineEnd =
|
|
10720
|
+
const screenLineEnd = applyToPoint57(transform, realLineEnd);
|
|
10581
10721
|
svgObjects.push({
|
|
10582
10722
|
name: "line",
|
|
10583
10723
|
type: "element",
|
|
@@ -10698,7 +10838,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10698
10838
|
};
|
|
10699
10839
|
|
|
10700
10840
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
10701
|
-
import { applyToPoint as
|
|
10841
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
10702
10842
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
10703
10843
|
const svgObjects = [];
|
|
10704
10844
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -10716,7 +10856,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10716
10856
|
} else {
|
|
10717
10857
|
realPinNumberPos.y += 0.02;
|
|
10718
10858
|
}
|
|
10719
|
-
const screenPinNumberTextPos =
|
|
10859
|
+
const screenPinNumberTextPos = applyToPoint58(transform, realPinNumberPos);
|
|
10720
10860
|
svgObjects.push({
|
|
10721
10861
|
name: "text",
|
|
10722
10862
|
type: "element",
|
|
@@ -10746,7 +10886,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10746
10886
|
};
|
|
10747
10887
|
|
|
10748
10888
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
10749
|
-
import { applyToPoint as
|
|
10889
|
+
import { applyToPoint as applyToPoint59 } from "transformation-matrix";
|
|
10750
10890
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
10751
10891
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
10752
10892
|
const svgObjects = [];
|
|
@@ -10760,7 +10900,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
10760
10900
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
10761
10901
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10762
10902
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10763
|
-
const screenPinNumberTextPos =
|
|
10903
|
+
const screenPinNumberTextPos = applyToPoint59(transform, realPinNumberPos);
|
|
10764
10904
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
10765
10905
|
if (!label) return [];
|
|
10766
10906
|
const isNegated = label.startsWith("N_");
|
|
@@ -10808,13 +10948,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
10808
10948
|
};
|
|
10809
10949
|
|
|
10810
10950
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
10811
|
-
import { applyToPoint as
|
|
10951
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
10812
10952
|
var createSvgSchText = ({
|
|
10813
10953
|
elm,
|
|
10814
10954
|
transform,
|
|
10815
10955
|
colorMap: colorMap2
|
|
10816
10956
|
}) => {
|
|
10817
|
-
const center =
|
|
10957
|
+
const center = applyToPoint61(transform, elm.position);
|
|
10818
10958
|
const textAnchorMap = {
|
|
10819
10959
|
center: "middle",
|
|
10820
10960
|
center_right: "end",
|
|
@@ -10898,11 +11038,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
10898
11038
|
colorMap: colorMap2
|
|
10899
11039
|
}) => {
|
|
10900
11040
|
const svgObjects = [];
|
|
10901
|
-
const componentScreenTopLeft =
|
|
11041
|
+
const componentScreenTopLeft = applyToPoint62(transform, {
|
|
10902
11042
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
10903
11043
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
10904
11044
|
});
|
|
10905
|
-
const componentScreenBottomRight =
|
|
11045
|
+
const componentScreenBottomRight = applyToPoint62(transform, {
|
|
10906
11046
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
10907
11047
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
10908
11048
|
});
|
|
@@ -10988,13 +11128,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
10988
11128
|
}
|
|
10989
11129
|
|
|
10990
11130
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
10991
|
-
import { applyToPoint as
|
|
11131
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
10992
11132
|
function createSvgObjectsFromSchVoltageProbe({
|
|
10993
11133
|
probe,
|
|
10994
11134
|
transform,
|
|
10995
11135
|
colorMap: colorMap2
|
|
10996
11136
|
}) {
|
|
10997
|
-
const [screenX, screenY] =
|
|
11137
|
+
const [screenX, screenY] = applyToPoint63(transform, [
|
|
10998
11138
|
probe.position.x,
|
|
10999
11139
|
probe.position.y
|
|
11000
11140
|
]);
|
|
@@ -11168,17 +11308,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
11168
11308
|
}
|
|
11169
11309
|
|
|
11170
11310
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
11171
|
-
import { applyToPoint as
|
|
11311
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
11172
11312
|
function createSvgObjectsFromSchDebugObject({
|
|
11173
11313
|
debugObject,
|
|
11174
11314
|
transform
|
|
11175
11315
|
}) {
|
|
11176
11316
|
if (debugObject.shape === "rect") {
|
|
11177
|
-
let [screenLeft, screenTop] =
|
|
11317
|
+
let [screenLeft, screenTop] = applyToPoint64(transform, [
|
|
11178
11318
|
debugObject.center.x - debugObject.size.width / 2,
|
|
11179
11319
|
debugObject.center.y - debugObject.size.height / 2
|
|
11180
11320
|
]);
|
|
11181
|
-
let [screenRight, screenBottom] =
|
|
11321
|
+
let [screenRight, screenBottom] = applyToPoint64(transform, [
|
|
11182
11322
|
debugObject.center.x + debugObject.size.width / 2,
|
|
11183
11323
|
debugObject.center.y + debugObject.size.height / 2
|
|
11184
11324
|
]);
|
|
@@ -11188,7 +11328,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11188
11328
|
];
|
|
11189
11329
|
const width = Math.abs(screenRight - screenLeft);
|
|
11190
11330
|
const height = Math.abs(screenBottom - screenTop);
|
|
11191
|
-
const [screenCenterX, screenCenterY] =
|
|
11331
|
+
const [screenCenterX, screenCenterY] = applyToPoint64(transform, [
|
|
11192
11332
|
debugObject.center.x,
|
|
11193
11333
|
debugObject.center.y
|
|
11194
11334
|
]);
|
|
@@ -11234,11 +11374,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11234
11374
|
];
|
|
11235
11375
|
}
|
|
11236
11376
|
if (debugObject.shape === "line") {
|
|
11237
|
-
const [screenStartX, screenStartY] =
|
|
11377
|
+
const [screenStartX, screenStartY] = applyToPoint64(transform, [
|
|
11238
11378
|
debugObject.start.x,
|
|
11239
11379
|
debugObject.start.y
|
|
11240
11380
|
]);
|
|
11241
|
-
const [screenEndX, screenEndY] =
|
|
11381
|
+
const [screenEndX, screenEndY] = applyToPoint64(transform, [
|
|
11242
11382
|
debugObject.end.x,
|
|
11243
11383
|
debugObject.end.y
|
|
11244
11384
|
]);
|
|
@@ -11288,7 +11428,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11288
11428
|
}
|
|
11289
11429
|
|
|
11290
11430
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
11291
|
-
import { applyToPoint as
|
|
11431
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
11292
11432
|
function createSchematicTrace({
|
|
11293
11433
|
trace,
|
|
11294
11434
|
transform,
|
|
@@ -11302,11 +11442,11 @@ function createSchematicTrace({
|
|
|
11302
11442
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
11303
11443
|
const edge = edges[edgeIndex];
|
|
11304
11444
|
if (edge.is_crossing) continue;
|
|
11305
|
-
const [screenFromX, screenFromY] =
|
|
11445
|
+
const [screenFromX, screenFromY] = applyToPoint65(transform, [
|
|
11306
11446
|
edge.from.x,
|
|
11307
11447
|
edge.from.y
|
|
11308
11448
|
]);
|
|
11309
|
-
const [screenToX, screenToY] =
|
|
11449
|
+
const [screenToX, screenToY] = applyToPoint65(transform, [
|
|
11310
11450
|
edge.to.x,
|
|
11311
11451
|
edge.to.y
|
|
11312
11452
|
]);
|
|
@@ -11350,11 +11490,11 @@ function createSchematicTrace({
|
|
|
11350
11490
|
}
|
|
11351
11491
|
for (const edge of edges) {
|
|
11352
11492
|
if (!edge.is_crossing) continue;
|
|
11353
|
-
const [screenFromX, screenFromY] =
|
|
11493
|
+
const [screenFromX, screenFromY] = applyToPoint65(transform, [
|
|
11354
11494
|
edge.from.x,
|
|
11355
11495
|
edge.from.y
|
|
11356
11496
|
]);
|
|
11357
|
-
const [screenToX, screenToY] =
|
|
11497
|
+
const [screenToX, screenToY] = applyToPoint65(transform, [
|
|
11358
11498
|
edge.to.x,
|
|
11359
11499
|
edge.to.y
|
|
11360
11500
|
]);
|
|
@@ -11398,7 +11538,7 @@ function createSchematicTrace({
|
|
|
11398
11538
|
}
|
|
11399
11539
|
if (trace.junctions) {
|
|
11400
11540
|
for (const junction of trace.junctions) {
|
|
11401
|
-
const [screenX, screenY] =
|
|
11541
|
+
const [screenX, screenY] = applyToPoint65(transform, [
|
|
11402
11542
|
junction.x,
|
|
11403
11543
|
junction.y
|
|
11404
11544
|
]);
|
|
@@ -11453,7 +11593,7 @@ function createSchematicTrace({
|
|
|
11453
11593
|
|
|
11454
11594
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
11455
11595
|
import {
|
|
11456
|
-
applyToPoint as
|
|
11596
|
+
applyToPoint as applyToPoint67,
|
|
11457
11597
|
compose as compose13,
|
|
11458
11598
|
rotate as rotate7,
|
|
11459
11599
|
scale as scale7,
|
|
@@ -11462,7 +11602,7 @@ import {
|
|
|
11462
11602
|
|
|
11463
11603
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
11464
11604
|
import {
|
|
11465
|
-
applyToPoint as
|
|
11605
|
+
applyToPoint as applyToPoint66,
|
|
11466
11606
|
compose as compose12,
|
|
11467
11607
|
rotate as rotate6,
|
|
11468
11608
|
scale as scale6,
|
|
@@ -11537,7 +11677,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11537
11677
|
x: symbolBounds.minX,
|
|
11538
11678
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
11539
11679
|
};
|
|
11540
|
-
const rotatedSymbolEnd =
|
|
11680
|
+
const rotatedSymbolEnd = applyToPoint66(rotationMatrix, symbolEndPoint);
|
|
11541
11681
|
const symbolToRealTransform = compose12(
|
|
11542
11682
|
translate12(
|
|
11543
11683
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -11547,11 +11687,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11547
11687
|
scale6(1)
|
|
11548
11688
|
// Use full symbol size
|
|
11549
11689
|
);
|
|
11550
|
-
const [screenMinX, screenMinY] =
|
|
11690
|
+
const [screenMinX, screenMinY] = applyToPoint66(
|
|
11551
11691
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11552
11692
|
[bounds.minX, bounds.minY]
|
|
11553
11693
|
);
|
|
11554
|
-
const [screenMaxX, screenMaxY] =
|
|
11694
|
+
const [screenMaxX, screenMaxY] = applyToPoint66(
|
|
11555
11695
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11556
11696
|
[bounds.maxX, bounds.maxY]
|
|
11557
11697
|
);
|
|
@@ -11575,7 +11715,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11575
11715
|
});
|
|
11576
11716
|
for (const path of symbolPaths) {
|
|
11577
11717
|
const symbolPath = path.points.map((p, i) => {
|
|
11578
|
-
const [x, y] =
|
|
11718
|
+
const [x, y] = applyToPoint66(
|
|
11579
11719
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11580
11720
|
[p.x, p.y]
|
|
11581
11721
|
);
|
|
@@ -11596,7 +11736,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11596
11736
|
});
|
|
11597
11737
|
}
|
|
11598
11738
|
for (const text of symbolTexts) {
|
|
11599
|
-
const screenTextPos =
|
|
11739
|
+
const screenTextPos = applyToPoint66(
|
|
11600
11740
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11601
11741
|
text
|
|
11602
11742
|
);
|
|
@@ -11638,7 +11778,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11638
11778
|
});
|
|
11639
11779
|
}
|
|
11640
11780
|
for (const box of symbolBoxes) {
|
|
11641
|
-
const screenBoxPos =
|
|
11781
|
+
const screenBoxPos = applyToPoint66(
|
|
11642
11782
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11643
11783
|
box
|
|
11644
11784
|
);
|
|
@@ -11661,7 +11801,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11661
11801
|
});
|
|
11662
11802
|
}
|
|
11663
11803
|
for (const circle of symbolCircles) {
|
|
11664
|
-
const screenCirclePos =
|
|
11804
|
+
const screenCirclePos = applyToPoint66(
|
|
11665
11805
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11666
11806
|
circle
|
|
11667
11807
|
);
|
|
@@ -11706,14 +11846,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11706
11846
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
11707
11847
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
11708
11848
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
11709
|
-
const screenCenter =
|
|
11849
|
+
const screenCenter = applyToPoint67(realToScreenTransform, schNetLabel.center);
|
|
11710
11850
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
11711
11851
|
schNetLabel.anchor_side
|
|
11712
11852
|
);
|
|
11713
11853
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
11714
11854
|
screenTextGrowthVec.y *= -1;
|
|
11715
11855
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
11716
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
11856
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint67(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
11717
11857
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
11718
11858
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
11719
11859
|
};
|
|
@@ -11754,7 +11894,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11754
11894
|
y: -0.6
|
|
11755
11895
|
}
|
|
11756
11896
|
].map(
|
|
11757
|
-
(fontRelativePoint) =>
|
|
11897
|
+
(fontRelativePoint) => applyToPoint67(
|
|
11758
11898
|
compose13(
|
|
11759
11899
|
realToScreenTransform,
|
|
11760
11900
|
translate13(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -11831,17 +11971,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11831
11971
|
};
|
|
11832
11972
|
|
|
11833
11973
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
11834
|
-
import { applyToPoint as
|
|
11974
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
11835
11975
|
var createSvgObjectsFromSchematicBox = ({
|
|
11836
11976
|
schematicBox,
|
|
11837
11977
|
transform,
|
|
11838
11978
|
colorMap: colorMap2
|
|
11839
11979
|
}) => {
|
|
11840
|
-
const topLeft =
|
|
11980
|
+
const topLeft = applyToPoint68(transform, {
|
|
11841
11981
|
x: schematicBox.x,
|
|
11842
11982
|
y: schematicBox.y
|
|
11843
11983
|
});
|
|
11844
|
-
const bottomRight =
|
|
11984
|
+
const bottomRight = applyToPoint68(transform, {
|
|
11845
11985
|
x: schematicBox.x + schematicBox.width,
|
|
11846
11986
|
y: schematicBox.y + schematicBox.height
|
|
11847
11987
|
});
|
|
@@ -11877,7 +12017,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
11877
12017
|
};
|
|
11878
12018
|
|
|
11879
12019
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
11880
|
-
import { applyToPoint as
|
|
12020
|
+
import { applyToPoint as applyToPoint69 } from "transformation-matrix";
|
|
11881
12021
|
var createSvgObjectsFromSchematicTable = ({
|
|
11882
12022
|
schematicTable,
|
|
11883
12023
|
transform,
|
|
@@ -11910,11 +12050,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11910
12050
|
const svgObjects = [];
|
|
11911
12051
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
11912
12052
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
11913
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
12053
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint69(transform, [
|
|
11914
12054
|
topLeftX,
|
|
11915
12055
|
topLeftY
|
|
11916
12056
|
]);
|
|
11917
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
12057
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint69(transform, [
|
|
11918
12058
|
topLeftX + totalWidth,
|
|
11919
12059
|
topLeftY - totalHeight
|
|
11920
12060
|
]);
|
|
@@ -11946,8 +12086,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11946
12086
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
11947
12087
|
);
|
|
11948
12088
|
if (!isMerged) {
|
|
11949
|
-
const start =
|
|
11950
|
-
const end =
|
|
12089
|
+
const start = applyToPoint69(transform, { x: currentX, y: segmentStartY });
|
|
12090
|
+
const end = applyToPoint69(transform, { x: currentX, y: segmentEndY });
|
|
11951
12091
|
svgObjects.push({
|
|
11952
12092
|
name: "line",
|
|
11953
12093
|
type: "element",
|
|
@@ -11976,11 +12116,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11976
12116
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
11977
12117
|
);
|
|
11978
12118
|
if (!isMerged) {
|
|
11979
|
-
const start =
|
|
12119
|
+
const start = applyToPoint69(transform, {
|
|
11980
12120
|
x: segmentStartX,
|
|
11981
12121
|
y: currentY
|
|
11982
12122
|
});
|
|
11983
|
-
const end =
|
|
12123
|
+
const end = applyToPoint69(transform, { x: segmentEndX, y: currentY });
|
|
11984
12124
|
svgObjects.push({
|
|
11985
12125
|
name: "line",
|
|
11986
12126
|
type: "element",
|
|
@@ -12022,7 +12162,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
12022
12162
|
} else if (vertical_align === "bottom") {
|
|
12023
12163
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
12024
12164
|
}
|
|
12025
|
-
const screenTextAnchorPos =
|
|
12165
|
+
const screenTextAnchorPos = applyToPoint69(transform, realTextAnchorPos);
|
|
12026
12166
|
const fontSize = getSchScreenFontSize(
|
|
12027
12167
|
transform,
|
|
12028
12168
|
"reference_designator",
|
|
@@ -12078,13 +12218,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
12078
12218
|
|
|
12079
12219
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
12080
12220
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
12081
|
-
import { applyToPoint as
|
|
12221
|
+
import { applyToPoint as applyToPoint70 } from "transformation-matrix";
|
|
12082
12222
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
12083
12223
|
var createSvgObjectsForSchPortHover = ({
|
|
12084
12224
|
schPort,
|
|
12085
12225
|
transform
|
|
12086
12226
|
}) => {
|
|
12087
|
-
const screenSchPortPos =
|
|
12227
|
+
const screenSchPortPos = applyToPoint70(transform, schPort.center);
|
|
12088
12228
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
12089
12229
|
return [
|
|
12090
12230
|
{
|
|
@@ -12129,14 +12269,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
12129
12269
|
};
|
|
12130
12270
|
|
|
12131
12271
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
12132
|
-
import { applyToPoint as
|
|
12272
|
+
import { applyToPoint as applyToPoint71 } from "transformation-matrix";
|
|
12133
12273
|
function createSvgObjectsFromSchematicLine({
|
|
12134
12274
|
schLine,
|
|
12135
12275
|
transform,
|
|
12136
12276
|
colorMap: colorMap2
|
|
12137
12277
|
}) {
|
|
12138
|
-
const p1 =
|
|
12139
|
-
const p2 =
|
|
12278
|
+
const p1 = applyToPoint71(transform, { x: schLine.x1, y: schLine.y1 });
|
|
12279
|
+
const p2 = applyToPoint71(transform, { x: schLine.x2, y: schLine.y2 });
|
|
12140
12280
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
12141
12281
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
12142
12282
|
return [
|
|
@@ -12165,13 +12305,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
12165
12305
|
}
|
|
12166
12306
|
|
|
12167
12307
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
12168
|
-
import { applyToPoint as
|
|
12308
|
+
import { applyToPoint as applyToPoint72 } from "transformation-matrix";
|
|
12169
12309
|
function createSvgObjectsFromSchematicCircle({
|
|
12170
12310
|
schCircle,
|
|
12171
12311
|
transform,
|
|
12172
12312
|
colorMap: colorMap2
|
|
12173
12313
|
}) {
|
|
12174
|
-
const center =
|
|
12314
|
+
const center = applyToPoint72(transform, schCircle.center);
|
|
12175
12315
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
12176
12316
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
12177
12317
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -12201,13 +12341,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
12201
12341
|
}
|
|
12202
12342
|
|
|
12203
12343
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
12204
|
-
import { applyToPoint as
|
|
12344
|
+
import { applyToPoint as applyToPoint73 } from "transformation-matrix";
|
|
12205
12345
|
function createSvgObjectsFromSchematicRect({
|
|
12206
12346
|
schRect,
|
|
12207
12347
|
transform,
|
|
12208
12348
|
colorMap: colorMap2
|
|
12209
12349
|
}) {
|
|
12210
|
-
const center =
|
|
12350
|
+
const center = applyToPoint73(transform, schRect.center);
|
|
12211
12351
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
12212
12352
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
12213
12353
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -12243,13 +12383,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
12243
12383
|
}
|
|
12244
12384
|
|
|
12245
12385
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
12246
|
-
import { applyToPoint as
|
|
12386
|
+
import { applyToPoint as applyToPoint74 } from "transformation-matrix";
|
|
12247
12387
|
function createSvgObjectsFromSchematicArc({
|
|
12248
12388
|
schArc,
|
|
12249
12389
|
transform,
|
|
12250
12390
|
colorMap: colorMap2
|
|
12251
12391
|
}) {
|
|
12252
|
-
const center =
|
|
12392
|
+
const center = applyToPoint74(transform, schArc.center);
|
|
12253
12393
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
12254
12394
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
12255
12395
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -13369,18 +13509,18 @@ function formatNumber2(value) {
|
|
|
13369
13509
|
import { distance as distance4 } from "circuit-json";
|
|
13370
13510
|
import { stringify as stringify7 } from "svgson";
|
|
13371
13511
|
import {
|
|
13372
|
-
applyToPoint as
|
|
13512
|
+
applyToPoint as applyToPoint77,
|
|
13373
13513
|
compose as compose16,
|
|
13374
13514
|
scale as scale9,
|
|
13375
13515
|
translate as translate16
|
|
13376
13516
|
} from "transformation-matrix";
|
|
13377
13517
|
|
|
13378
13518
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
13379
|
-
import { applyToPoint as
|
|
13519
|
+
import { applyToPoint as applyToPoint76 } from "transformation-matrix";
|
|
13380
13520
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
13381
13521
|
const { transform, layer: layerFilter } = ctx;
|
|
13382
13522
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
13383
|
-
const [x, y] =
|
|
13523
|
+
const [x, y] = applyToPoint76(transform, [solderPaste.x, solderPaste.y]);
|
|
13384
13524
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
13385
13525
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
13386
13526
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -13606,8 +13746,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
13606
13746
|
}
|
|
13607
13747
|
}
|
|
13608
13748
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
13609
|
-
const [x1, y1] =
|
|
13610
|
-
const [x2, y2] =
|
|
13749
|
+
const [x1, y1] = applyToPoint77(transform, [minX, minY]);
|
|
13750
|
+
const [x2, y2] = applyToPoint77(transform, [maxX, maxY]);
|
|
13611
13751
|
const width = Math.abs(x2 - x1);
|
|
13612
13752
|
const height = Math.abs(y2 - y1);
|
|
13613
13753
|
const x = Math.min(x1, x2);
|