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