circuit-to-svg 0.0.302 → 0.0.304
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +298 -190
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { distance as distance2 } from "circuit-json";
|
|
3
3
|
import { stringify } from "svgson";
|
|
4
4
|
import {
|
|
5
|
-
applyToPoint as
|
|
5
|
+
applyToPoint as applyToPoint37,
|
|
6
6
|
compose as compose7,
|
|
7
7
|
scale as scale3,
|
|
8
8
|
translate as translate7
|
|
@@ -3163,8 +3163,61 @@ function createSvgObjectsFromPcbSilkscreenPill(pcbSilkscreenPill, ctx) {
|
|
|
3163
3163
|
return [svgObject];
|
|
3164
3164
|
}
|
|
3165
3165
|
|
|
3166
|
-
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-
|
|
3166
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-oval.ts
|
|
3167
3167
|
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
3168
|
+
function createSvgObjectsFromPcbSilkscreenOval(pcbSilkscreenOval, ctx) {
|
|
3169
|
+
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
3170
|
+
const {
|
|
3171
|
+
center,
|
|
3172
|
+
radius_x,
|
|
3173
|
+
radius_y,
|
|
3174
|
+
layer = "top",
|
|
3175
|
+
pcb_silkscreen_oval_id,
|
|
3176
|
+
ccw_rotation = 0
|
|
3177
|
+
} = pcbSilkscreenOval;
|
|
3178
|
+
if (layerFilter && layer !== layerFilter) return [];
|
|
3179
|
+
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof radius_x !== "number" || typeof radius_y !== "number") {
|
|
3180
|
+
console.error("Invalid PCB Silkscreen Oval data:", {
|
|
3181
|
+
center,
|
|
3182
|
+
radius_x,
|
|
3183
|
+
radius_y
|
|
3184
|
+
});
|
|
3185
|
+
return [];
|
|
3186
|
+
}
|
|
3187
|
+
const [transformedX, transformedY] = applyToPoint20(transform, [
|
|
3188
|
+
center.x,
|
|
3189
|
+
center.y
|
|
3190
|
+
]);
|
|
3191
|
+
const transformedRadiusX = radius_x * Math.abs(transform.a);
|
|
3192
|
+
const transformedRadiusY = radius_y * Math.abs(transform.d);
|
|
3193
|
+
const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
|
|
3194
|
+
const svgObject = {
|
|
3195
|
+
name: "ellipse",
|
|
3196
|
+
type: "element",
|
|
3197
|
+
attributes: {
|
|
3198
|
+
cx: transformedX.toString(),
|
|
3199
|
+
cy: transformedY.toString(),
|
|
3200
|
+
rx: transformedRadiusX.toString(),
|
|
3201
|
+
ry: transformedRadiusY.toString(),
|
|
3202
|
+
fill: "none",
|
|
3203
|
+
stroke: color,
|
|
3204
|
+
"stroke-width": (0.1 * Math.abs(transform.a)).toString(),
|
|
3205
|
+
class: `pcb-silkscreen-oval pcb-silkscreen-${layer}`,
|
|
3206
|
+
"data-pcb-silkscreen-oval-id": pcb_silkscreen_oval_id,
|
|
3207
|
+
"data-type": "pcb_silkscreen_oval",
|
|
3208
|
+
"data-pcb-layer": layer,
|
|
3209
|
+
...ccw_rotation !== 0 && {
|
|
3210
|
+
transform: `rotate(${-ccw_rotation} ${transformedX} ${transformedY})`
|
|
3211
|
+
}
|
|
3212
|
+
},
|
|
3213
|
+
value: "",
|
|
3214
|
+
children: []
|
|
3215
|
+
};
|
|
3216
|
+
return [svgObject];
|
|
3217
|
+
}
|
|
3218
|
+
|
|
3219
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-courtyard-rect.ts
|
|
3220
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
3168
3221
|
function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
|
|
3169
3222
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
3170
3223
|
const {
|
|
@@ -3183,7 +3236,7 @@ function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
|
|
|
3183
3236
|
});
|
|
3184
3237
|
return [];
|
|
3185
3238
|
}
|
|
3186
|
-
const [transformedX, transformedY] =
|
|
3239
|
+
const [transformedX, transformedY] = applyToPoint21(transform, [
|
|
3187
3240
|
center.x,
|
|
3188
3241
|
center.y
|
|
3189
3242
|
]);
|
|
@@ -3224,7 +3277,7 @@ function pairs(arr) {
|
|
|
3224
3277
|
}
|
|
3225
3278
|
|
|
3226
3279
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
|
|
3227
|
-
import { applyToPoint as
|
|
3280
|
+
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
3228
3281
|
function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
3229
3282
|
const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
|
|
3230
3283
|
if (!trace.route || !Array.isArray(trace.route) || trace.route.length < 2)
|
|
@@ -3232,8 +3285,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
3232
3285
|
const segments = pairs(trace.route);
|
|
3233
3286
|
const svgObjects = [];
|
|
3234
3287
|
for (const [start, end] of segments) {
|
|
3235
|
-
const startPoint =
|
|
3236
|
-
const endPoint =
|
|
3288
|
+
const startPoint = applyToPoint22(transform, [start.x, start.y]);
|
|
3289
|
+
const endPoint = applyToPoint22(transform, [end.x, end.y]);
|
|
3237
3290
|
const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
|
|
3238
3291
|
if (!layer) continue;
|
|
3239
3292
|
if (layerFilter && layer !== layerFilter) continue;
|
|
@@ -3288,7 +3341,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
3288
3341
|
}
|
|
3289
3342
|
|
|
3290
3343
|
// lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
|
|
3291
|
-
import { applyToPoint as
|
|
3344
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
3292
3345
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
3293
3346
|
const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
|
|
3294
3347
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
@@ -3299,7 +3352,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3299
3352
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
3300
3353
|
const width = pad.width * Math.abs(transform.a);
|
|
3301
3354
|
const height = pad.height * Math.abs(transform.d);
|
|
3302
|
-
const [x, y] =
|
|
3355
|
+
const [x, y] = applyToPoint23(transform, [pad.x, pad.y]);
|
|
3303
3356
|
const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
|
|
3304
3357
|
const scaledBorderRadius = cornerRadiusValue * Math.abs(transform.a);
|
|
3305
3358
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
@@ -3541,7 +3594,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3541
3594
|
const width = pad.width * Math.abs(transform.a);
|
|
3542
3595
|
const height = pad.height * Math.abs(transform.d);
|
|
3543
3596
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3544
|
-
const [x, y] =
|
|
3597
|
+
const [x, y] = applyToPoint23(transform, [pad.x, pad.y]);
|
|
3545
3598
|
const rotationTransformAttributes = isRotated ? {
|
|
3546
3599
|
transform: `translate(${x} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
|
|
3547
3600
|
} : void 0;
|
|
@@ -3659,7 +3712,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3659
3712
|
}
|
|
3660
3713
|
if (pad.shape === "circle") {
|
|
3661
3714
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3662
|
-
const [x, y] =
|
|
3715
|
+
const [x, y] = applyToPoint23(transform, [pad.x, pad.y]);
|
|
3663
3716
|
const padElement = {
|
|
3664
3717
|
name: "circle",
|
|
3665
3718
|
type: "element",
|
|
@@ -3749,7 +3802,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3749
3802
|
}
|
|
3750
3803
|
if (pad.shape === "polygon") {
|
|
3751
3804
|
const points = (pad.points ?? []).map(
|
|
3752
|
-
(point) =>
|
|
3805
|
+
(point) => applyToPoint23(transform, [point.x, point.y])
|
|
3753
3806
|
);
|
|
3754
3807
|
const padElement = {
|
|
3755
3808
|
name: "polygon",
|
|
@@ -3848,10 +3901,10 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3848
3901
|
}
|
|
3849
3902
|
|
|
3850
3903
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
|
|
3851
|
-
import { applyToPoint as
|
|
3904
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
3852
3905
|
|
|
3853
3906
|
// lib/utils/create-pcb-component-anchor-offset-indicators.ts
|
|
3854
|
-
import { applyToPoint as
|
|
3907
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
3855
3908
|
var OFFSET_THRESHOLD_MM = 0.05;
|
|
3856
3909
|
var TICK_SIZE_PX = 4;
|
|
3857
3910
|
var LABEL_GAP_PX = 8;
|
|
@@ -3878,11 +3931,11 @@ function createAnchorOffsetIndicators(params) {
|
|
|
3878
3931
|
displayYOffset
|
|
3879
3932
|
} = params;
|
|
3880
3933
|
const objects = [];
|
|
3881
|
-
const [screenGroupAnchorX, screenGroupAnchorY] =
|
|
3934
|
+
const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint24(transform, [
|
|
3882
3935
|
groupAnchorPosition.x,
|
|
3883
3936
|
groupAnchorPosition.y
|
|
3884
3937
|
]);
|
|
3885
|
-
const [screenComponentX, screenComponentY] =
|
|
3938
|
+
const [screenComponentX, screenComponentY] = applyToPoint24(transform, [
|
|
3886
3939
|
componentPosition.x,
|
|
3887
3940
|
componentPosition.y
|
|
3888
3941
|
]);
|
|
@@ -4233,25 +4286,25 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
4233
4286
|
let path;
|
|
4234
4287
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4235
4288
|
path = outline.map((point, index) => {
|
|
4236
|
-
const [x, y] =
|
|
4289
|
+
const [x, y] = applyToPoint25(transform, [point.x, point.y]);
|
|
4237
4290
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4238
4291
|
}).join(" ");
|
|
4239
4292
|
} else {
|
|
4240
4293
|
const halfWidth = width / 2;
|
|
4241
4294
|
const halfHeight = height / 2;
|
|
4242
|
-
const topLeft =
|
|
4295
|
+
const topLeft = applyToPoint25(transform, [
|
|
4243
4296
|
center.x - halfWidth,
|
|
4244
4297
|
center.y - halfHeight
|
|
4245
4298
|
]);
|
|
4246
|
-
const topRight =
|
|
4299
|
+
const topRight = applyToPoint25(transform, [
|
|
4247
4300
|
center.x + halfWidth,
|
|
4248
4301
|
center.y - halfHeight
|
|
4249
4302
|
]);
|
|
4250
|
-
const bottomRight =
|
|
4303
|
+
const bottomRight = applyToPoint25(transform, [
|
|
4251
4304
|
center.x + halfWidth,
|
|
4252
4305
|
center.y + halfHeight
|
|
4253
4306
|
]);
|
|
4254
|
-
const bottomLeft =
|
|
4307
|
+
const bottomLeft = applyToPoint25(transform, [
|
|
4255
4308
|
center.x - halfWidth,
|
|
4256
4309
|
center.y + halfHeight
|
|
4257
4310
|
]);
|
|
@@ -4318,7 +4371,7 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
4318
4371
|
}
|
|
4319
4372
|
|
|
4320
4373
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
|
|
4321
|
-
import { applyToPoint as
|
|
4374
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
4322
4375
|
function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
4323
4376
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
4324
4377
|
const width = Number(pcbPanel.width);
|
|
@@ -4326,19 +4379,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
4326
4379
|
const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
|
|
4327
4380
|
const halfWidth = width / 2;
|
|
4328
4381
|
const halfHeight = height / 2;
|
|
4329
|
-
const topLeft =
|
|
4382
|
+
const topLeft = applyToPoint26(transform, [
|
|
4330
4383
|
center.x - halfWidth,
|
|
4331
4384
|
center.y - halfHeight
|
|
4332
4385
|
]);
|
|
4333
|
-
const topRight =
|
|
4386
|
+
const topRight = applyToPoint26(transform, [
|
|
4334
4387
|
center.x + halfWidth,
|
|
4335
4388
|
center.y - halfHeight
|
|
4336
4389
|
]);
|
|
4337
|
-
const bottomRight =
|
|
4390
|
+
const bottomRight = applyToPoint26(transform, [
|
|
4338
4391
|
center.x + halfWidth,
|
|
4339
4392
|
center.y + halfHeight
|
|
4340
4393
|
]);
|
|
4341
|
-
const bottomLeft =
|
|
4394
|
+
const bottomLeft = applyToPoint26(transform, [
|
|
4342
4395
|
center.x - halfWidth,
|
|
4343
4396
|
center.y + halfHeight
|
|
4344
4397
|
]);
|
|
@@ -4367,10 +4420,10 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
4367
4420
|
}
|
|
4368
4421
|
|
|
4369
4422
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
4370
|
-
import { applyToPoint as
|
|
4423
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
4371
4424
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
4372
4425
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
4373
|
-
const [x, y] =
|
|
4426
|
+
const [x, y] = applyToPoint27(transform, [hole.x, hole.y]);
|
|
4374
4427
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
4375
4428
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
4376
4429
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -4416,11 +4469,11 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
4416
4469
|
}
|
|
4417
4470
|
|
|
4418
4471
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
4419
|
-
import { applyToPoint as
|
|
4472
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
4420
4473
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
4421
4474
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
4422
4475
|
const layer = ctx.layer ?? "top";
|
|
4423
|
-
const [x, y] =
|
|
4476
|
+
const [x, y] = applyToPoint28(transform, [hole.x, hole.y]);
|
|
4424
4477
|
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
4425
4478
|
const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
|
|
4426
4479
|
const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
|
|
@@ -4917,7 +4970,7 @@ import {
|
|
|
4917
4970
|
getFullConnectivityMapFromCircuitJson
|
|
4918
4971
|
} from "circuit-json-to-connectivity-map";
|
|
4919
4972
|
import "svgson";
|
|
4920
|
-
import { applyToPoint as
|
|
4973
|
+
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
4921
4974
|
|
|
4922
4975
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
4923
4976
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -4997,11 +5050,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
4997
5050
|
});
|
|
4998
5051
|
const svgObjects = [];
|
|
4999
5052
|
for (const line of ratsNestLines) {
|
|
5000
|
-
const transformedStart =
|
|
5053
|
+
const transformedStart = applyToPoint29(transform, [
|
|
5001
5054
|
line.startPoint.x,
|
|
5002
5055
|
line.startPoint.y
|
|
5003
5056
|
]);
|
|
5004
|
-
const transformedEnd =
|
|
5057
|
+
const transformedEnd = applyToPoint29(transform, [
|
|
5005
5058
|
line.endPoint.x,
|
|
5006
5059
|
line.endPoint.y
|
|
5007
5060
|
]);
|
|
@@ -5029,7 +5082,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
5029
5082
|
|
|
5030
5083
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
5031
5084
|
import {
|
|
5032
|
-
applyToPoint as
|
|
5085
|
+
applyToPoint as applyToPoint30,
|
|
5033
5086
|
compose as compose4,
|
|
5034
5087
|
rotate as rotate4,
|
|
5035
5088
|
translate as translate4,
|
|
@@ -5039,7 +5092,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5039
5092
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
5040
5093
|
if (cutout.shape === "rect") {
|
|
5041
5094
|
const rectCutout = cutout;
|
|
5042
|
-
const [cx, cy] =
|
|
5095
|
+
const [cx, cy] = applyToPoint30(transform, [
|
|
5043
5096
|
rectCutout.center.x,
|
|
5044
5097
|
rectCutout.center.y
|
|
5045
5098
|
]);
|
|
@@ -5081,7 +5134,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5081
5134
|
}
|
|
5082
5135
|
if (cutout.shape === "circle") {
|
|
5083
5136
|
const circleCutout = cutout;
|
|
5084
|
-
const [cx, cy] =
|
|
5137
|
+
const [cx, cy] = applyToPoint30(transform, [
|
|
5085
5138
|
circleCutout.center.x,
|
|
5086
5139
|
circleCutout.center.y
|
|
5087
5140
|
]);
|
|
@@ -5108,7 +5161,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5108
5161
|
const polygonCutout = cutout;
|
|
5109
5162
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
5110
5163
|
const transformedPoints = polygonCutout.points.map(
|
|
5111
|
-
(p) =>
|
|
5164
|
+
(p) => applyToPoint30(transform, [p.x, p.y])
|
|
5112
5165
|
);
|
|
5113
5166
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5114
5167
|
return [
|
|
@@ -5130,9 +5183,39 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5130
5183
|
return [];
|
|
5131
5184
|
}
|
|
5132
5185
|
|
|
5186
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout-path.ts
|
|
5187
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
5188
|
+
function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
|
|
5189
|
+
const { transform, colorMap: colorMap2 } = ctx;
|
|
5190
|
+
if (!cutoutPath.route || !Array.isArray(cutoutPath.route)) return [];
|
|
5191
|
+
const firstPoint = cutoutPath.route[0];
|
|
5192
|
+
const lastPoint = cutoutPath.route[cutoutPath.route.length - 1];
|
|
5193
|
+
const isClosed = firstPoint && lastPoint && firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
|
|
5194
|
+
const path = cutoutPath.route.slice(0, isClosed ? -1 : void 0).map((point, index) => {
|
|
5195
|
+
const [x, y] = applyToPoint31(transform, [point.x, point.y]);
|
|
5196
|
+
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5197
|
+
}).join(" ") + (isClosed ? " Z" : "");
|
|
5198
|
+
return [
|
|
5199
|
+
{
|
|
5200
|
+
name: "path",
|
|
5201
|
+
type: "element",
|
|
5202
|
+
attributes: {
|
|
5203
|
+
class: "pcb-cutout pcb-cutout-path",
|
|
5204
|
+
d: path,
|
|
5205
|
+
fill: colorMap2.drill,
|
|
5206
|
+
"data-type": "pcb_cutout_path",
|
|
5207
|
+
"data-pcb-cutout-id": cutoutPath.pcb_cutout_id,
|
|
5208
|
+
"data-pcb-layer": "drill"
|
|
5209
|
+
},
|
|
5210
|
+
value: "",
|
|
5211
|
+
children: []
|
|
5212
|
+
}
|
|
5213
|
+
];
|
|
5214
|
+
}
|
|
5215
|
+
|
|
5133
5216
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-keepout.ts
|
|
5134
5217
|
import {
|
|
5135
|
-
applyToPoint as
|
|
5218
|
+
applyToPoint as applyToPoint32,
|
|
5136
5219
|
compose as compose5,
|
|
5137
5220
|
translate as translate5,
|
|
5138
5221
|
toString as matrixToString8
|
|
@@ -5149,7 +5232,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5149
5232
|
}
|
|
5150
5233
|
if (keepout.shape === "rect") {
|
|
5151
5234
|
const rectKeepout = keepout;
|
|
5152
|
-
const [cx, cy] =
|
|
5235
|
+
const [cx, cy] = applyToPoint32(transform, [
|
|
5153
5236
|
rectKeepout.center.x,
|
|
5154
5237
|
rectKeepout.center.y
|
|
5155
5238
|
]);
|
|
@@ -5183,7 +5266,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5183
5266
|
});
|
|
5184
5267
|
} else if (keepout.shape === "circle") {
|
|
5185
5268
|
const circleKeepout = keepout;
|
|
5186
|
-
const [cx, cy] =
|
|
5269
|
+
const [cx, cy] = applyToPoint32(transform, [
|
|
5187
5270
|
circleKeepout.center.x,
|
|
5188
5271
|
circleKeepout.center.y
|
|
5189
5272
|
]);
|
|
@@ -5219,7 +5302,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5219
5302
|
|
|
5220
5303
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
5221
5304
|
import {
|
|
5222
|
-
applyToPoint as
|
|
5305
|
+
applyToPoint as applyToPoint34,
|
|
5223
5306
|
compose as compose6,
|
|
5224
5307
|
rotate as rotate5,
|
|
5225
5308
|
toString as matrixToString9,
|
|
@@ -5227,11 +5310,11 @@ import {
|
|
|
5227
5310
|
} from "transformation-matrix";
|
|
5228
5311
|
|
|
5229
5312
|
// lib/utils/ring-to-path-d.ts
|
|
5230
|
-
import { applyToPoint as
|
|
5313
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
5231
5314
|
function ringToPathD(vertices, transform) {
|
|
5232
5315
|
if (vertices.length === 0) return "";
|
|
5233
5316
|
const transformedVertices = vertices.map((v) => {
|
|
5234
|
-
const [x, y] =
|
|
5317
|
+
const [x, y] = applyToPoint33(transform, [v.x, v.y]);
|
|
5235
5318
|
return { ...v, x, y };
|
|
5236
5319
|
});
|
|
5237
5320
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -5320,7 +5403,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5320
5403
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
5321
5404
|
const maskOverlayOpacity = "0.9";
|
|
5322
5405
|
if (pour.shape === "rect") {
|
|
5323
|
-
const [cx, cy] =
|
|
5406
|
+
const [cx, cy] = applyToPoint34(transform, [pour.center.x, pour.center.y]);
|
|
5324
5407
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
5325
5408
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
5326
5409
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -5372,7 +5455,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5372
5455
|
if (pour.shape === "polygon") {
|
|
5373
5456
|
if (!pour.points || pour.points.length === 0) return [];
|
|
5374
5457
|
const transformedPoints = pour.points.map(
|
|
5375
|
-
(p) =>
|
|
5458
|
+
(p) => applyToPoint34(transform, [p.x, p.y])
|
|
5376
5459
|
);
|
|
5377
5460
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5378
5461
|
const copperPolygon = {
|
|
@@ -5595,11 +5678,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
5595
5678
|
}
|
|
5596
5679
|
|
|
5597
5680
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
5598
|
-
import { applyToPoint as
|
|
5681
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
5599
5682
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
5600
5683
|
const { transform, circuitJson } = ctx;
|
|
5601
5684
|
const { center, width, height, rotation = 0 } = component;
|
|
5602
|
-
const [x, y] =
|
|
5685
|
+
const [x, y] = applyToPoint35(transform, [center.x, center.y]);
|
|
5603
5686
|
const scaledWidth = width * Math.abs(transform.a);
|
|
5604
5687
|
const scaledHeight = height * Math.abs(transform.d);
|
|
5605
5688
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -5671,7 +5754,7 @@ function getParentAnchorPosition(component, circuitJson) {
|
|
|
5671
5754
|
}
|
|
5672
5755
|
|
|
5673
5756
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
5674
|
-
import { applyToPoint as
|
|
5757
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
5675
5758
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
5676
5759
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
5677
5760
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -5715,7 +5798,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5715
5798
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
5716
5799
|
)) {
|
|
5717
5800
|
const path = outline.map((point, index) => {
|
|
5718
|
-
const [x, y] =
|
|
5801
|
+
const [x, y] = applyToPoint36(transform, [point.x, point.y]);
|
|
5719
5802
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5720
5803
|
}).join(" ");
|
|
5721
5804
|
svgObjects.push({
|
|
@@ -5736,11 +5819,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5736
5819
|
}
|
|
5737
5820
|
const halfWidth = width / 2;
|
|
5738
5821
|
const halfHeight = height / 2;
|
|
5739
|
-
const [topLeftX, topLeftY] =
|
|
5822
|
+
const [topLeftX, topLeftY] = applyToPoint36(transform, [
|
|
5740
5823
|
center.x - halfWidth,
|
|
5741
5824
|
center.y + halfHeight
|
|
5742
5825
|
]);
|
|
5743
|
-
const [bottomRightX, bottomRightY] =
|
|
5826
|
+
const [bottomRightX, bottomRightY] = applyToPoint36(transform, [
|
|
5744
5827
|
center.x + halfWidth,
|
|
5745
5828
|
center.y - halfHeight
|
|
5746
5829
|
]);
|
|
@@ -5794,7 +5877,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5794
5877
|
var package_default = {
|
|
5795
5878
|
name: "circuit-to-svg",
|
|
5796
5879
|
type: "module",
|
|
5797
|
-
version: "0.0.
|
|
5880
|
+
version: "0.0.303",
|
|
5798
5881
|
description: "Convert Circuit JSON to SVG",
|
|
5799
5882
|
main: "dist/index.js",
|
|
5800
5883
|
files: [
|
|
@@ -5817,7 +5900,7 @@ var package_default = {
|
|
|
5817
5900
|
"@vitejs/plugin-react": "5.0.0",
|
|
5818
5901
|
biome: "^0.3.3",
|
|
5819
5902
|
"bun-match-svg": "^0.0.12",
|
|
5820
|
-
"circuit-json": "^0.0.
|
|
5903
|
+
"circuit-json": "^0.0.348",
|
|
5821
5904
|
esbuild: "^0.20.2",
|
|
5822
5905
|
"performance-now": "^2.1.0",
|
|
5823
5906
|
react: "19.1.0",
|
|
@@ -5851,6 +5934,7 @@ var TYPE_PRIORITY = {
|
|
|
5851
5934
|
pcb_panel: 5,
|
|
5852
5935
|
pcb_board: 10,
|
|
5853
5936
|
pcb_cutout: 15,
|
|
5937
|
+
pcb_cutout_path: 15,
|
|
5854
5938
|
pcb_keepout: 16,
|
|
5855
5939
|
pcb_hole: 18,
|
|
5856
5940
|
pcb_plated_hole_drill: 19,
|
|
@@ -5868,6 +5952,8 @@ var TYPE_PRIORITY = {
|
|
|
5868
5952
|
pcb_silkscreen_rect: 50,
|
|
5869
5953
|
pcb_silkscreen_circle: 50,
|
|
5870
5954
|
pcb_silkscreen_line: 50,
|
|
5955
|
+
pcb_silkscreen_oval: 50,
|
|
5956
|
+
pcb_silkscreen_pill: 50,
|
|
5871
5957
|
pcb_component: 60,
|
|
5872
5958
|
pcb_fabrication_note_text: 70,
|
|
5873
5959
|
pcb_fabrication_note_path: 70,
|
|
@@ -6085,6 +6171,11 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6085
6171
|
}
|
|
6086
6172
|
} else if (cutout.shape === "polygon") {
|
|
6087
6173
|
updateTraceBounds(cutout.points);
|
|
6174
|
+
} else if (cutout.shape === "path") {
|
|
6175
|
+
const cutoutPath = cutout;
|
|
6176
|
+
if (cutoutPath.route && Array.isArray(cutoutPath.route)) {
|
|
6177
|
+
updateTraceBounds(cutoutPath.route);
|
|
6178
|
+
}
|
|
6088
6179
|
}
|
|
6089
6180
|
} else if (circuitJsonElm.type === "pcb_keepout") {
|
|
6090
6181
|
const keepout = circuitJsonElm;
|
|
@@ -6096,7 +6187,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6096
6187
|
updateBounds(keepout.center, radius * 2, radius * 2);
|
|
6097
6188
|
}
|
|
6098
6189
|
}
|
|
6099
|
-
} else if (circuitJsonElm.type === "pcb_silkscreen_text" || circuitJsonElm.type === "pcb_silkscreen_rect" || circuitJsonElm.type === "pcb_silkscreen_circle" || circuitJsonElm.type === "pcb_silkscreen_line") {
|
|
6190
|
+
} else if (circuitJsonElm.type === "pcb_silkscreen_text" || circuitJsonElm.type === "pcb_silkscreen_rect" || circuitJsonElm.type === "pcb_silkscreen_circle" || circuitJsonElm.type === "pcb_silkscreen_line" || circuitJsonElm.type === "pcb_silkscreen_oval") {
|
|
6100
6191
|
updateSilkscreenBounds(circuitJsonElm);
|
|
6101
6192
|
} else if (circuitJsonElm.type === "pcb_copper_text") {
|
|
6102
6193
|
updateBounds(circuitJsonElm.anchor_position, 0, 0);
|
|
@@ -6360,6 +6451,12 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6360
6451
|
} else if (item.type === "pcb_silkscreen_line") {
|
|
6361
6452
|
updateBounds({ x: item.x1, y: item.y1 }, 0, 0);
|
|
6362
6453
|
updateBounds({ x: item.x2, y: item.y2 }, 0, 0);
|
|
6454
|
+
} else if (item.type === "pcb_silkscreen_oval") {
|
|
6455
|
+
const radiusX = distance2.parse(item.radius_x);
|
|
6456
|
+
const radiusY = distance2.parse(item.radius_y);
|
|
6457
|
+
if (radiusX !== void 0 && radiusY !== void 0) {
|
|
6458
|
+
updateBounds(item.center, radiusX * 2, radiusY * 2);
|
|
6459
|
+
}
|
|
6363
6460
|
} else if (item.type === "pcb_cutout") {
|
|
6364
6461
|
const cutout = item;
|
|
6365
6462
|
if (cutout.shape === "rect") {
|
|
@@ -6371,6 +6468,11 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6371
6468
|
}
|
|
6372
6469
|
} else if (cutout.shape === "polygon") {
|
|
6373
6470
|
updateTraceBounds(cutout.points);
|
|
6471
|
+
} else if (cutout.shape === "path") {
|
|
6472
|
+
const cutoutPath = cutout;
|
|
6473
|
+
if (cutoutPath.route && Array.isArray(cutoutPath.route)) {
|
|
6474
|
+
updateTraceBounds(cutoutPath.route);
|
|
6475
|
+
}
|
|
6374
6476
|
}
|
|
6375
6477
|
}
|
|
6376
6478
|
}
|
|
@@ -6413,6 +6515,8 @@ function createSvgObjects({
|
|
|
6413
6515
|
return createSvgObjectsFromPcbSilkscreenLine(elm, ctx);
|
|
6414
6516
|
case "pcb_silkscreen_pill":
|
|
6415
6517
|
return createSvgObjectsFromPcbSilkscreenPill(elm, ctx);
|
|
6518
|
+
case "pcb_silkscreen_oval":
|
|
6519
|
+
return createSvgObjectsFromPcbSilkscreenOval(elm, ctx);
|
|
6416
6520
|
case "pcb_copper_text":
|
|
6417
6521
|
return createSvgObjectsFromPcbCopperText(elm, ctx);
|
|
6418
6522
|
case "pcb_courtyard_rect":
|
|
@@ -6445,6 +6549,10 @@ function createSvgObjects({
|
|
|
6445
6549
|
case "pcb_via":
|
|
6446
6550
|
return createSvgObjectsFromPcbVia(elm, ctx);
|
|
6447
6551
|
case "pcb_cutout":
|
|
6552
|
+
const cutout = elm;
|
|
6553
|
+
if (cutout.shape === "path") {
|
|
6554
|
+
return createSvgObjectsFromPcbCutoutPath(cutout, ctx);
|
|
6555
|
+
}
|
|
6448
6556
|
return createSvgObjectsFromPcbCutout(elm, ctx);
|
|
6449
6557
|
case "pcb_keepout":
|
|
6450
6558
|
return createSvgObjectsFromPcbKeepout(
|
|
@@ -6458,8 +6566,8 @@ function createSvgObjects({
|
|
|
6458
6566
|
}
|
|
6459
6567
|
}
|
|
6460
6568
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
6461
|
-
const [x1, y1] =
|
|
6462
|
-
const [x2, y2] =
|
|
6569
|
+
const [x1, y1] = applyToPoint37(transform, [minX, minY]);
|
|
6570
|
+
const [x2, y2] = applyToPoint37(transform, [maxX, maxY]);
|
|
6463
6571
|
const width = Math.abs(x2 - x1);
|
|
6464
6572
|
const height = Math.abs(y2 - y1);
|
|
6465
6573
|
const x = Math.min(x1, x2);
|
|
@@ -6489,14 +6597,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
6489
6597
|
import { stringify as stringify2 } from "svgson";
|
|
6490
6598
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
6491
6599
|
import {
|
|
6492
|
-
applyToPoint as
|
|
6600
|
+
applyToPoint as applyToPoint44,
|
|
6493
6601
|
compose as compose8,
|
|
6494
6602
|
scale as scale4,
|
|
6495
6603
|
translate as translate8
|
|
6496
6604
|
} from "transformation-matrix";
|
|
6497
6605
|
|
|
6498
6606
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
6499
|
-
import { applyToPoint as
|
|
6607
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
6500
6608
|
var DEFAULT_BOARD_STYLE = {
|
|
6501
6609
|
fill: "none",
|
|
6502
6610
|
stroke: "rgb(0,0,0)",
|
|
@@ -6508,25 +6616,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6508
6616
|
let path;
|
|
6509
6617
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
6510
6618
|
path = outline.map((point, index) => {
|
|
6511
|
-
const [x, y] =
|
|
6619
|
+
const [x, y] = applyToPoint38(transform, [point.x, point.y]);
|
|
6512
6620
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
6513
6621
|
}).join(" ");
|
|
6514
6622
|
} else {
|
|
6515
6623
|
const halfWidth = width / 2;
|
|
6516
6624
|
const halfHeight = height / 2;
|
|
6517
|
-
const topLeft =
|
|
6625
|
+
const topLeft = applyToPoint38(transform, [
|
|
6518
6626
|
center.x - halfWidth,
|
|
6519
6627
|
center.y - halfHeight
|
|
6520
6628
|
]);
|
|
6521
|
-
const topRight =
|
|
6629
|
+
const topRight = applyToPoint38(transform, [
|
|
6522
6630
|
center.x + halfWidth,
|
|
6523
6631
|
center.y - halfHeight
|
|
6524
6632
|
]);
|
|
6525
|
-
const bottomRight =
|
|
6633
|
+
const bottomRight = applyToPoint38(transform, [
|
|
6526
6634
|
center.x + halfWidth,
|
|
6527
6635
|
center.y + halfHeight
|
|
6528
6636
|
]);
|
|
6529
|
-
const bottomLeft =
|
|
6637
|
+
const bottomLeft = applyToPoint38(transform, [
|
|
6530
6638
|
center.x - halfWidth,
|
|
6531
6639
|
center.y + halfHeight
|
|
6532
6640
|
]);
|
|
@@ -6552,7 +6660,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6552
6660
|
}
|
|
6553
6661
|
|
|
6554
6662
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
6555
|
-
import { applyToPoint as
|
|
6663
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
6556
6664
|
|
|
6557
6665
|
// lib/utils/get-sch-font-size.ts
|
|
6558
6666
|
import "transformation-matrix";
|
|
@@ -6578,8 +6686,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
6578
6686
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
6579
6687
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
6580
6688
|
return null;
|
|
6581
|
-
const [x, y] =
|
|
6582
|
-
const [pinX, pinY] =
|
|
6689
|
+
const [x, y] = applyToPoint40(transform, [center.x, center.y]);
|
|
6690
|
+
const [pinX, pinY] = applyToPoint40(transform, [portPosition.x, portPosition.y]);
|
|
6583
6691
|
const scaledWidth = width * Math.abs(transform.a);
|
|
6584
6692
|
const scaledHeight = height * Math.abs(transform.d);
|
|
6585
6693
|
const isTopLayer = layer === "top";
|
|
@@ -6741,11 +6849,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
6741
6849
|
}
|
|
6742
6850
|
|
|
6743
6851
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
6744
|
-
import { applyToPoint as
|
|
6852
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
6745
6853
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
6746
6854
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
6747
6855
|
const { transform } = ctx;
|
|
6748
|
-
const [x, y] =
|
|
6856
|
+
const [x, y] = applyToPoint41(transform, [hole.x, hole.y]);
|
|
6749
6857
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
6750
6858
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
6751
6859
|
const radius = scaledDiameter / 2;
|
|
@@ -6809,12 +6917,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
6809
6917
|
}
|
|
6810
6918
|
|
|
6811
6919
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
6812
|
-
import { applyToPoint as
|
|
6920
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
6813
6921
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
6814
6922
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
6815
6923
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
6816
6924
|
const { transform } = ctx;
|
|
6817
|
-
const [x, y] =
|
|
6925
|
+
const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
|
|
6818
6926
|
if (hole.shape === "pill") {
|
|
6819
6927
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
6820
6928
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -6909,7 +7017,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6909
7017
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
6910
7018
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
6911
7019
|
const holeRadius = scaledHoleDiameter / 2;
|
|
6912
|
-
const [holeCx, holeCy] =
|
|
7020
|
+
const [holeCx, holeCy] = applyToPoint42(transform, [
|
|
6913
7021
|
circularHole.x + circularHole.hole_offset_x,
|
|
6914
7022
|
circularHole.y + circularHole.hole_offset_y
|
|
6915
7023
|
]);
|
|
@@ -6967,7 +7075,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6967
7075
|
const pillHoleWithOffsets = pillHole;
|
|
6968
7076
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
6969
7077
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
6970
|
-
const [holeCenterX, holeCenterY] =
|
|
7078
|
+
const [holeCenterX, holeCenterY] = applyToPoint42(transform, [
|
|
6971
7079
|
pillHole.x + holeOffsetX,
|
|
6972
7080
|
pillHole.y + holeOffsetY
|
|
6973
7081
|
]);
|
|
@@ -7029,7 +7137,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7029
7137
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
7030
7138
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
7031
7139
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
7032
|
-
const [holeCenterX, holeCenterY] =
|
|
7140
|
+
const [holeCenterX, holeCenterY] = applyToPoint42(transform, [
|
|
7033
7141
|
rotatedHole.x + holeOffsetX,
|
|
7034
7142
|
rotatedHole.y + holeOffsetY
|
|
7035
7143
|
]);
|
|
@@ -7085,14 +7193,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7085
7193
|
}
|
|
7086
7194
|
|
|
7087
7195
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
7088
|
-
import { applyToPoint as
|
|
7196
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
7089
7197
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
7090
7198
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
7091
7199
|
const { transform } = ctx;
|
|
7092
7200
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7093
7201
|
const width = pad.width * Math.abs(transform.a);
|
|
7094
7202
|
const height = pad.height * Math.abs(transform.d);
|
|
7095
|
-
const [x, y] =
|
|
7203
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7096
7204
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
7097
7205
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7098
7206
|
return [
|
|
@@ -7144,7 +7252,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7144
7252
|
const width = pad.width * Math.abs(transform.a);
|
|
7145
7253
|
const height = pad.height * Math.abs(transform.d);
|
|
7146
7254
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7147
|
-
const [x, y] =
|
|
7255
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7148
7256
|
return [
|
|
7149
7257
|
{
|
|
7150
7258
|
name: "rect",
|
|
@@ -7167,7 +7275,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7167
7275
|
}
|
|
7168
7276
|
if (pad.shape === "circle") {
|
|
7169
7277
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7170
|
-
const [x, y] =
|
|
7278
|
+
const [x, y] = applyToPoint43(transform, [pad.x, pad.y]);
|
|
7171
7279
|
return [
|
|
7172
7280
|
{
|
|
7173
7281
|
name: "circle",
|
|
@@ -7187,7 +7295,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7187
7295
|
}
|
|
7188
7296
|
if (pad.shape === "polygon") {
|
|
7189
7297
|
const points = (pad.points ?? []).map(
|
|
7190
|
-
(point) =>
|
|
7298
|
+
(point) => applyToPoint43(transform, [point.x, point.y])
|
|
7191
7299
|
);
|
|
7192
7300
|
return [
|
|
7193
7301
|
{
|
|
@@ -7371,8 +7479,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
7371
7479
|
}
|
|
7372
7480
|
}
|
|
7373
7481
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
7374
|
-
const [x1, y1] =
|
|
7375
|
-
const [x2, y2] =
|
|
7482
|
+
const [x1, y1] = applyToPoint44(transform, [minX, minY]);
|
|
7483
|
+
const [x2, y2] = applyToPoint44(transform, [maxX, maxY]);
|
|
7376
7484
|
const width = Math.abs(x2 - x1);
|
|
7377
7485
|
const height = Math.abs(y2 - y1);
|
|
7378
7486
|
const x = Math.min(x1, x2);
|
|
@@ -7401,7 +7509,7 @@ import {
|
|
|
7401
7509
|
} from "transformation-matrix";
|
|
7402
7510
|
|
|
7403
7511
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
7404
|
-
import { applyToPoint as
|
|
7512
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
7405
7513
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
7406
7514
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
7407
7515
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -7415,25 +7523,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7415
7523
|
let path;
|
|
7416
7524
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
7417
7525
|
path = outline.map((point, index) => {
|
|
7418
|
-
const [x, y] =
|
|
7526
|
+
const [x, y] = applyToPoint45(transform, [point.x, point.y]);
|
|
7419
7527
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
7420
7528
|
}).join(" ");
|
|
7421
7529
|
} else {
|
|
7422
7530
|
const halfWidth = width / 2;
|
|
7423
7531
|
const halfHeight = height / 2;
|
|
7424
|
-
const topLeft =
|
|
7532
|
+
const topLeft = applyToPoint45(transform, [
|
|
7425
7533
|
center.x - halfWidth,
|
|
7426
7534
|
center.y - halfHeight
|
|
7427
7535
|
]);
|
|
7428
|
-
const topRight =
|
|
7536
|
+
const topRight = applyToPoint45(transform, [
|
|
7429
7537
|
center.x + halfWidth,
|
|
7430
7538
|
center.y - halfHeight
|
|
7431
7539
|
]);
|
|
7432
|
-
const bottomRight =
|
|
7540
|
+
const bottomRight = applyToPoint45(transform, [
|
|
7433
7541
|
center.x + halfWidth,
|
|
7434
7542
|
center.y + halfHeight
|
|
7435
7543
|
]);
|
|
7436
|
-
const bottomLeft =
|
|
7544
|
+
const bottomLeft = applyToPoint45(transform, [
|
|
7437
7545
|
center.x - halfWidth,
|
|
7438
7546
|
center.y + halfHeight
|
|
7439
7547
|
]);
|
|
@@ -7451,10 +7559,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7451
7559
|
const halfWidth = width2 / 2;
|
|
7452
7560
|
const halfHeight = height2 / 2;
|
|
7453
7561
|
const [tl, tr, br, bl] = [
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7562
|
+
applyToPoint45(transform, [x - halfWidth, y - halfHeight]),
|
|
7563
|
+
applyToPoint45(transform, [x + halfWidth, y - halfHeight]),
|
|
7564
|
+
applyToPoint45(transform, [x + halfWidth, y + halfHeight]),
|
|
7565
|
+
applyToPoint45(transform, [x - halfWidth, y + halfHeight])
|
|
7458
7566
|
];
|
|
7459
7567
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
7460
7568
|
} else if (cutout.shape === "circle") {
|
|
@@ -7504,7 +7612,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7504
7612
|
|
|
7505
7613
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
7506
7614
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
7507
|
-
import { applyToPoint as
|
|
7615
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
7508
7616
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
7509
7617
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
7510
7618
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -7514,7 +7622,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7514
7622
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
7515
7623
|
return [];
|
|
7516
7624
|
}
|
|
7517
|
-
const [x, y] =
|
|
7625
|
+
const [x, y] = applyToPoint46(transform, [center.x, center.y]);
|
|
7518
7626
|
const scaledWidth = width * Math.abs(transform.a);
|
|
7519
7627
|
const scaledHeight = height * Math.abs(transform.d);
|
|
7520
7628
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -7575,11 +7683,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7575
7683
|
}
|
|
7576
7684
|
|
|
7577
7685
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
7578
|
-
import { applyToPoint as
|
|
7686
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7579
7687
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
7580
7688
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
7581
7689
|
const { transform } = ctx;
|
|
7582
|
-
const [x, y] =
|
|
7690
|
+
const [x, y] = applyToPoint47(transform, [hole.x, hole.y]);
|
|
7583
7691
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
7584
7692
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
7585
7693
|
const radius = scaledDiameter / 2;
|
|
@@ -7643,12 +7751,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
7643
7751
|
}
|
|
7644
7752
|
|
|
7645
7753
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
7646
|
-
import { applyToPoint as
|
|
7754
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7647
7755
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
7648
7756
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
7649
7757
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
7650
7758
|
const { transform } = ctx;
|
|
7651
|
-
const [x, y] =
|
|
7759
|
+
const [x, y] = applyToPoint48(transform, [hole.x, hole.y]);
|
|
7652
7760
|
if (hole.shape === "pill") {
|
|
7653
7761
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
7654
7762
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -7883,14 +7991,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
7883
7991
|
}
|
|
7884
7992
|
|
|
7885
7993
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
7886
|
-
import { applyToPoint as
|
|
7994
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7887
7995
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
7888
7996
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
7889
7997
|
const { transform } = ctx;
|
|
7890
7998
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7891
7999
|
const width = pad.width * Math.abs(transform.a);
|
|
7892
8000
|
const height = pad.height * Math.abs(transform.d);
|
|
7893
|
-
const [x, y] =
|
|
8001
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
7894
8002
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7895
8003
|
return [
|
|
7896
8004
|
{
|
|
@@ -7933,7 +8041,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7933
8041
|
const width = pad.width * Math.abs(transform.a);
|
|
7934
8042
|
const height = pad.height * Math.abs(transform.d);
|
|
7935
8043
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7936
|
-
const [x, y] =
|
|
8044
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
7937
8045
|
return [
|
|
7938
8046
|
{
|
|
7939
8047
|
name: "rect",
|
|
@@ -7956,7 +8064,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7956
8064
|
}
|
|
7957
8065
|
if (pad.shape === "circle") {
|
|
7958
8066
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7959
|
-
const [x, y] =
|
|
8067
|
+
const [x, y] = applyToPoint49(transform, [pad.x, pad.y]);
|
|
7960
8068
|
return [
|
|
7961
8069
|
{
|
|
7962
8070
|
name: "circle",
|
|
@@ -7976,7 +8084,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7976
8084
|
}
|
|
7977
8085
|
if (pad.shape === "polygon") {
|
|
7978
8086
|
const points = (pad.points ?? []).map(
|
|
7979
|
-
(point) =>
|
|
8087
|
+
(point) => applyToPoint49(transform, [point.x, point.y])
|
|
7980
8088
|
);
|
|
7981
8089
|
return [
|
|
7982
8090
|
{
|
|
@@ -7997,7 +8105,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7997
8105
|
}
|
|
7998
8106
|
|
|
7999
8107
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
8000
|
-
import { applyToPoint as
|
|
8108
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
8001
8109
|
import { calculateElbow } from "calculate-elbow";
|
|
8002
8110
|
|
|
8003
8111
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -8074,7 +8182,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8074
8182
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
8075
8183
|
if (!label_info) return [];
|
|
8076
8184
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
8077
|
-
const [port_x, port_y] =
|
|
8185
|
+
const [port_x, port_y] = applyToPoint50(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
8078
8186
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
8079
8187
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
8080
8188
|
const elbow_path = calculateElbow(
|
|
@@ -8215,7 +8323,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8215
8323
|
}
|
|
8216
8324
|
|
|
8217
8325
|
// lib/pinout/calculate-label-positions.ts
|
|
8218
|
-
import { applyToPoint as
|
|
8326
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
8219
8327
|
|
|
8220
8328
|
// lib/pinout/constants.ts
|
|
8221
8329
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -8253,7 +8361,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8253
8361
|
);
|
|
8254
8362
|
const mapToEdgePort = (pinout_label) => ({
|
|
8255
8363
|
pcb_port: pinout_label.pcb_port,
|
|
8256
|
-
y:
|
|
8364
|
+
y: applyToPoint51(transform, [
|
|
8257
8365
|
pinout_label.pcb_port.x,
|
|
8258
8366
|
pinout_label.pcb_port.y
|
|
8259
8367
|
])[1],
|
|
@@ -8268,7 +8376,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8268
8376
|
} else {
|
|
8269
8377
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
8270
8378
|
pcb_port: pinout_label.pcb_port,
|
|
8271
|
-
y:
|
|
8379
|
+
y: applyToPoint51(transform, [
|
|
8272
8380
|
pinout_label.pcb_port.x,
|
|
8273
8381
|
pinout_label.pcb_port.y
|
|
8274
8382
|
])[1],
|
|
@@ -8276,7 +8384,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8276
8384
|
})).sort((a, b) => a.y - b.y);
|
|
8277
8385
|
}
|
|
8278
8386
|
if (edge_ports.length === 0) return;
|
|
8279
|
-
const board_edge_x =
|
|
8387
|
+
const board_edge_x = applyToPoint51(transform, [
|
|
8280
8388
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
8281
8389
|
0
|
|
8282
8390
|
])[0];
|
|
@@ -8698,14 +8806,14 @@ import {
|
|
|
8698
8806
|
} from "transformation-matrix";
|
|
8699
8807
|
|
|
8700
8808
|
// lib/sch/draw-schematic-grid.ts
|
|
8701
|
-
import { applyToPoint as
|
|
8809
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
8702
8810
|
function drawSchematicGrid(params) {
|
|
8703
8811
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
8704
8812
|
const cellSize = params.cellSize ?? 1;
|
|
8705
8813
|
const labelCells = params.labelCells ?? false;
|
|
8706
8814
|
const gridLines = [];
|
|
8707
8815
|
const transformPoint = (x, y) => {
|
|
8708
|
-
const [transformedX, transformedY] =
|
|
8816
|
+
const [transformedX, transformedY] = applyToPoint52(params.transform, [x, y]);
|
|
8709
8817
|
return { x: transformedX, y: transformedY };
|
|
8710
8818
|
};
|
|
8711
8819
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -8786,15 +8894,15 @@ function drawSchematicGrid(params) {
|
|
|
8786
8894
|
}
|
|
8787
8895
|
|
|
8788
8896
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
8789
|
-
import { applyToPoint as
|
|
8897
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
8790
8898
|
function drawSchematicLabeledPoints(params) {
|
|
8791
8899
|
const { points, transform } = params;
|
|
8792
8900
|
const labeledPointsGroup = [];
|
|
8793
8901
|
for (const point of points) {
|
|
8794
|
-
const [x1, y1] =
|
|
8795
|
-
const [x2, y2] =
|
|
8796
|
-
const [x3, y3] =
|
|
8797
|
-
const [x4, y4] =
|
|
8902
|
+
const [x1, y1] = applyToPoint53(transform, [point.x - 0.1, point.y - 0.1]);
|
|
8903
|
+
const [x2, y2] = applyToPoint53(transform, [point.x + 0.1, point.y + 0.1]);
|
|
8904
|
+
const [x3, y3] = applyToPoint53(transform, [point.x - 0.1, point.y + 0.1]);
|
|
8905
|
+
const [x4, y4] = applyToPoint53(transform, [point.x + 0.1, point.y - 0.1]);
|
|
8798
8906
|
labeledPointsGroup.push({
|
|
8799
8907
|
name: "path",
|
|
8800
8908
|
type: "element",
|
|
@@ -8805,7 +8913,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
8805
8913
|
"stroke-opacity": "0.7"
|
|
8806
8914
|
}
|
|
8807
8915
|
});
|
|
8808
|
-
const [labelX, labelY] =
|
|
8916
|
+
const [labelX, labelY] = applyToPoint53(transform, [
|
|
8809
8917
|
point.x + 0.15,
|
|
8810
8918
|
point.y - 0.15
|
|
8811
8919
|
]);
|
|
@@ -9923,7 +10031,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
9923
10031
|
import { symbols } from "schematic-symbols";
|
|
9924
10032
|
import "svgson";
|
|
9925
10033
|
import {
|
|
9926
|
-
applyToPoint as
|
|
10034
|
+
applyToPoint as applyToPoint55,
|
|
9927
10035
|
compose as compose11
|
|
9928
10036
|
} from "transformation-matrix";
|
|
9929
10037
|
|
|
@@ -10007,13 +10115,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
10007
10115
|
}
|
|
10008
10116
|
|
|
10009
10117
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
10010
|
-
import { applyToPoint as
|
|
10118
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
10011
10119
|
var createSvgSchErrorText = ({
|
|
10012
10120
|
text,
|
|
10013
10121
|
realCenter,
|
|
10014
10122
|
realToScreenTransform
|
|
10015
10123
|
}) => {
|
|
10016
|
-
const screenCenter =
|
|
10124
|
+
const screenCenter = applyToPoint54(realToScreenTransform, realCenter);
|
|
10017
10125
|
return {
|
|
10018
10126
|
type: "element",
|
|
10019
10127
|
name: "text",
|
|
@@ -10122,11 +10230,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10122
10230
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
10123
10231
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
10124
10232
|
};
|
|
10125
|
-
const [screenMinX, screenMinY] =
|
|
10233
|
+
const [screenMinX, screenMinY] = applyToPoint55(
|
|
10126
10234
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10127
10235
|
[bounds.minX, bounds.minY]
|
|
10128
10236
|
);
|
|
10129
|
-
const [screenMaxX, screenMaxY] =
|
|
10237
|
+
const [screenMaxX, screenMaxY] = applyToPoint55(
|
|
10130
10238
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10131
10239
|
[bounds.maxX, bounds.maxY]
|
|
10132
10240
|
);
|
|
@@ -10155,7 +10263,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10155
10263
|
name: "path",
|
|
10156
10264
|
attributes: {
|
|
10157
10265
|
d: points.map((p, i) => {
|
|
10158
|
-
const [x, y] =
|
|
10266
|
+
const [x, y] = applyToPoint55(
|
|
10159
10267
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10160
10268
|
[p.x, p.y]
|
|
10161
10269
|
);
|
|
@@ -10171,7 +10279,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10171
10279
|
});
|
|
10172
10280
|
}
|
|
10173
10281
|
for (const text of texts) {
|
|
10174
|
-
const screenTextPos =
|
|
10282
|
+
const screenTextPos = applyToPoint55(
|
|
10175
10283
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10176
10284
|
text
|
|
10177
10285
|
);
|
|
@@ -10223,7 +10331,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10223
10331
|
});
|
|
10224
10332
|
}
|
|
10225
10333
|
for (const box of boxes) {
|
|
10226
|
-
const screenBoxPos =
|
|
10334
|
+
const screenBoxPos = applyToPoint55(
|
|
10227
10335
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10228
10336
|
box
|
|
10229
10337
|
);
|
|
@@ -10247,7 +10355,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10247
10355
|
}
|
|
10248
10356
|
for (const port of symbol.ports) {
|
|
10249
10357
|
if (connectedSymbolPorts.has(port)) continue;
|
|
10250
|
-
const screenPortPos =
|
|
10358
|
+
const screenPortPos = applyToPoint55(
|
|
10251
10359
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10252
10360
|
port
|
|
10253
10361
|
);
|
|
@@ -10267,7 +10375,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10267
10375
|
});
|
|
10268
10376
|
}
|
|
10269
10377
|
for (const circle of circles) {
|
|
10270
|
-
const screenCirclePos =
|
|
10378
|
+
const screenCirclePos = applyToPoint55(
|
|
10271
10379
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10272
10380
|
circle
|
|
10273
10381
|
);
|
|
@@ -10294,14 +10402,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10294
10402
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
10295
10403
|
import "schematic-symbols";
|
|
10296
10404
|
import "svgson";
|
|
10297
|
-
import { applyToPoint as
|
|
10405
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
10298
10406
|
|
|
10299
10407
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
10300
10408
|
import "transformation-matrix";
|
|
10301
10409
|
import "@tscircuit/circuit-json-util";
|
|
10302
10410
|
|
|
10303
10411
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
10304
|
-
import { applyToPoint as
|
|
10412
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
10305
10413
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
10306
10414
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
10307
10415
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -10354,8 +10462,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10354
10462
|
realEdgePos.y += realPinLineLength;
|
|
10355
10463
|
break;
|
|
10356
10464
|
}
|
|
10357
|
-
const screenSchPortPos =
|
|
10358
|
-
const screenRealEdgePos =
|
|
10465
|
+
const screenSchPortPos = applyToPoint56(transform, schPort.center);
|
|
10466
|
+
const screenRealEdgePos = applyToPoint56(transform, realEdgePos);
|
|
10359
10467
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
10360
10468
|
const realLineEnd = { ...schPort.center };
|
|
10361
10469
|
if (!isConnected) {
|
|
@@ -10374,7 +10482,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10374
10482
|
break;
|
|
10375
10483
|
}
|
|
10376
10484
|
}
|
|
10377
|
-
const screenLineEnd =
|
|
10485
|
+
const screenLineEnd = applyToPoint56(transform, realLineEnd);
|
|
10378
10486
|
svgObjects.push({
|
|
10379
10487
|
name: "line",
|
|
10380
10488
|
type: "element",
|
|
@@ -10495,7 +10603,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10495
10603
|
};
|
|
10496
10604
|
|
|
10497
10605
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
10498
|
-
import { applyToPoint as
|
|
10606
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
10499
10607
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
10500
10608
|
const svgObjects = [];
|
|
10501
10609
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -10513,7 +10621,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10513
10621
|
} else {
|
|
10514
10622
|
realPinNumberPos.y += 0.02;
|
|
10515
10623
|
}
|
|
10516
|
-
const screenPinNumberTextPos =
|
|
10624
|
+
const screenPinNumberTextPos = applyToPoint57(transform, realPinNumberPos);
|
|
10517
10625
|
svgObjects.push({
|
|
10518
10626
|
name: "text",
|
|
10519
10627
|
type: "element",
|
|
@@ -10543,7 +10651,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10543
10651
|
};
|
|
10544
10652
|
|
|
10545
10653
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
10546
|
-
import { applyToPoint as
|
|
10654
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
10547
10655
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
10548
10656
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
10549
10657
|
const svgObjects = [];
|
|
@@ -10557,7 +10665,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
10557
10665
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
10558
10666
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10559
10667
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10560
|
-
const screenPinNumberTextPos =
|
|
10668
|
+
const screenPinNumberTextPos = applyToPoint58(transform, realPinNumberPos);
|
|
10561
10669
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
10562
10670
|
if (!label) return [];
|
|
10563
10671
|
const isNegated = label.startsWith("N_");
|
|
@@ -10605,13 +10713,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
10605
10713
|
};
|
|
10606
10714
|
|
|
10607
10715
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
10608
|
-
import { applyToPoint as
|
|
10716
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
10609
10717
|
var createSvgSchText = ({
|
|
10610
10718
|
elm,
|
|
10611
10719
|
transform,
|
|
10612
10720
|
colorMap: colorMap2
|
|
10613
10721
|
}) => {
|
|
10614
|
-
const center =
|
|
10722
|
+
const center = applyToPoint60(transform, elm.position);
|
|
10615
10723
|
const textAnchorMap = {
|
|
10616
10724
|
center: "middle",
|
|
10617
10725
|
center_right: "end",
|
|
@@ -10695,11 +10803,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
10695
10803
|
colorMap: colorMap2
|
|
10696
10804
|
}) => {
|
|
10697
10805
|
const svgObjects = [];
|
|
10698
|
-
const componentScreenTopLeft =
|
|
10806
|
+
const componentScreenTopLeft = applyToPoint61(transform, {
|
|
10699
10807
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
10700
10808
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
10701
10809
|
});
|
|
10702
|
-
const componentScreenBottomRight =
|
|
10810
|
+
const componentScreenBottomRight = applyToPoint61(transform, {
|
|
10703
10811
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
10704
10812
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
10705
10813
|
});
|
|
@@ -10785,13 +10893,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
10785
10893
|
}
|
|
10786
10894
|
|
|
10787
10895
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
10788
|
-
import { applyToPoint as
|
|
10896
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
10789
10897
|
function createSvgObjectsFromSchVoltageProbe({
|
|
10790
10898
|
probe,
|
|
10791
10899
|
transform,
|
|
10792
10900
|
colorMap: colorMap2
|
|
10793
10901
|
}) {
|
|
10794
|
-
const [screenX, screenY] =
|
|
10902
|
+
const [screenX, screenY] = applyToPoint62(transform, [
|
|
10795
10903
|
probe.position.x,
|
|
10796
10904
|
probe.position.y
|
|
10797
10905
|
]);
|
|
@@ -10965,17 +11073,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
10965
11073
|
}
|
|
10966
11074
|
|
|
10967
11075
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
10968
|
-
import { applyToPoint as
|
|
11076
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
10969
11077
|
function createSvgObjectsFromSchDebugObject({
|
|
10970
11078
|
debugObject,
|
|
10971
11079
|
transform
|
|
10972
11080
|
}) {
|
|
10973
11081
|
if (debugObject.shape === "rect") {
|
|
10974
|
-
let [screenLeft, screenTop] =
|
|
11082
|
+
let [screenLeft, screenTop] = applyToPoint63(transform, [
|
|
10975
11083
|
debugObject.center.x - debugObject.size.width / 2,
|
|
10976
11084
|
debugObject.center.y - debugObject.size.height / 2
|
|
10977
11085
|
]);
|
|
10978
|
-
let [screenRight, screenBottom] =
|
|
11086
|
+
let [screenRight, screenBottom] = applyToPoint63(transform, [
|
|
10979
11087
|
debugObject.center.x + debugObject.size.width / 2,
|
|
10980
11088
|
debugObject.center.y + debugObject.size.height / 2
|
|
10981
11089
|
]);
|
|
@@ -10985,7 +11093,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
10985
11093
|
];
|
|
10986
11094
|
const width = Math.abs(screenRight - screenLeft);
|
|
10987
11095
|
const height = Math.abs(screenBottom - screenTop);
|
|
10988
|
-
const [screenCenterX, screenCenterY] =
|
|
11096
|
+
const [screenCenterX, screenCenterY] = applyToPoint63(transform, [
|
|
10989
11097
|
debugObject.center.x,
|
|
10990
11098
|
debugObject.center.y
|
|
10991
11099
|
]);
|
|
@@ -11031,11 +11139,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11031
11139
|
];
|
|
11032
11140
|
}
|
|
11033
11141
|
if (debugObject.shape === "line") {
|
|
11034
|
-
const [screenStartX, screenStartY] =
|
|
11142
|
+
const [screenStartX, screenStartY] = applyToPoint63(transform, [
|
|
11035
11143
|
debugObject.start.x,
|
|
11036
11144
|
debugObject.start.y
|
|
11037
11145
|
]);
|
|
11038
|
-
const [screenEndX, screenEndY] =
|
|
11146
|
+
const [screenEndX, screenEndY] = applyToPoint63(transform, [
|
|
11039
11147
|
debugObject.end.x,
|
|
11040
11148
|
debugObject.end.y
|
|
11041
11149
|
]);
|
|
@@ -11085,7 +11193,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11085
11193
|
}
|
|
11086
11194
|
|
|
11087
11195
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
11088
|
-
import { applyToPoint as
|
|
11196
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
11089
11197
|
function createSchematicTrace({
|
|
11090
11198
|
trace,
|
|
11091
11199
|
transform,
|
|
@@ -11099,11 +11207,11 @@ function createSchematicTrace({
|
|
|
11099
11207
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
11100
11208
|
const edge = edges[edgeIndex];
|
|
11101
11209
|
if (edge.is_crossing) continue;
|
|
11102
|
-
const [screenFromX, screenFromY] =
|
|
11210
|
+
const [screenFromX, screenFromY] = applyToPoint64(transform, [
|
|
11103
11211
|
edge.from.x,
|
|
11104
11212
|
edge.from.y
|
|
11105
11213
|
]);
|
|
11106
|
-
const [screenToX, screenToY] =
|
|
11214
|
+
const [screenToX, screenToY] = applyToPoint64(transform, [
|
|
11107
11215
|
edge.to.x,
|
|
11108
11216
|
edge.to.y
|
|
11109
11217
|
]);
|
|
@@ -11147,11 +11255,11 @@ function createSchematicTrace({
|
|
|
11147
11255
|
}
|
|
11148
11256
|
for (const edge of edges) {
|
|
11149
11257
|
if (!edge.is_crossing) continue;
|
|
11150
|
-
const [screenFromX, screenFromY] =
|
|
11258
|
+
const [screenFromX, screenFromY] = applyToPoint64(transform, [
|
|
11151
11259
|
edge.from.x,
|
|
11152
11260
|
edge.from.y
|
|
11153
11261
|
]);
|
|
11154
|
-
const [screenToX, screenToY] =
|
|
11262
|
+
const [screenToX, screenToY] = applyToPoint64(transform, [
|
|
11155
11263
|
edge.to.x,
|
|
11156
11264
|
edge.to.y
|
|
11157
11265
|
]);
|
|
@@ -11195,7 +11303,7 @@ function createSchematicTrace({
|
|
|
11195
11303
|
}
|
|
11196
11304
|
if (trace.junctions) {
|
|
11197
11305
|
for (const junction of trace.junctions) {
|
|
11198
|
-
const [screenX, screenY] =
|
|
11306
|
+
const [screenX, screenY] = applyToPoint64(transform, [
|
|
11199
11307
|
junction.x,
|
|
11200
11308
|
junction.y
|
|
11201
11309
|
]);
|
|
@@ -11250,7 +11358,7 @@ function createSchematicTrace({
|
|
|
11250
11358
|
|
|
11251
11359
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
11252
11360
|
import {
|
|
11253
|
-
applyToPoint as
|
|
11361
|
+
applyToPoint as applyToPoint66,
|
|
11254
11362
|
compose as compose13,
|
|
11255
11363
|
rotate as rotate7,
|
|
11256
11364
|
scale as scale7,
|
|
@@ -11259,7 +11367,7 @@ import {
|
|
|
11259
11367
|
|
|
11260
11368
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
11261
11369
|
import {
|
|
11262
|
-
applyToPoint as
|
|
11370
|
+
applyToPoint as applyToPoint65,
|
|
11263
11371
|
compose as compose12,
|
|
11264
11372
|
rotate as rotate6,
|
|
11265
11373
|
scale as scale6,
|
|
@@ -11334,7 +11442,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11334
11442
|
x: symbolBounds.minX,
|
|
11335
11443
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
11336
11444
|
};
|
|
11337
|
-
const rotatedSymbolEnd =
|
|
11445
|
+
const rotatedSymbolEnd = applyToPoint65(rotationMatrix, symbolEndPoint);
|
|
11338
11446
|
const symbolToRealTransform = compose12(
|
|
11339
11447
|
translate12(
|
|
11340
11448
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -11344,11 +11452,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11344
11452
|
scale6(1)
|
|
11345
11453
|
// Use full symbol size
|
|
11346
11454
|
);
|
|
11347
|
-
const [screenMinX, screenMinY] =
|
|
11455
|
+
const [screenMinX, screenMinY] = applyToPoint65(
|
|
11348
11456
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11349
11457
|
[bounds.minX, bounds.minY]
|
|
11350
11458
|
);
|
|
11351
|
-
const [screenMaxX, screenMaxY] =
|
|
11459
|
+
const [screenMaxX, screenMaxY] = applyToPoint65(
|
|
11352
11460
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11353
11461
|
[bounds.maxX, bounds.maxY]
|
|
11354
11462
|
);
|
|
@@ -11372,7 +11480,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11372
11480
|
});
|
|
11373
11481
|
for (const path of symbolPaths) {
|
|
11374
11482
|
const symbolPath = path.points.map((p, i) => {
|
|
11375
|
-
const [x, y] =
|
|
11483
|
+
const [x, y] = applyToPoint65(
|
|
11376
11484
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11377
11485
|
[p.x, p.y]
|
|
11378
11486
|
);
|
|
@@ -11393,7 +11501,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11393
11501
|
});
|
|
11394
11502
|
}
|
|
11395
11503
|
for (const text of symbolTexts) {
|
|
11396
|
-
const screenTextPos =
|
|
11504
|
+
const screenTextPos = applyToPoint65(
|
|
11397
11505
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11398
11506
|
text
|
|
11399
11507
|
);
|
|
@@ -11435,7 +11543,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11435
11543
|
});
|
|
11436
11544
|
}
|
|
11437
11545
|
for (const box of symbolBoxes) {
|
|
11438
|
-
const screenBoxPos =
|
|
11546
|
+
const screenBoxPos = applyToPoint65(
|
|
11439
11547
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11440
11548
|
box
|
|
11441
11549
|
);
|
|
@@ -11458,7 +11566,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11458
11566
|
});
|
|
11459
11567
|
}
|
|
11460
11568
|
for (const circle of symbolCircles) {
|
|
11461
|
-
const screenCirclePos =
|
|
11569
|
+
const screenCirclePos = applyToPoint65(
|
|
11462
11570
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11463
11571
|
circle
|
|
11464
11572
|
);
|
|
@@ -11503,14 +11611,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11503
11611
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
11504
11612
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
11505
11613
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
11506
|
-
const screenCenter =
|
|
11614
|
+
const screenCenter = applyToPoint66(realToScreenTransform, schNetLabel.center);
|
|
11507
11615
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
11508
11616
|
schNetLabel.anchor_side
|
|
11509
11617
|
);
|
|
11510
11618
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
11511
11619
|
screenTextGrowthVec.y *= -1;
|
|
11512
11620
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
11513
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
11621
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint66(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
11514
11622
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
11515
11623
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
11516
11624
|
};
|
|
@@ -11551,7 +11659,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11551
11659
|
y: -0.6
|
|
11552
11660
|
}
|
|
11553
11661
|
].map(
|
|
11554
|
-
(fontRelativePoint) =>
|
|
11662
|
+
(fontRelativePoint) => applyToPoint66(
|
|
11555
11663
|
compose13(
|
|
11556
11664
|
realToScreenTransform,
|
|
11557
11665
|
translate13(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -11628,17 +11736,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11628
11736
|
};
|
|
11629
11737
|
|
|
11630
11738
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
11631
|
-
import { applyToPoint as
|
|
11739
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
11632
11740
|
var createSvgObjectsFromSchematicBox = ({
|
|
11633
11741
|
schematicBox,
|
|
11634
11742
|
transform,
|
|
11635
11743
|
colorMap: colorMap2
|
|
11636
11744
|
}) => {
|
|
11637
|
-
const topLeft =
|
|
11745
|
+
const topLeft = applyToPoint67(transform, {
|
|
11638
11746
|
x: schematicBox.x,
|
|
11639
11747
|
y: schematicBox.y
|
|
11640
11748
|
});
|
|
11641
|
-
const bottomRight =
|
|
11749
|
+
const bottomRight = applyToPoint67(transform, {
|
|
11642
11750
|
x: schematicBox.x + schematicBox.width,
|
|
11643
11751
|
y: schematicBox.y + schematicBox.height
|
|
11644
11752
|
});
|
|
@@ -11674,7 +11782,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
11674
11782
|
};
|
|
11675
11783
|
|
|
11676
11784
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
11677
|
-
import { applyToPoint as
|
|
11785
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
11678
11786
|
var createSvgObjectsFromSchematicTable = ({
|
|
11679
11787
|
schematicTable,
|
|
11680
11788
|
transform,
|
|
@@ -11707,11 +11815,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11707
11815
|
const svgObjects = [];
|
|
11708
11816
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
11709
11817
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
11710
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
11818
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint68(transform, [
|
|
11711
11819
|
topLeftX,
|
|
11712
11820
|
topLeftY
|
|
11713
11821
|
]);
|
|
11714
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
11822
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint68(transform, [
|
|
11715
11823
|
topLeftX + totalWidth,
|
|
11716
11824
|
topLeftY - totalHeight
|
|
11717
11825
|
]);
|
|
@@ -11743,8 +11851,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11743
11851
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
11744
11852
|
);
|
|
11745
11853
|
if (!isMerged) {
|
|
11746
|
-
const start =
|
|
11747
|
-
const end =
|
|
11854
|
+
const start = applyToPoint68(transform, { x: currentX, y: segmentStartY });
|
|
11855
|
+
const end = applyToPoint68(transform, { x: currentX, y: segmentEndY });
|
|
11748
11856
|
svgObjects.push({
|
|
11749
11857
|
name: "line",
|
|
11750
11858
|
type: "element",
|
|
@@ -11773,11 +11881,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11773
11881
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
11774
11882
|
);
|
|
11775
11883
|
if (!isMerged) {
|
|
11776
|
-
const start =
|
|
11884
|
+
const start = applyToPoint68(transform, {
|
|
11777
11885
|
x: segmentStartX,
|
|
11778
11886
|
y: currentY
|
|
11779
11887
|
});
|
|
11780
|
-
const end =
|
|
11888
|
+
const end = applyToPoint68(transform, { x: segmentEndX, y: currentY });
|
|
11781
11889
|
svgObjects.push({
|
|
11782
11890
|
name: "line",
|
|
11783
11891
|
type: "element",
|
|
@@ -11819,7 +11927,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11819
11927
|
} else if (vertical_align === "bottom") {
|
|
11820
11928
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
11821
11929
|
}
|
|
11822
|
-
const screenTextAnchorPos =
|
|
11930
|
+
const screenTextAnchorPos = applyToPoint68(transform, realTextAnchorPos);
|
|
11823
11931
|
const fontSize = getSchScreenFontSize(
|
|
11824
11932
|
transform,
|
|
11825
11933
|
"reference_designator",
|
|
@@ -11875,13 +11983,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11875
11983
|
|
|
11876
11984
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
11877
11985
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
11878
|
-
import { applyToPoint as
|
|
11986
|
+
import { applyToPoint as applyToPoint69 } from "transformation-matrix";
|
|
11879
11987
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
11880
11988
|
var createSvgObjectsForSchPortHover = ({
|
|
11881
11989
|
schPort,
|
|
11882
11990
|
transform
|
|
11883
11991
|
}) => {
|
|
11884
|
-
const screenSchPortPos =
|
|
11992
|
+
const screenSchPortPos = applyToPoint69(transform, schPort.center);
|
|
11885
11993
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
11886
11994
|
return [
|
|
11887
11995
|
{
|
|
@@ -11926,14 +12034,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
11926
12034
|
};
|
|
11927
12035
|
|
|
11928
12036
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
11929
|
-
import { applyToPoint as
|
|
12037
|
+
import { applyToPoint as applyToPoint70 } from "transformation-matrix";
|
|
11930
12038
|
function createSvgObjectsFromSchematicLine({
|
|
11931
12039
|
schLine,
|
|
11932
12040
|
transform,
|
|
11933
12041
|
colorMap: colorMap2
|
|
11934
12042
|
}) {
|
|
11935
|
-
const p1 =
|
|
11936
|
-
const p2 =
|
|
12043
|
+
const p1 = applyToPoint70(transform, { x: schLine.x1, y: schLine.y1 });
|
|
12044
|
+
const p2 = applyToPoint70(transform, { x: schLine.x2, y: schLine.y2 });
|
|
11937
12045
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
11938
12046
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
11939
12047
|
return [
|
|
@@ -11962,13 +12070,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
11962
12070
|
}
|
|
11963
12071
|
|
|
11964
12072
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
11965
|
-
import { applyToPoint as
|
|
12073
|
+
import { applyToPoint as applyToPoint71 } from "transformation-matrix";
|
|
11966
12074
|
function createSvgObjectsFromSchematicCircle({
|
|
11967
12075
|
schCircle,
|
|
11968
12076
|
transform,
|
|
11969
12077
|
colorMap: colorMap2
|
|
11970
12078
|
}) {
|
|
11971
|
-
const center =
|
|
12079
|
+
const center = applyToPoint71(transform, schCircle.center);
|
|
11972
12080
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
11973
12081
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
11974
12082
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -11998,13 +12106,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
11998
12106
|
}
|
|
11999
12107
|
|
|
12000
12108
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
12001
|
-
import { applyToPoint as
|
|
12109
|
+
import { applyToPoint as applyToPoint72 } from "transformation-matrix";
|
|
12002
12110
|
function createSvgObjectsFromSchematicRect({
|
|
12003
12111
|
schRect,
|
|
12004
12112
|
transform,
|
|
12005
12113
|
colorMap: colorMap2
|
|
12006
12114
|
}) {
|
|
12007
|
-
const center =
|
|
12115
|
+
const center = applyToPoint72(transform, schRect.center);
|
|
12008
12116
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
12009
12117
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
12010
12118
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -12040,13 +12148,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
12040
12148
|
}
|
|
12041
12149
|
|
|
12042
12150
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
12043
|
-
import { applyToPoint as
|
|
12151
|
+
import { applyToPoint as applyToPoint73 } from "transformation-matrix";
|
|
12044
12152
|
function createSvgObjectsFromSchematicArc({
|
|
12045
12153
|
schArc,
|
|
12046
12154
|
transform,
|
|
12047
12155
|
colorMap: colorMap2
|
|
12048
12156
|
}) {
|
|
12049
|
-
const center =
|
|
12157
|
+
const center = applyToPoint73(transform, schArc.center);
|
|
12050
12158
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
12051
12159
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
12052
12160
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -13166,18 +13274,18 @@ function formatNumber2(value) {
|
|
|
13166
13274
|
import { distance as distance3 } from "circuit-json";
|
|
13167
13275
|
import { stringify as stringify7 } from "svgson";
|
|
13168
13276
|
import {
|
|
13169
|
-
applyToPoint as
|
|
13277
|
+
applyToPoint as applyToPoint76,
|
|
13170
13278
|
compose as compose16,
|
|
13171
13279
|
scale as scale9,
|
|
13172
13280
|
translate as translate16
|
|
13173
13281
|
} from "transformation-matrix";
|
|
13174
13282
|
|
|
13175
13283
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
13176
|
-
import { applyToPoint as
|
|
13284
|
+
import { applyToPoint as applyToPoint75 } from "transformation-matrix";
|
|
13177
13285
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
13178
13286
|
const { transform, layer: layerFilter } = ctx;
|
|
13179
13287
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
13180
|
-
const [x, y] =
|
|
13288
|
+
const [x, y] = applyToPoint75(transform, [solderPaste.x, solderPaste.y]);
|
|
13181
13289
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
13182
13290
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
13183
13291
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -13403,8 +13511,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
13403
13511
|
}
|
|
13404
13512
|
}
|
|
13405
13513
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
13406
|
-
const [x1, y1] =
|
|
13407
|
-
const [x2, y2] =
|
|
13514
|
+
const [x1, y1] = applyToPoint76(transform, [minX, minY]);
|
|
13515
|
+
const [x2, y2] = applyToPoint76(transform, [maxX, maxY]);
|
|
13408
13516
|
const width = Math.abs(x2 - x1);
|
|
13409
13517
|
const height = Math.abs(y2 - y1);
|
|
13410
13518
|
const x = Math.min(x1, x2);
|