circuit-to-svg 0.0.244 → 0.0.245
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +197 -139
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// lib/pcb/convert-circuit-json-to-pcb-svg.ts
|
|
2
2
|
import { stringify } from "svgson";
|
|
3
3
|
import {
|
|
4
|
-
applyToPoint as
|
|
4
|
+
applyToPoint as applyToPoint29,
|
|
5
5
|
compose as compose5,
|
|
6
6
|
scale as scale2,
|
|
7
7
|
translate as translate5
|
|
@@ -3163,6 +3163,61 @@ function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
|
3163
3163
|
];
|
|
3164
3164
|
}
|
|
3165
3165
|
|
|
3166
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
3167
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
3168
|
+
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
3169
|
+
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
3170
|
+
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
3171
|
+
const { transform } = ctx;
|
|
3172
|
+
const { center, width, height } = pcbGroup;
|
|
3173
|
+
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
3174
|
+
console.error("Invalid pcb_group data", { center, width, height });
|
|
3175
|
+
return [];
|
|
3176
|
+
}
|
|
3177
|
+
const halfWidth = width / 2;
|
|
3178
|
+
const halfHeight = height / 2;
|
|
3179
|
+
const [topLeftX, topLeftY] = applyToPoint28(transform, [
|
|
3180
|
+
center.x - halfWidth,
|
|
3181
|
+
center.y + halfHeight
|
|
3182
|
+
]);
|
|
3183
|
+
const [bottomRightX, bottomRightY] = applyToPoint28(transform, [
|
|
3184
|
+
center.x + halfWidth,
|
|
3185
|
+
center.y - halfHeight
|
|
3186
|
+
]);
|
|
3187
|
+
const rectX = Math.min(topLeftX, bottomRightX);
|
|
3188
|
+
const rectY = Math.min(topLeftY, bottomRightY);
|
|
3189
|
+
const rectWidth = Math.abs(bottomRightX - topLeftX);
|
|
3190
|
+
const rectHeight = Math.abs(bottomRightY - topLeftY);
|
|
3191
|
+
const transformedStrokeWidth = DEFAULT_STROKE_WIDTH * Math.abs(transform.a);
|
|
3192
|
+
const dashLength = 0.3 * Math.abs(transform.a);
|
|
3193
|
+
const gapLength = 0.15 * Math.abs(transform.a);
|
|
3194
|
+
const attributes = {
|
|
3195
|
+
x: rectX.toString(),
|
|
3196
|
+
y: rectY.toString(),
|
|
3197
|
+
width: rectWidth.toString(),
|
|
3198
|
+
height: rectHeight.toString(),
|
|
3199
|
+
class: "pcb-group",
|
|
3200
|
+
fill: "none",
|
|
3201
|
+
stroke: DEFAULT_GROUP_COLOR,
|
|
3202
|
+
"stroke-width": transformedStrokeWidth.toString(),
|
|
3203
|
+
"stroke-dasharray": `${dashLength} ${gapLength}`,
|
|
3204
|
+
"data-type": "pcb_group",
|
|
3205
|
+
"data-pcb-group-id": pcbGroup.pcb_group_id,
|
|
3206
|
+
"data-pcb-layer": "overlay"
|
|
3207
|
+
};
|
|
3208
|
+
if (pcbGroup.name) {
|
|
3209
|
+
attributes["data-group-name"] = pcbGroup.name;
|
|
3210
|
+
}
|
|
3211
|
+
const svgObject = {
|
|
3212
|
+
name: "rect",
|
|
3213
|
+
type: "element",
|
|
3214
|
+
value: "",
|
|
3215
|
+
attributes,
|
|
3216
|
+
children: []
|
|
3217
|
+
};
|
|
3218
|
+
return [svgObject];
|
|
3219
|
+
}
|
|
3220
|
+
|
|
3166
3221
|
// lib/utils/get-software-used-string.ts
|
|
3167
3222
|
function getSoftwareUsedString(circuitJson) {
|
|
3168
3223
|
const metadata = circuitJson.find(
|
|
@@ -3175,7 +3230,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3175
3230
|
var package_default = {
|
|
3176
3231
|
name: "circuit-to-svg",
|
|
3177
3232
|
type: "module",
|
|
3178
|
-
version: "0.0.
|
|
3233
|
+
version: "0.0.244",
|
|
3179
3234
|
description: "Convert Circuit JSON to SVG",
|
|
3180
3235
|
main: "dist/index.js",
|
|
3181
3236
|
files: [
|
|
@@ -3442,6 +3497,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3442
3497
|
transform,
|
|
3443
3498
|
layer,
|
|
3444
3499
|
shouldDrawErrors: options?.shouldDrawErrors,
|
|
3500
|
+
showPcbGroups: options?.showPcbGroups,
|
|
3445
3501
|
drawPaddingOutsideBoard,
|
|
3446
3502
|
colorMap: colorMap2,
|
|
3447
3503
|
renderSolderMask: options?.renderSolderMask
|
|
@@ -3662,13 +3718,15 @@ function createSvgObjects({
|
|
|
3662
3718
|
return createSvgObjectsFromPcbVia(elm, ctx);
|
|
3663
3719
|
case "pcb_cutout":
|
|
3664
3720
|
return createSvgObjectsFromPcbCutout(elm, ctx);
|
|
3721
|
+
case "pcb_group":
|
|
3722
|
+
return ctx.showPcbGroups ? createSvgObjectsFromPcbGroup(elm, ctx) : [];
|
|
3665
3723
|
default:
|
|
3666
3724
|
return [];
|
|
3667
3725
|
}
|
|
3668
3726
|
}
|
|
3669
3727
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
3670
|
-
const [x1, y1] =
|
|
3671
|
-
const [x2, y2] =
|
|
3728
|
+
const [x1, y1] = applyToPoint29(transform, [minX, minY]);
|
|
3729
|
+
const [x2, y2] = applyToPoint29(transform, [maxX, maxY]);
|
|
3672
3730
|
const width = Math.abs(x2 - x1);
|
|
3673
3731
|
const height = Math.abs(y2 - y1);
|
|
3674
3732
|
const x = Math.min(x1, x2);
|
|
@@ -3698,14 +3756,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
3698
3756
|
import { stringify as stringify2 } from "svgson";
|
|
3699
3757
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
3700
3758
|
import {
|
|
3701
|
-
applyToPoint as
|
|
3759
|
+
applyToPoint as applyToPoint36,
|
|
3702
3760
|
compose as compose6,
|
|
3703
3761
|
scale as scale3,
|
|
3704
3762
|
translate as translate6
|
|
3705
3763
|
} from "transformation-matrix";
|
|
3706
3764
|
|
|
3707
3765
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
3708
|
-
import { applyToPoint as
|
|
3766
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
3709
3767
|
var DEFAULT_BOARD_STYLE = {
|
|
3710
3768
|
fill: "none",
|
|
3711
3769
|
stroke: "rgb(0,0,0)",
|
|
@@ -3717,25 +3775,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
3717
3775
|
let path;
|
|
3718
3776
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
3719
3777
|
path = outline.map((point, index) => {
|
|
3720
|
-
const [x, y] =
|
|
3778
|
+
const [x, y] = applyToPoint30(transform, [point.x, point.y]);
|
|
3721
3779
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3722
3780
|
}).join(" ");
|
|
3723
3781
|
} else {
|
|
3724
3782
|
const halfWidth = width / 2;
|
|
3725
3783
|
const halfHeight = height / 2;
|
|
3726
|
-
const topLeft =
|
|
3784
|
+
const topLeft = applyToPoint30(transform, [
|
|
3727
3785
|
center.x - halfWidth,
|
|
3728
3786
|
center.y - halfHeight
|
|
3729
3787
|
]);
|
|
3730
|
-
const topRight =
|
|
3788
|
+
const topRight = applyToPoint30(transform, [
|
|
3731
3789
|
center.x + halfWidth,
|
|
3732
3790
|
center.y - halfHeight
|
|
3733
3791
|
]);
|
|
3734
|
-
const bottomRight =
|
|
3792
|
+
const bottomRight = applyToPoint30(transform, [
|
|
3735
3793
|
center.x + halfWidth,
|
|
3736
3794
|
center.y + halfHeight
|
|
3737
3795
|
]);
|
|
3738
|
-
const bottomLeft =
|
|
3796
|
+
const bottomLeft = applyToPoint30(transform, [
|
|
3739
3797
|
center.x - halfWidth,
|
|
3740
3798
|
center.y + halfHeight
|
|
3741
3799
|
]);
|
|
@@ -3761,7 +3819,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
3761
3819
|
}
|
|
3762
3820
|
|
|
3763
3821
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
3764
|
-
import { applyToPoint as
|
|
3822
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
3765
3823
|
|
|
3766
3824
|
// lib/utils/get-sch-font-size.ts
|
|
3767
3825
|
import "transformation-matrix";
|
|
@@ -3787,8 +3845,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
3787
3845
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
3788
3846
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
3789
3847
|
return null;
|
|
3790
|
-
const [x, y] =
|
|
3791
|
-
const [pinX, pinY] =
|
|
3848
|
+
const [x, y] = applyToPoint32(transform, [center.x, center.y]);
|
|
3849
|
+
const [pinX, pinY] = applyToPoint32(transform, [portPosition.x, portPosition.y]);
|
|
3792
3850
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3793
3851
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3794
3852
|
const isTopLayer = layer === "top";
|
|
@@ -3950,11 +4008,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
3950
4008
|
}
|
|
3951
4009
|
|
|
3952
4010
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
3953
|
-
import { applyToPoint as
|
|
4011
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
3954
4012
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
3955
4013
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
3956
4014
|
const { transform } = ctx;
|
|
3957
|
-
const [x, y] =
|
|
4015
|
+
const [x, y] = applyToPoint33(transform, [hole.x, hole.y]);
|
|
3958
4016
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
3959
4017
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
3960
4018
|
const radius = scaledDiameter / 2;
|
|
@@ -4018,12 +4076,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
4018
4076
|
}
|
|
4019
4077
|
|
|
4020
4078
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
4021
|
-
import { applyToPoint as
|
|
4079
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
4022
4080
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
4023
4081
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
4024
4082
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
4025
4083
|
const { transform } = ctx;
|
|
4026
|
-
const [x, y] =
|
|
4084
|
+
const [x, y] = applyToPoint34(transform, [hole.x, hole.y]);
|
|
4027
4085
|
if (hole.shape === "pill") {
|
|
4028
4086
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4029
4087
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -4118,7 +4176,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4118
4176
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
4119
4177
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4120
4178
|
const holeRadius = scaledHoleDiameter / 2;
|
|
4121
|
-
const [holeCx, holeCy] =
|
|
4179
|
+
const [holeCx, holeCy] = applyToPoint34(transform, [
|
|
4122
4180
|
circularHole.x + circularHole.hole_offset_x,
|
|
4123
4181
|
circularHole.y + circularHole.hole_offset_y
|
|
4124
4182
|
]);
|
|
@@ -4176,7 +4234,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4176
4234
|
const pillHoleWithOffsets = pillHole;
|
|
4177
4235
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
4178
4236
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
4179
|
-
const [holeCenterX, holeCenterY] =
|
|
4237
|
+
const [holeCenterX, holeCenterY] = applyToPoint34(transform, [
|
|
4180
4238
|
pillHole.x + holeOffsetX,
|
|
4181
4239
|
pillHole.y + holeOffsetY
|
|
4182
4240
|
]);
|
|
@@ -4238,7 +4296,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4238
4296
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
4239
4297
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
4240
4298
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
4241
|
-
const [holeCenterX, holeCenterY] =
|
|
4299
|
+
const [holeCenterX, holeCenterY] = applyToPoint34(transform, [
|
|
4242
4300
|
rotatedHole.x + holeOffsetX,
|
|
4243
4301
|
rotatedHole.y + holeOffsetY
|
|
4244
4302
|
]);
|
|
@@ -4294,14 +4352,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4294
4352
|
}
|
|
4295
4353
|
|
|
4296
4354
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
4297
|
-
import { applyToPoint as
|
|
4355
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
4298
4356
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
4299
4357
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
4300
4358
|
const { transform } = ctx;
|
|
4301
4359
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
4302
4360
|
const width = pad.width * Math.abs(transform.a);
|
|
4303
4361
|
const height = pad.height * Math.abs(transform.d);
|
|
4304
|
-
const [x, y] =
|
|
4362
|
+
const [x, y] = applyToPoint35(transform, [pad.x, pad.y]);
|
|
4305
4363
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4306
4364
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
4307
4365
|
return [
|
|
@@ -4353,7 +4411,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4353
4411
|
const width = pad.width * Math.abs(transform.a);
|
|
4354
4412
|
const height = pad.height * Math.abs(transform.d);
|
|
4355
4413
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4356
|
-
const [x, y] =
|
|
4414
|
+
const [x, y] = applyToPoint35(transform, [pad.x, pad.y]);
|
|
4357
4415
|
return [
|
|
4358
4416
|
{
|
|
4359
4417
|
name: "rect",
|
|
@@ -4376,7 +4434,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4376
4434
|
}
|
|
4377
4435
|
if (pad.shape === "circle") {
|
|
4378
4436
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4379
|
-
const [x, y] =
|
|
4437
|
+
const [x, y] = applyToPoint35(transform, [pad.x, pad.y]);
|
|
4380
4438
|
return [
|
|
4381
4439
|
{
|
|
4382
4440
|
name: "circle",
|
|
@@ -4396,7 +4454,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4396
4454
|
}
|
|
4397
4455
|
if (pad.shape === "polygon") {
|
|
4398
4456
|
const points = (pad.points ?? []).map(
|
|
4399
|
-
(point) =>
|
|
4457
|
+
(point) => applyToPoint35(transform, [point.x, point.y])
|
|
4400
4458
|
);
|
|
4401
4459
|
return [
|
|
4402
4460
|
{
|
|
@@ -4573,8 +4631,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
4573
4631
|
}
|
|
4574
4632
|
}
|
|
4575
4633
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
4576
|
-
const [x1, y1] =
|
|
4577
|
-
const [x2, y2] =
|
|
4634
|
+
const [x1, y1] = applyToPoint36(transform, [minX, minY]);
|
|
4635
|
+
const [x2, y2] = applyToPoint36(transform, [maxX, maxY]);
|
|
4578
4636
|
const width = Math.abs(x2 - x1);
|
|
4579
4637
|
const height = Math.abs(y2 - y1);
|
|
4580
4638
|
const x = Math.min(x1, x2);
|
|
@@ -4603,7 +4661,7 @@ import {
|
|
|
4603
4661
|
} from "transformation-matrix";
|
|
4604
4662
|
|
|
4605
4663
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
4606
|
-
import { applyToPoint as
|
|
4664
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
4607
4665
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
4608
4666
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
4609
4667
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -4617,25 +4675,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4617
4675
|
let path;
|
|
4618
4676
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4619
4677
|
path = outline.map((point, index) => {
|
|
4620
|
-
const [x, y] =
|
|
4678
|
+
const [x, y] = applyToPoint37(transform, [point.x, point.y]);
|
|
4621
4679
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4622
4680
|
}).join(" ");
|
|
4623
4681
|
} else {
|
|
4624
4682
|
const halfWidth = width / 2;
|
|
4625
4683
|
const halfHeight = height / 2;
|
|
4626
|
-
const topLeft =
|
|
4684
|
+
const topLeft = applyToPoint37(transform, [
|
|
4627
4685
|
center.x - halfWidth,
|
|
4628
4686
|
center.y - halfHeight
|
|
4629
4687
|
]);
|
|
4630
|
-
const topRight =
|
|
4688
|
+
const topRight = applyToPoint37(transform, [
|
|
4631
4689
|
center.x + halfWidth,
|
|
4632
4690
|
center.y - halfHeight
|
|
4633
4691
|
]);
|
|
4634
|
-
const bottomRight =
|
|
4692
|
+
const bottomRight = applyToPoint37(transform, [
|
|
4635
4693
|
center.x + halfWidth,
|
|
4636
4694
|
center.y + halfHeight
|
|
4637
4695
|
]);
|
|
4638
|
-
const bottomLeft =
|
|
4696
|
+
const bottomLeft = applyToPoint37(transform, [
|
|
4639
4697
|
center.x - halfWidth,
|
|
4640
4698
|
center.y + halfHeight
|
|
4641
4699
|
]);
|
|
@@ -4653,10 +4711,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4653
4711
|
const halfWidth = width2 / 2;
|
|
4654
4712
|
const halfHeight = height2 / 2;
|
|
4655
4713
|
const [tl, tr, br, bl] = [
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4714
|
+
applyToPoint37(transform, [x - halfWidth, y - halfHeight]),
|
|
4715
|
+
applyToPoint37(transform, [x + halfWidth, y - halfHeight]),
|
|
4716
|
+
applyToPoint37(transform, [x + halfWidth, y + halfHeight]),
|
|
4717
|
+
applyToPoint37(transform, [x - halfWidth, y + halfHeight])
|
|
4660
4718
|
];
|
|
4661
4719
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
4662
4720
|
} else if (cutout.shape === "circle") {
|
|
@@ -4706,7 +4764,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
4706
4764
|
|
|
4707
4765
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
4708
4766
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
4709
|
-
import { applyToPoint as
|
|
4767
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
4710
4768
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
4711
4769
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
4712
4770
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -4716,7 +4774,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
4716
4774
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
4717
4775
|
return [];
|
|
4718
4776
|
}
|
|
4719
|
-
const [x, y] =
|
|
4777
|
+
const [x, y] = applyToPoint38(transform, [center.x, center.y]);
|
|
4720
4778
|
const scaledWidth = width * Math.abs(transform.a);
|
|
4721
4779
|
const scaledHeight = height * Math.abs(transform.d);
|
|
4722
4780
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -4777,11 +4835,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
4777
4835
|
}
|
|
4778
4836
|
|
|
4779
4837
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
4780
|
-
import { applyToPoint as
|
|
4838
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
4781
4839
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
4782
4840
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
4783
4841
|
const { transform } = ctx;
|
|
4784
|
-
const [x, y] =
|
|
4842
|
+
const [x, y] = applyToPoint39(transform, [hole.x, hole.y]);
|
|
4785
4843
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
4786
4844
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
4787
4845
|
const radius = scaledDiameter / 2;
|
|
@@ -4845,12 +4903,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
4845
4903
|
}
|
|
4846
4904
|
|
|
4847
4905
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
4848
|
-
import { applyToPoint as
|
|
4906
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
4849
4907
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
4850
4908
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
4851
4909
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
4852
4910
|
const { transform } = ctx;
|
|
4853
|
-
const [x, y] =
|
|
4911
|
+
const [x, y] = applyToPoint40(transform, [hole.x, hole.y]);
|
|
4854
4912
|
if (hole.shape === "pill") {
|
|
4855
4913
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4856
4914
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -5085,14 +5143,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
5085
5143
|
}
|
|
5086
5144
|
|
|
5087
5145
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
5088
|
-
import { applyToPoint as
|
|
5146
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
5089
5147
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
5090
5148
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
5091
5149
|
const { transform } = ctx;
|
|
5092
5150
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
5093
5151
|
const width = pad.width * Math.abs(transform.a);
|
|
5094
5152
|
const height = pad.height * Math.abs(transform.d);
|
|
5095
|
-
const [x, y] =
|
|
5153
|
+
const [x, y] = applyToPoint41(transform, [pad.x, pad.y]);
|
|
5096
5154
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
5097
5155
|
return [
|
|
5098
5156
|
{
|
|
@@ -5135,7 +5193,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5135
5193
|
const width = pad.width * Math.abs(transform.a);
|
|
5136
5194
|
const height = pad.height * Math.abs(transform.d);
|
|
5137
5195
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5138
|
-
const [x, y] =
|
|
5196
|
+
const [x, y] = applyToPoint41(transform, [pad.x, pad.y]);
|
|
5139
5197
|
return [
|
|
5140
5198
|
{
|
|
5141
5199
|
name: "rect",
|
|
@@ -5158,7 +5216,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5158
5216
|
}
|
|
5159
5217
|
if (pad.shape === "circle") {
|
|
5160
5218
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5161
|
-
const [x, y] =
|
|
5219
|
+
const [x, y] = applyToPoint41(transform, [pad.x, pad.y]);
|
|
5162
5220
|
return [
|
|
5163
5221
|
{
|
|
5164
5222
|
name: "circle",
|
|
@@ -5178,7 +5236,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5178
5236
|
}
|
|
5179
5237
|
if (pad.shape === "polygon") {
|
|
5180
5238
|
const points = (pad.points ?? []).map(
|
|
5181
|
-
(point) =>
|
|
5239
|
+
(point) => applyToPoint41(transform, [point.x, point.y])
|
|
5182
5240
|
);
|
|
5183
5241
|
return [
|
|
5184
5242
|
{
|
|
@@ -5199,7 +5257,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5199
5257
|
}
|
|
5200
5258
|
|
|
5201
5259
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
5202
|
-
import { applyToPoint as
|
|
5260
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
5203
5261
|
import { calculateElbow } from "calculate-elbow";
|
|
5204
5262
|
|
|
5205
5263
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -5276,7 +5334,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5276
5334
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
5277
5335
|
if (!label_info) return [];
|
|
5278
5336
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
5279
|
-
const [port_x, port_y] =
|
|
5337
|
+
const [port_x, port_y] = applyToPoint42(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
5280
5338
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
5281
5339
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
5282
5340
|
const elbow_path = calculateElbow(
|
|
@@ -5417,7 +5475,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5417
5475
|
}
|
|
5418
5476
|
|
|
5419
5477
|
// lib/pinout/calculate-label-positions.ts
|
|
5420
|
-
import { applyToPoint as
|
|
5478
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
5421
5479
|
|
|
5422
5480
|
// lib/pinout/constants.ts
|
|
5423
5481
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -5455,7 +5513,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5455
5513
|
);
|
|
5456
5514
|
const mapToEdgePort = (pinout_label) => ({
|
|
5457
5515
|
pcb_port: pinout_label.pcb_port,
|
|
5458
|
-
y:
|
|
5516
|
+
y: applyToPoint43(transform, [
|
|
5459
5517
|
pinout_label.pcb_port.x,
|
|
5460
5518
|
pinout_label.pcb_port.y
|
|
5461
5519
|
])[1],
|
|
@@ -5470,7 +5528,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5470
5528
|
} else {
|
|
5471
5529
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
5472
5530
|
pcb_port: pinout_label.pcb_port,
|
|
5473
|
-
y:
|
|
5531
|
+
y: applyToPoint43(transform, [
|
|
5474
5532
|
pinout_label.pcb_port.x,
|
|
5475
5533
|
pinout_label.pcb_port.y
|
|
5476
5534
|
])[1],
|
|
@@ -5478,7 +5536,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5478
5536
|
})).sort((a, b) => a.y - b.y);
|
|
5479
5537
|
}
|
|
5480
5538
|
if (edge_ports.length === 0) return;
|
|
5481
|
-
const board_edge_x =
|
|
5539
|
+
const board_edge_x = applyToPoint43(transform, [
|
|
5482
5540
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
5483
5541
|
0
|
|
5484
5542
|
])[0];
|
|
@@ -5893,14 +5951,14 @@ import {
|
|
|
5893
5951
|
} from "transformation-matrix";
|
|
5894
5952
|
|
|
5895
5953
|
// lib/sch/draw-schematic-grid.ts
|
|
5896
|
-
import { applyToPoint as
|
|
5954
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
5897
5955
|
function drawSchematicGrid(params) {
|
|
5898
5956
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
5899
5957
|
const cellSize = params.cellSize ?? 1;
|
|
5900
5958
|
const labelCells = params.labelCells ?? false;
|
|
5901
5959
|
const gridLines = [];
|
|
5902
5960
|
const transformPoint = (x, y) => {
|
|
5903
|
-
const [transformedX, transformedY] =
|
|
5961
|
+
const [transformedX, transformedY] = applyToPoint44(params.transform, [x, y]);
|
|
5904
5962
|
return { x: transformedX, y: transformedY };
|
|
5905
5963
|
};
|
|
5906
5964
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -5981,15 +6039,15 @@ function drawSchematicGrid(params) {
|
|
|
5981
6039
|
}
|
|
5982
6040
|
|
|
5983
6041
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
5984
|
-
import { applyToPoint as
|
|
6042
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
5985
6043
|
function drawSchematicLabeledPoints(params) {
|
|
5986
6044
|
const { points, transform } = params;
|
|
5987
6045
|
const labeledPointsGroup = [];
|
|
5988
6046
|
for (const point of points) {
|
|
5989
|
-
const [x1, y1] =
|
|
5990
|
-
const [x2, y2] =
|
|
5991
|
-
const [x3, y3] =
|
|
5992
|
-
const [x4, y4] =
|
|
6047
|
+
const [x1, y1] = applyToPoint45(transform, [point.x - 0.1, point.y - 0.1]);
|
|
6048
|
+
const [x2, y2] = applyToPoint45(transform, [point.x + 0.1, point.y + 0.1]);
|
|
6049
|
+
const [x3, y3] = applyToPoint45(transform, [point.x - 0.1, point.y + 0.1]);
|
|
6050
|
+
const [x4, y4] = applyToPoint45(transform, [point.x + 0.1, point.y - 0.1]);
|
|
5993
6051
|
labeledPointsGroup.push({
|
|
5994
6052
|
name: "path",
|
|
5995
6053
|
type: "element",
|
|
@@ -6000,7 +6058,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
6000
6058
|
"stroke-opacity": "0.7"
|
|
6001
6059
|
}
|
|
6002
6060
|
});
|
|
6003
|
-
const [labelX, labelY] =
|
|
6061
|
+
const [labelX, labelY] = applyToPoint45(transform, [
|
|
6004
6062
|
point.x + 0.15,
|
|
6005
6063
|
point.y - 0.15
|
|
6006
6064
|
]);
|
|
@@ -7094,7 +7152,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
7094
7152
|
import { symbols } from "schematic-symbols";
|
|
7095
7153
|
import "svgson";
|
|
7096
7154
|
import {
|
|
7097
|
-
applyToPoint as
|
|
7155
|
+
applyToPoint as applyToPoint47,
|
|
7098
7156
|
compose as compose9
|
|
7099
7157
|
} from "transformation-matrix";
|
|
7100
7158
|
|
|
@@ -7178,13 +7236,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
7178
7236
|
}
|
|
7179
7237
|
|
|
7180
7238
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
7181
|
-
import { applyToPoint as
|
|
7239
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
7182
7240
|
var createSvgSchErrorText = ({
|
|
7183
7241
|
text,
|
|
7184
7242
|
realCenter,
|
|
7185
7243
|
realToScreenTransform
|
|
7186
7244
|
}) => {
|
|
7187
|
-
const screenCenter =
|
|
7245
|
+
const screenCenter = applyToPoint46(realToScreenTransform, realCenter);
|
|
7188
7246
|
return {
|
|
7189
7247
|
type: "element",
|
|
7190
7248
|
name: "text",
|
|
@@ -7293,11 +7351,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7293
7351
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
7294
7352
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
7295
7353
|
};
|
|
7296
|
-
const [screenMinX, screenMinY] =
|
|
7354
|
+
const [screenMinX, screenMinY] = applyToPoint47(
|
|
7297
7355
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7298
7356
|
[bounds.minX, bounds.minY]
|
|
7299
7357
|
);
|
|
7300
|
-
const [screenMaxX, screenMaxY] =
|
|
7358
|
+
const [screenMaxX, screenMaxY] = applyToPoint47(
|
|
7301
7359
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7302
7360
|
[bounds.maxX, bounds.maxY]
|
|
7303
7361
|
);
|
|
@@ -7326,7 +7384,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7326
7384
|
name: "path",
|
|
7327
7385
|
attributes: {
|
|
7328
7386
|
d: points.map((p, i) => {
|
|
7329
|
-
const [x, y] =
|
|
7387
|
+
const [x, y] = applyToPoint47(
|
|
7330
7388
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7331
7389
|
[p.x, p.y]
|
|
7332
7390
|
);
|
|
@@ -7342,7 +7400,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7342
7400
|
});
|
|
7343
7401
|
}
|
|
7344
7402
|
for (const text of texts) {
|
|
7345
|
-
const screenTextPos =
|
|
7403
|
+
const screenTextPos = applyToPoint47(
|
|
7346
7404
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7347
7405
|
text
|
|
7348
7406
|
);
|
|
@@ -7394,7 +7452,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7394
7452
|
});
|
|
7395
7453
|
}
|
|
7396
7454
|
for (const box of boxes) {
|
|
7397
|
-
const screenBoxPos =
|
|
7455
|
+
const screenBoxPos = applyToPoint47(
|
|
7398
7456
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7399
7457
|
box
|
|
7400
7458
|
);
|
|
@@ -7418,7 +7476,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7418
7476
|
}
|
|
7419
7477
|
for (const port of symbol.ports) {
|
|
7420
7478
|
if (connectedSymbolPorts.has(port)) continue;
|
|
7421
|
-
const screenPortPos =
|
|
7479
|
+
const screenPortPos = applyToPoint47(
|
|
7422
7480
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7423
7481
|
port
|
|
7424
7482
|
);
|
|
@@ -7438,7 +7496,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7438
7496
|
});
|
|
7439
7497
|
}
|
|
7440
7498
|
for (const circle of circles) {
|
|
7441
|
-
const screenCirclePos =
|
|
7499
|
+
const screenCirclePos = applyToPoint47(
|
|
7442
7500
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7443
7501
|
circle
|
|
7444
7502
|
);
|
|
@@ -7465,14 +7523,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7465
7523
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
7466
7524
|
import "schematic-symbols";
|
|
7467
7525
|
import "svgson";
|
|
7468
|
-
import { applyToPoint as
|
|
7526
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
7469
7527
|
|
|
7470
7528
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
7471
7529
|
import "transformation-matrix";
|
|
7472
7530
|
import "@tscircuit/circuit-json-util";
|
|
7473
7531
|
|
|
7474
7532
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
7475
|
-
import { applyToPoint as
|
|
7533
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7476
7534
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
7477
7535
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
7478
7536
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -7525,8 +7583,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7525
7583
|
realEdgePos.y += realPinLineLength;
|
|
7526
7584
|
break;
|
|
7527
7585
|
}
|
|
7528
|
-
const screenSchPortPos =
|
|
7529
|
-
const screenRealEdgePos =
|
|
7586
|
+
const screenSchPortPos = applyToPoint48(transform, schPort.center);
|
|
7587
|
+
const screenRealEdgePos = applyToPoint48(transform, realEdgePos);
|
|
7530
7588
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
7531
7589
|
const realLineEnd = { ...schPort.center };
|
|
7532
7590
|
if (!isConnected) {
|
|
@@ -7545,7 +7603,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7545
7603
|
break;
|
|
7546
7604
|
}
|
|
7547
7605
|
}
|
|
7548
|
-
const screenLineEnd =
|
|
7606
|
+
const screenLineEnd = applyToPoint48(transform, realLineEnd);
|
|
7549
7607
|
svgObjects.push({
|
|
7550
7608
|
name: "line",
|
|
7551
7609
|
type: "element",
|
|
@@ -7666,7 +7724,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7666
7724
|
};
|
|
7667
7725
|
|
|
7668
7726
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
7669
|
-
import { applyToPoint as
|
|
7727
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7670
7728
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
7671
7729
|
const svgObjects = [];
|
|
7672
7730
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -7684,7 +7742,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7684
7742
|
} else {
|
|
7685
7743
|
realPinNumberPos.y += 0.02;
|
|
7686
7744
|
}
|
|
7687
|
-
const screenPinNumberTextPos =
|
|
7745
|
+
const screenPinNumberTextPos = applyToPoint49(transform, realPinNumberPos);
|
|
7688
7746
|
svgObjects.push({
|
|
7689
7747
|
name: "text",
|
|
7690
7748
|
type: "element",
|
|
@@ -7714,7 +7772,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
7714
7772
|
};
|
|
7715
7773
|
|
|
7716
7774
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
7717
|
-
import { applyToPoint as
|
|
7775
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
7718
7776
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
7719
7777
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
7720
7778
|
const svgObjects = [];
|
|
@@ -7728,7 +7786,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
7728
7786
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
7729
7787
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7730
7788
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
7731
|
-
const screenPinNumberTextPos =
|
|
7789
|
+
const screenPinNumberTextPos = applyToPoint50(transform, realPinNumberPos);
|
|
7732
7790
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
7733
7791
|
if (!label) return [];
|
|
7734
7792
|
const isNegated = label.startsWith("N_");
|
|
@@ -7776,13 +7834,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
7776
7834
|
};
|
|
7777
7835
|
|
|
7778
7836
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
7779
|
-
import { applyToPoint as
|
|
7837
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
7780
7838
|
var createSvgSchText = ({
|
|
7781
7839
|
elm,
|
|
7782
7840
|
transform,
|
|
7783
7841
|
colorMap: colorMap2
|
|
7784
7842
|
}) => {
|
|
7785
|
-
const center =
|
|
7843
|
+
const center = applyToPoint52(transform, elm.position);
|
|
7786
7844
|
const textAnchorMap = {
|
|
7787
7845
|
center: "middle",
|
|
7788
7846
|
center_right: "end",
|
|
@@ -7866,11 +7924,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
7866
7924
|
colorMap: colorMap2
|
|
7867
7925
|
}) => {
|
|
7868
7926
|
const svgObjects = [];
|
|
7869
|
-
const componentScreenTopLeft =
|
|
7927
|
+
const componentScreenTopLeft = applyToPoint53(transform, {
|
|
7870
7928
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
7871
7929
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
7872
7930
|
});
|
|
7873
|
-
const componentScreenBottomRight =
|
|
7931
|
+
const componentScreenBottomRight = applyToPoint53(transform, {
|
|
7874
7932
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
7875
7933
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
7876
7934
|
});
|
|
@@ -7956,13 +8014,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
7956
8014
|
}
|
|
7957
8015
|
|
|
7958
8016
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
7959
|
-
import { applyToPoint as
|
|
8017
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
7960
8018
|
function createSvgObjectsFromSchVoltageProbe({
|
|
7961
8019
|
probe,
|
|
7962
8020
|
transform,
|
|
7963
8021
|
colorMap: colorMap2
|
|
7964
8022
|
}) {
|
|
7965
|
-
const [screenX, screenY] =
|
|
8023
|
+
const [screenX, screenY] = applyToPoint54(transform, [
|
|
7966
8024
|
probe.position.x,
|
|
7967
8025
|
probe.position.y
|
|
7968
8026
|
]);
|
|
@@ -8022,17 +8080,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
8022
8080
|
}
|
|
8023
8081
|
|
|
8024
8082
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
8025
|
-
import { applyToPoint as
|
|
8083
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
8026
8084
|
function createSvgObjectsFromSchDebugObject({
|
|
8027
8085
|
debugObject,
|
|
8028
8086
|
transform
|
|
8029
8087
|
}) {
|
|
8030
8088
|
if (debugObject.shape === "rect") {
|
|
8031
|
-
let [screenLeft, screenTop] =
|
|
8089
|
+
let [screenLeft, screenTop] = applyToPoint55(transform, [
|
|
8032
8090
|
debugObject.center.x - debugObject.size.width / 2,
|
|
8033
8091
|
debugObject.center.y - debugObject.size.height / 2
|
|
8034
8092
|
]);
|
|
8035
|
-
let [screenRight, screenBottom] =
|
|
8093
|
+
let [screenRight, screenBottom] = applyToPoint55(transform, [
|
|
8036
8094
|
debugObject.center.x + debugObject.size.width / 2,
|
|
8037
8095
|
debugObject.center.y + debugObject.size.height / 2
|
|
8038
8096
|
]);
|
|
@@ -8042,7 +8100,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8042
8100
|
];
|
|
8043
8101
|
const width = Math.abs(screenRight - screenLeft);
|
|
8044
8102
|
const height = Math.abs(screenBottom - screenTop);
|
|
8045
|
-
const [screenCenterX, screenCenterY] =
|
|
8103
|
+
const [screenCenterX, screenCenterY] = applyToPoint55(transform, [
|
|
8046
8104
|
debugObject.center.x,
|
|
8047
8105
|
debugObject.center.y
|
|
8048
8106
|
]);
|
|
@@ -8088,11 +8146,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8088
8146
|
];
|
|
8089
8147
|
}
|
|
8090
8148
|
if (debugObject.shape === "line") {
|
|
8091
|
-
const [screenStartX, screenStartY] =
|
|
8149
|
+
const [screenStartX, screenStartY] = applyToPoint55(transform, [
|
|
8092
8150
|
debugObject.start.x,
|
|
8093
8151
|
debugObject.start.y
|
|
8094
8152
|
]);
|
|
8095
|
-
const [screenEndX, screenEndY] =
|
|
8153
|
+
const [screenEndX, screenEndY] = applyToPoint55(transform, [
|
|
8096
8154
|
debugObject.end.x,
|
|
8097
8155
|
debugObject.end.y
|
|
8098
8156
|
]);
|
|
@@ -8142,7 +8200,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8142
8200
|
}
|
|
8143
8201
|
|
|
8144
8202
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
8145
|
-
import { applyToPoint as
|
|
8203
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
8146
8204
|
function createSchematicTrace({
|
|
8147
8205
|
trace,
|
|
8148
8206
|
transform,
|
|
@@ -8156,11 +8214,11 @@ function createSchematicTrace({
|
|
|
8156
8214
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
8157
8215
|
const edge = edges[edgeIndex];
|
|
8158
8216
|
if (edge.is_crossing) continue;
|
|
8159
|
-
const [screenFromX, screenFromY] =
|
|
8217
|
+
const [screenFromX, screenFromY] = applyToPoint56(transform, [
|
|
8160
8218
|
edge.from.x,
|
|
8161
8219
|
edge.from.y
|
|
8162
8220
|
]);
|
|
8163
|
-
const [screenToX, screenToY] =
|
|
8221
|
+
const [screenToX, screenToY] = applyToPoint56(transform, [
|
|
8164
8222
|
edge.to.x,
|
|
8165
8223
|
edge.to.y
|
|
8166
8224
|
]);
|
|
@@ -8204,11 +8262,11 @@ function createSchematicTrace({
|
|
|
8204
8262
|
}
|
|
8205
8263
|
for (const edge of edges) {
|
|
8206
8264
|
if (!edge.is_crossing) continue;
|
|
8207
|
-
const [screenFromX, screenFromY] =
|
|
8265
|
+
const [screenFromX, screenFromY] = applyToPoint56(transform, [
|
|
8208
8266
|
edge.from.x,
|
|
8209
8267
|
edge.from.y
|
|
8210
8268
|
]);
|
|
8211
|
-
const [screenToX, screenToY] =
|
|
8269
|
+
const [screenToX, screenToY] = applyToPoint56(transform, [
|
|
8212
8270
|
edge.to.x,
|
|
8213
8271
|
edge.to.y
|
|
8214
8272
|
]);
|
|
@@ -8252,7 +8310,7 @@ function createSchematicTrace({
|
|
|
8252
8310
|
}
|
|
8253
8311
|
if (trace.junctions) {
|
|
8254
8312
|
for (const junction of trace.junctions) {
|
|
8255
|
-
const [screenX, screenY] =
|
|
8313
|
+
const [screenX, screenY] = applyToPoint56(transform, [
|
|
8256
8314
|
junction.x,
|
|
8257
8315
|
junction.y
|
|
8258
8316
|
]);
|
|
@@ -8307,7 +8365,7 @@ function createSchematicTrace({
|
|
|
8307
8365
|
|
|
8308
8366
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
8309
8367
|
import {
|
|
8310
|
-
applyToPoint as
|
|
8368
|
+
applyToPoint as applyToPoint58,
|
|
8311
8369
|
compose as compose11,
|
|
8312
8370
|
rotate as rotate6,
|
|
8313
8371
|
scale as scale6,
|
|
@@ -8316,7 +8374,7 @@ import {
|
|
|
8316
8374
|
|
|
8317
8375
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
8318
8376
|
import {
|
|
8319
|
-
applyToPoint as
|
|
8377
|
+
applyToPoint as applyToPoint57,
|
|
8320
8378
|
compose as compose10,
|
|
8321
8379
|
rotate as rotate5,
|
|
8322
8380
|
scale as scale5,
|
|
@@ -8391,7 +8449,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8391
8449
|
x: symbolBounds.minX,
|
|
8392
8450
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
8393
8451
|
};
|
|
8394
|
-
const rotatedSymbolEnd =
|
|
8452
|
+
const rotatedSymbolEnd = applyToPoint57(rotationMatrix, symbolEndPoint);
|
|
8395
8453
|
const symbolToRealTransform = compose10(
|
|
8396
8454
|
translate10(
|
|
8397
8455
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -8401,11 +8459,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8401
8459
|
scale5(1)
|
|
8402
8460
|
// Use full symbol size
|
|
8403
8461
|
);
|
|
8404
|
-
const [screenMinX, screenMinY] =
|
|
8462
|
+
const [screenMinX, screenMinY] = applyToPoint57(
|
|
8405
8463
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8406
8464
|
[bounds.minX, bounds.minY]
|
|
8407
8465
|
);
|
|
8408
|
-
const [screenMaxX, screenMaxY] =
|
|
8466
|
+
const [screenMaxX, screenMaxY] = applyToPoint57(
|
|
8409
8467
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8410
8468
|
[bounds.maxX, bounds.maxY]
|
|
8411
8469
|
);
|
|
@@ -8429,7 +8487,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8429
8487
|
});
|
|
8430
8488
|
for (const path of symbolPaths) {
|
|
8431
8489
|
const symbolPath = path.points.map((p, i) => {
|
|
8432
|
-
const [x, y] =
|
|
8490
|
+
const [x, y] = applyToPoint57(
|
|
8433
8491
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8434
8492
|
[p.x, p.y]
|
|
8435
8493
|
);
|
|
@@ -8450,7 +8508,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8450
8508
|
});
|
|
8451
8509
|
}
|
|
8452
8510
|
for (const text of symbolTexts) {
|
|
8453
|
-
const screenTextPos =
|
|
8511
|
+
const screenTextPos = applyToPoint57(
|
|
8454
8512
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8455
8513
|
text
|
|
8456
8514
|
);
|
|
@@ -8492,7 +8550,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8492
8550
|
});
|
|
8493
8551
|
}
|
|
8494
8552
|
for (const box of symbolBoxes) {
|
|
8495
|
-
const screenBoxPos =
|
|
8553
|
+
const screenBoxPos = applyToPoint57(
|
|
8496
8554
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8497
8555
|
box
|
|
8498
8556
|
);
|
|
@@ -8515,7 +8573,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8515
8573
|
});
|
|
8516
8574
|
}
|
|
8517
8575
|
for (const circle of symbolCircles) {
|
|
8518
|
-
const screenCirclePos =
|
|
8576
|
+
const screenCirclePos = applyToPoint57(
|
|
8519
8577
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8520
8578
|
circle
|
|
8521
8579
|
);
|
|
@@ -8560,14 +8618,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8560
8618
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
8561
8619
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
8562
8620
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
8563
|
-
const screenCenter =
|
|
8621
|
+
const screenCenter = applyToPoint58(realToScreenTransform, schNetLabel.center);
|
|
8564
8622
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
8565
8623
|
schNetLabel.anchor_side
|
|
8566
8624
|
);
|
|
8567
8625
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
8568
8626
|
screenTextGrowthVec.y *= -1;
|
|
8569
8627
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
8570
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
8628
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint58(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
8571
8629
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
8572
8630
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
8573
8631
|
};
|
|
@@ -8608,7 +8666,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8608
8666
|
y: -0.6
|
|
8609
8667
|
}
|
|
8610
8668
|
].map(
|
|
8611
|
-
(fontRelativePoint) =>
|
|
8669
|
+
(fontRelativePoint) => applyToPoint58(
|
|
8612
8670
|
compose11(
|
|
8613
8671
|
realToScreenTransform,
|
|
8614
8672
|
translate11(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -8685,17 +8743,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
8685
8743
|
};
|
|
8686
8744
|
|
|
8687
8745
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
8688
|
-
import { applyToPoint as
|
|
8746
|
+
import { applyToPoint as applyToPoint59 } from "transformation-matrix";
|
|
8689
8747
|
var createSvgObjectsFromSchematicBox = ({
|
|
8690
8748
|
schematicBox,
|
|
8691
8749
|
transform,
|
|
8692
8750
|
colorMap: colorMap2
|
|
8693
8751
|
}) => {
|
|
8694
|
-
const topLeft =
|
|
8752
|
+
const topLeft = applyToPoint59(transform, {
|
|
8695
8753
|
x: schematicBox.x,
|
|
8696
8754
|
y: schematicBox.y
|
|
8697
8755
|
});
|
|
8698
|
-
const bottomRight =
|
|
8756
|
+
const bottomRight = applyToPoint59(transform, {
|
|
8699
8757
|
x: schematicBox.x + schematicBox.width,
|
|
8700
8758
|
y: schematicBox.y + schematicBox.height
|
|
8701
8759
|
});
|
|
@@ -8731,7 +8789,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
8731
8789
|
};
|
|
8732
8790
|
|
|
8733
8791
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
8734
|
-
import { applyToPoint as
|
|
8792
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
8735
8793
|
var createSvgObjectsFromSchematicTable = ({
|
|
8736
8794
|
schematicTable,
|
|
8737
8795
|
transform,
|
|
@@ -8764,11 +8822,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8764
8822
|
const svgObjects = [];
|
|
8765
8823
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
8766
8824
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
8767
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
8825
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint60(transform, [
|
|
8768
8826
|
topLeftX,
|
|
8769
8827
|
topLeftY
|
|
8770
8828
|
]);
|
|
8771
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
8829
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint60(transform, [
|
|
8772
8830
|
topLeftX + totalWidth,
|
|
8773
8831
|
topLeftY - totalHeight
|
|
8774
8832
|
]);
|
|
@@ -8800,8 +8858,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8800
8858
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
8801
8859
|
);
|
|
8802
8860
|
if (!isMerged) {
|
|
8803
|
-
const start =
|
|
8804
|
-
const end =
|
|
8861
|
+
const start = applyToPoint60(transform, { x: currentX, y: segmentStartY });
|
|
8862
|
+
const end = applyToPoint60(transform, { x: currentX, y: segmentEndY });
|
|
8805
8863
|
svgObjects.push({
|
|
8806
8864
|
name: "line",
|
|
8807
8865
|
type: "element",
|
|
@@ -8830,11 +8888,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8830
8888
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
8831
8889
|
);
|
|
8832
8890
|
if (!isMerged) {
|
|
8833
|
-
const start =
|
|
8891
|
+
const start = applyToPoint60(transform, {
|
|
8834
8892
|
x: segmentStartX,
|
|
8835
8893
|
y: currentY
|
|
8836
8894
|
});
|
|
8837
|
-
const end =
|
|
8895
|
+
const end = applyToPoint60(transform, { x: segmentEndX, y: currentY });
|
|
8838
8896
|
svgObjects.push({
|
|
8839
8897
|
name: "line",
|
|
8840
8898
|
type: "element",
|
|
@@ -8876,7 +8934,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8876
8934
|
} else if (vertical_align === "bottom") {
|
|
8877
8935
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
8878
8936
|
}
|
|
8879
|
-
const screenTextAnchorPos =
|
|
8937
|
+
const screenTextAnchorPos = applyToPoint60(transform, realTextAnchorPos);
|
|
8880
8938
|
const fontSize = getSchScreenFontSize(
|
|
8881
8939
|
transform,
|
|
8882
8940
|
"reference_designator",
|
|
@@ -8932,13 +8990,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
8932
8990
|
|
|
8933
8991
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
8934
8992
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
8935
|
-
import { applyToPoint as
|
|
8993
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
8936
8994
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
8937
8995
|
var createSvgObjectsForSchPortHover = ({
|
|
8938
8996
|
schPort,
|
|
8939
8997
|
transform
|
|
8940
8998
|
}) => {
|
|
8941
|
-
const screenSchPortPos =
|
|
8999
|
+
const screenSchPortPos = applyToPoint61(transform, schPort.center);
|
|
8942
9000
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
8943
9001
|
return [
|
|
8944
9002
|
{
|
|
@@ -8983,14 +9041,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
8983
9041
|
};
|
|
8984
9042
|
|
|
8985
9043
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
8986
|
-
import { applyToPoint as
|
|
9044
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
8987
9045
|
function createSvgObjectsFromSchematicLine({
|
|
8988
9046
|
schLine,
|
|
8989
9047
|
transform,
|
|
8990
9048
|
colorMap: colorMap2
|
|
8991
9049
|
}) {
|
|
8992
|
-
const p1 =
|
|
8993
|
-
const p2 =
|
|
9050
|
+
const p1 = applyToPoint62(transform, { x: schLine.x1, y: schLine.y1 });
|
|
9051
|
+
const p2 = applyToPoint62(transform, { x: schLine.x2, y: schLine.y2 });
|
|
8994
9052
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
8995
9053
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
8996
9054
|
return [
|
|
@@ -9019,13 +9077,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
9019
9077
|
}
|
|
9020
9078
|
|
|
9021
9079
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
9022
|
-
import { applyToPoint as
|
|
9080
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
9023
9081
|
function createSvgObjectsFromSchematicCircle({
|
|
9024
9082
|
schCircle,
|
|
9025
9083
|
transform,
|
|
9026
9084
|
colorMap: colorMap2
|
|
9027
9085
|
}) {
|
|
9028
|
-
const center =
|
|
9086
|
+
const center = applyToPoint63(transform, schCircle.center);
|
|
9029
9087
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
9030
9088
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
9031
9089
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -9055,13 +9113,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
9055
9113
|
}
|
|
9056
9114
|
|
|
9057
9115
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
9058
|
-
import { applyToPoint as
|
|
9116
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
9059
9117
|
function createSvgObjectsFromSchematicRect({
|
|
9060
9118
|
schRect,
|
|
9061
9119
|
transform,
|
|
9062
9120
|
colorMap: colorMap2
|
|
9063
9121
|
}) {
|
|
9064
|
-
const center =
|
|
9122
|
+
const center = applyToPoint64(transform, schRect.center);
|
|
9065
9123
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
9066
9124
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
9067
9125
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -9097,13 +9155,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
9097
9155
|
}
|
|
9098
9156
|
|
|
9099
9157
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
9100
|
-
import { applyToPoint as
|
|
9158
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
9101
9159
|
function createSvgObjectsFromSchematicArc({
|
|
9102
9160
|
schArc,
|
|
9103
9161
|
transform,
|
|
9104
9162
|
colorMap: colorMap2
|
|
9105
9163
|
}) {
|
|
9106
|
-
const center =
|
|
9164
|
+
const center = applyToPoint65(transform, schArc.center);
|
|
9107
9165
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
9108
9166
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
9109
9167
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -10138,18 +10196,18 @@ function formatNumber2(value) {
|
|
|
10138
10196
|
// lib/pcb/convert-circuit-json-to-solder-paste-mask.ts
|
|
10139
10197
|
import { stringify as stringify7 } from "svgson";
|
|
10140
10198
|
import {
|
|
10141
|
-
applyToPoint as
|
|
10199
|
+
applyToPoint as applyToPoint68,
|
|
10142
10200
|
compose as compose14,
|
|
10143
10201
|
scale as scale8,
|
|
10144
10202
|
translate as translate14
|
|
10145
10203
|
} from "transformation-matrix";
|
|
10146
10204
|
|
|
10147
10205
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
10148
|
-
import { applyToPoint as
|
|
10206
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
10149
10207
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
10150
10208
|
const { transform, layer: layerFilter } = ctx;
|
|
10151
10209
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
10152
|
-
const [x, y] =
|
|
10210
|
+
const [x, y] = applyToPoint67(transform, [solderPaste.x, solderPaste.y]);
|
|
10153
10211
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
10154
10212
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
10155
10213
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -10360,8 +10418,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
10360
10418
|
}
|
|
10361
10419
|
}
|
|
10362
10420
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
10363
|
-
const [x1, y1] =
|
|
10364
|
-
const [x2, y2] =
|
|
10421
|
+
const [x1, y1] = applyToPoint68(transform, [minX, minY]);
|
|
10422
|
+
const [x2, y2] = applyToPoint68(transform, [maxX, maxY]);
|
|
10365
10423
|
const width = Math.abs(x2 - x1);
|
|
10366
10424
|
const height = Math.abs(y2 - y1);
|
|
10367
10425
|
const x = Math.min(x1, x2);
|