circuit-to-svg 0.0.302 → 0.0.303
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 +253 -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 applyToPoint36,
|
|
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 [
|
|
@@ -5132,7 +5185,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5132
5185
|
|
|
5133
5186
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-keepout.ts
|
|
5134
5187
|
import {
|
|
5135
|
-
applyToPoint as
|
|
5188
|
+
applyToPoint as applyToPoint31,
|
|
5136
5189
|
compose as compose5,
|
|
5137
5190
|
translate as translate5,
|
|
5138
5191
|
toString as matrixToString8
|
|
@@ -5149,7 +5202,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5149
5202
|
}
|
|
5150
5203
|
if (keepout.shape === "rect") {
|
|
5151
5204
|
const rectKeepout = keepout;
|
|
5152
|
-
const [cx, cy] =
|
|
5205
|
+
const [cx, cy] = applyToPoint31(transform, [
|
|
5153
5206
|
rectKeepout.center.x,
|
|
5154
5207
|
rectKeepout.center.y
|
|
5155
5208
|
]);
|
|
@@ -5183,7 +5236,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5183
5236
|
});
|
|
5184
5237
|
} else if (keepout.shape === "circle") {
|
|
5185
5238
|
const circleKeepout = keepout;
|
|
5186
|
-
const [cx, cy] =
|
|
5239
|
+
const [cx, cy] = applyToPoint31(transform, [
|
|
5187
5240
|
circleKeepout.center.x,
|
|
5188
5241
|
circleKeepout.center.y
|
|
5189
5242
|
]);
|
|
@@ -5219,7 +5272,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
5219
5272
|
|
|
5220
5273
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
5221
5274
|
import {
|
|
5222
|
-
applyToPoint as
|
|
5275
|
+
applyToPoint as applyToPoint33,
|
|
5223
5276
|
compose as compose6,
|
|
5224
5277
|
rotate as rotate5,
|
|
5225
5278
|
toString as matrixToString9,
|
|
@@ -5227,11 +5280,11 @@ import {
|
|
|
5227
5280
|
} from "transformation-matrix";
|
|
5228
5281
|
|
|
5229
5282
|
// lib/utils/ring-to-path-d.ts
|
|
5230
|
-
import { applyToPoint as
|
|
5283
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
5231
5284
|
function ringToPathD(vertices, transform) {
|
|
5232
5285
|
if (vertices.length === 0) return "";
|
|
5233
5286
|
const transformedVertices = vertices.map((v) => {
|
|
5234
|
-
const [x, y] =
|
|
5287
|
+
const [x, y] = applyToPoint32(transform, [v.x, v.y]);
|
|
5235
5288
|
return { ...v, x, y };
|
|
5236
5289
|
});
|
|
5237
5290
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -5320,7 +5373,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5320
5373
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
5321
5374
|
const maskOverlayOpacity = "0.9";
|
|
5322
5375
|
if (pour.shape === "rect") {
|
|
5323
|
-
const [cx, cy] =
|
|
5376
|
+
const [cx, cy] = applyToPoint33(transform, [pour.center.x, pour.center.y]);
|
|
5324
5377
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
5325
5378
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
5326
5379
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -5372,7 +5425,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5372
5425
|
if (pour.shape === "polygon") {
|
|
5373
5426
|
if (!pour.points || pour.points.length === 0) return [];
|
|
5374
5427
|
const transformedPoints = pour.points.map(
|
|
5375
|
-
(p) =>
|
|
5428
|
+
(p) => applyToPoint33(transform, [p.x, p.y])
|
|
5376
5429
|
);
|
|
5377
5430
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5378
5431
|
const copperPolygon = {
|
|
@@ -5595,11 +5648,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
5595
5648
|
}
|
|
5596
5649
|
|
|
5597
5650
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
5598
|
-
import { applyToPoint as
|
|
5651
|
+
import { applyToPoint as applyToPoint34 } from "transformation-matrix";
|
|
5599
5652
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
5600
5653
|
const { transform, circuitJson } = ctx;
|
|
5601
5654
|
const { center, width, height, rotation = 0 } = component;
|
|
5602
|
-
const [x, y] =
|
|
5655
|
+
const [x, y] = applyToPoint34(transform, [center.x, center.y]);
|
|
5603
5656
|
const scaledWidth = width * Math.abs(transform.a);
|
|
5604
5657
|
const scaledHeight = height * Math.abs(transform.d);
|
|
5605
5658
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -5671,7 +5724,7 @@ function getParentAnchorPosition(component, circuitJson) {
|
|
|
5671
5724
|
}
|
|
5672
5725
|
|
|
5673
5726
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
5674
|
-
import { applyToPoint as
|
|
5727
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
5675
5728
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
5676
5729
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
5677
5730
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -5715,7 +5768,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5715
5768
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
5716
5769
|
)) {
|
|
5717
5770
|
const path = outline.map((point, index) => {
|
|
5718
|
-
const [x, y] =
|
|
5771
|
+
const [x, y] = applyToPoint35(transform, [point.x, point.y]);
|
|
5719
5772
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5720
5773
|
}).join(" ");
|
|
5721
5774
|
svgObjects.push({
|
|
@@ -5736,11 +5789,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5736
5789
|
}
|
|
5737
5790
|
const halfWidth = width / 2;
|
|
5738
5791
|
const halfHeight = height / 2;
|
|
5739
|
-
const [topLeftX, topLeftY] =
|
|
5792
|
+
const [topLeftX, topLeftY] = applyToPoint35(transform, [
|
|
5740
5793
|
center.x - halfWidth,
|
|
5741
5794
|
center.y + halfHeight
|
|
5742
5795
|
]);
|
|
5743
|
-
const [bottomRightX, bottomRightY] =
|
|
5796
|
+
const [bottomRightX, bottomRightY] = applyToPoint35(transform, [
|
|
5744
5797
|
center.x + halfWidth,
|
|
5745
5798
|
center.y - halfHeight
|
|
5746
5799
|
]);
|
|
@@ -5794,7 +5847,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5794
5847
|
var package_default = {
|
|
5795
5848
|
name: "circuit-to-svg",
|
|
5796
5849
|
type: "module",
|
|
5797
|
-
version: "0.0.
|
|
5850
|
+
version: "0.0.302",
|
|
5798
5851
|
description: "Convert Circuit JSON to SVG",
|
|
5799
5852
|
main: "dist/index.js",
|
|
5800
5853
|
files: [
|
|
@@ -5817,7 +5870,7 @@ var package_default = {
|
|
|
5817
5870
|
"@vitejs/plugin-react": "5.0.0",
|
|
5818
5871
|
biome: "^0.3.3",
|
|
5819
5872
|
"bun-match-svg": "^0.0.12",
|
|
5820
|
-
"circuit-json": "^0.0.
|
|
5873
|
+
"circuit-json": "^0.0.348",
|
|
5821
5874
|
esbuild: "^0.20.2",
|
|
5822
5875
|
"performance-now": "^2.1.0",
|
|
5823
5876
|
react: "19.1.0",
|
|
@@ -5868,6 +5921,8 @@ var TYPE_PRIORITY = {
|
|
|
5868
5921
|
pcb_silkscreen_rect: 50,
|
|
5869
5922
|
pcb_silkscreen_circle: 50,
|
|
5870
5923
|
pcb_silkscreen_line: 50,
|
|
5924
|
+
pcb_silkscreen_oval: 50,
|
|
5925
|
+
pcb_silkscreen_pill: 50,
|
|
5871
5926
|
pcb_component: 60,
|
|
5872
5927
|
pcb_fabrication_note_text: 70,
|
|
5873
5928
|
pcb_fabrication_note_path: 70,
|
|
@@ -6096,7 +6151,7 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6096
6151
|
updateBounds(keepout.center, radius * 2, radius * 2);
|
|
6097
6152
|
}
|
|
6098
6153
|
}
|
|
6099
|
-
} else if (circuitJsonElm.type === "pcb_silkscreen_text" || circuitJsonElm.type === "pcb_silkscreen_rect" || circuitJsonElm.type === "pcb_silkscreen_circle" || circuitJsonElm.type === "pcb_silkscreen_line") {
|
|
6154
|
+
} 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
6155
|
updateSilkscreenBounds(circuitJsonElm);
|
|
6101
6156
|
} else if (circuitJsonElm.type === "pcb_copper_text") {
|
|
6102
6157
|
updateBounds(circuitJsonElm.anchor_position, 0, 0);
|
|
@@ -6360,6 +6415,12 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
6360
6415
|
} else if (item.type === "pcb_silkscreen_line") {
|
|
6361
6416
|
updateBounds({ x: item.x1, y: item.y1 }, 0, 0);
|
|
6362
6417
|
updateBounds({ x: item.x2, y: item.y2 }, 0, 0);
|
|
6418
|
+
} else if (item.type === "pcb_silkscreen_oval") {
|
|
6419
|
+
const radiusX = distance2.parse(item.radius_x);
|
|
6420
|
+
const radiusY = distance2.parse(item.radius_y);
|
|
6421
|
+
if (radiusX !== void 0 && radiusY !== void 0) {
|
|
6422
|
+
updateBounds(item.center, radiusX * 2, radiusY * 2);
|
|
6423
|
+
}
|
|
6363
6424
|
} else if (item.type === "pcb_cutout") {
|
|
6364
6425
|
const cutout = item;
|
|
6365
6426
|
if (cutout.shape === "rect") {
|
|
@@ -6413,6 +6474,8 @@ function createSvgObjects({
|
|
|
6413
6474
|
return createSvgObjectsFromPcbSilkscreenLine(elm, ctx);
|
|
6414
6475
|
case "pcb_silkscreen_pill":
|
|
6415
6476
|
return createSvgObjectsFromPcbSilkscreenPill(elm, ctx);
|
|
6477
|
+
case "pcb_silkscreen_oval":
|
|
6478
|
+
return createSvgObjectsFromPcbSilkscreenOval(elm, ctx);
|
|
6416
6479
|
case "pcb_copper_text":
|
|
6417
6480
|
return createSvgObjectsFromPcbCopperText(elm, ctx);
|
|
6418
6481
|
case "pcb_courtyard_rect":
|
|
@@ -6458,8 +6521,8 @@ function createSvgObjects({
|
|
|
6458
6521
|
}
|
|
6459
6522
|
}
|
|
6460
6523
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
6461
|
-
const [x1, y1] =
|
|
6462
|
-
const [x2, y2] =
|
|
6524
|
+
const [x1, y1] = applyToPoint36(transform, [minX, minY]);
|
|
6525
|
+
const [x2, y2] = applyToPoint36(transform, [maxX, maxY]);
|
|
6463
6526
|
const width = Math.abs(x2 - x1);
|
|
6464
6527
|
const height = Math.abs(y2 - y1);
|
|
6465
6528
|
const x = Math.min(x1, x2);
|
|
@@ -6489,14 +6552,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
6489
6552
|
import { stringify as stringify2 } from "svgson";
|
|
6490
6553
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
6491
6554
|
import {
|
|
6492
|
-
applyToPoint as
|
|
6555
|
+
applyToPoint as applyToPoint43,
|
|
6493
6556
|
compose as compose8,
|
|
6494
6557
|
scale as scale4,
|
|
6495
6558
|
translate as translate8
|
|
6496
6559
|
} from "transformation-matrix";
|
|
6497
6560
|
|
|
6498
6561
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
6499
|
-
import { applyToPoint as
|
|
6562
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
6500
6563
|
var DEFAULT_BOARD_STYLE = {
|
|
6501
6564
|
fill: "none",
|
|
6502
6565
|
stroke: "rgb(0,0,0)",
|
|
@@ -6508,25 +6571,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6508
6571
|
let path;
|
|
6509
6572
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
6510
6573
|
path = outline.map((point, index) => {
|
|
6511
|
-
const [x, y] =
|
|
6574
|
+
const [x, y] = applyToPoint37(transform, [point.x, point.y]);
|
|
6512
6575
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
6513
6576
|
}).join(" ");
|
|
6514
6577
|
} else {
|
|
6515
6578
|
const halfWidth = width / 2;
|
|
6516
6579
|
const halfHeight = height / 2;
|
|
6517
|
-
const topLeft =
|
|
6580
|
+
const topLeft = applyToPoint37(transform, [
|
|
6518
6581
|
center.x - halfWidth,
|
|
6519
6582
|
center.y - halfHeight
|
|
6520
6583
|
]);
|
|
6521
|
-
const topRight =
|
|
6584
|
+
const topRight = applyToPoint37(transform, [
|
|
6522
6585
|
center.x + halfWidth,
|
|
6523
6586
|
center.y - halfHeight
|
|
6524
6587
|
]);
|
|
6525
|
-
const bottomRight =
|
|
6588
|
+
const bottomRight = applyToPoint37(transform, [
|
|
6526
6589
|
center.x + halfWidth,
|
|
6527
6590
|
center.y + halfHeight
|
|
6528
6591
|
]);
|
|
6529
|
-
const bottomLeft =
|
|
6592
|
+
const bottomLeft = applyToPoint37(transform, [
|
|
6530
6593
|
center.x - halfWidth,
|
|
6531
6594
|
center.y + halfHeight
|
|
6532
6595
|
]);
|
|
@@ -6552,7 +6615,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6552
6615
|
}
|
|
6553
6616
|
|
|
6554
6617
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
6555
|
-
import { applyToPoint as
|
|
6618
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
6556
6619
|
|
|
6557
6620
|
// lib/utils/get-sch-font-size.ts
|
|
6558
6621
|
import "transformation-matrix";
|
|
@@ -6578,8 +6641,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
6578
6641
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
6579
6642
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
6580
6643
|
return null;
|
|
6581
|
-
const [x, y] =
|
|
6582
|
-
const [pinX, pinY] =
|
|
6644
|
+
const [x, y] = applyToPoint39(transform, [center.x, center.y]);
|
|
6645
|
+
const [pinX, pinY] = applyToPoint39(transform, [portPosition.x, portPosition.y]);
|
|
6583
6646
|
const scaledWidth = width * Math.abs(transform.a);
|
|
6584
6647
|
const scaledHeight = height * Math.abs(transform.d);
|
|
6585
6648
|
const isTopLayer = layer === "top";
|
|
@@ -6741,11 +6804,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
6741
6804
|
}
|
|
6742
6805
|
|
|
6743
6806
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
6744
|
-
import { applyToPoint as
|
|
6807
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
6745
6808
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
6746
6809
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
6747
6810
|
const { transform } = ctx;
|
|
6748
|
-
const [x, y] =
|
|
6811
|
+
const [x, y] = applyToPoint40(transform, [hole.x, hole.y]);
|
|
6749
6812
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
6750
6813
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
6751
6814
|
const radius = scaledDiameter / 2;
|
|
@@ -6809,12 +6872,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
6809
6872
|
}
|
|
6810
6873
|
|
|
6811
6874
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
6812
|
-
import { applyToPoint as
|
|
6875
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
6813
6876
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
6814
6877
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
6815
6878
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
6816
6879
|
const { transform } = ctx;
|
|
6817
|
-
const [x, y] =
|
|
6880
|
+
const [x, y] = applyToPoint41(transform, [hole.x, hole.y]);
|
|
6818
6881
|
if (hole.shape === "pill") {
|
|
6819
6882
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
6820
6883
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -6909,7 +6972,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6909
6972
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
6910
6973
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
6911
6974
|
const holeRadius = scaledHoleDiameter / 2;
|
|
6912
|
-
const [holeCx, holeCy] =
|
|
6975
|
+
const [holeCx, holeCy] = applyToPoint41(transform, [
|
|
6913
6976
|
circularHole.x + circularHole.hole_offset_x,
|
|
6914
6977
|
circularHole.y + circularHole.hole_offset_y
|
|
6915
6978
|
]);
|
|
@@ -6967,7 +7030,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6967
7030
|
const pillHoleWithOffsets = pillHole;
|
|
6968
7031
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
6969
7032
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
6970
|
-
const [holeCenterX, holeCenterY] =
|
|
7033
|
+
const [holeCenterX, holeCenterY] = applyToPoint41(transform, [
|
|
6971
7034
|
pillHole.x + holeOffsetX,
|
|
6972
7035
|
pillHole.y + holeOffsetY
|
|
6973
7036
|
]);
|
|
@@ -7029,7 +7092,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7029
7092
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
7030
7093
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
7031
7094
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
7032
|
-
const [holeCenterX, holeCenterY] =
|
|
7095
|
+
const [holeCenterX, holeCenterY] = applyToPoint41(transform, [
|
|
7033
7096
|
rotatedHole.x + holeOffsetX,
|
|
7034
7097
|
rotatedHole.y + holeOffsetY
|
|
7035
7098
|
]);
|
|
@@ -7085,14 +7148,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
7085
7148
|
}
|
|
7086
7149
|
|
|
7087
7150
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
7088
|
-
import { applyToPoint as
|
|
7151
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
7089
7152
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
7090
7153
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
7091
7154
|
const { transform } = ctx;
|
|
7092
7155
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7093
7156
|
const width = pad.width * Math.abs(transform.a);
|
|
7094
7157
|
const height = pad.height * Math.abs(transform.d);
|
|
7095
|
-
const [x, y] =
|
|
7158
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
7096
7159
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
7097
7160
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7098
7161
|
return [
|
|
@@ -7144,7 +7207,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7144
7207
|
const width = pad.width * Math.abs(transform.a);
|
|
7145
7208
|
const height = pad.height * Math.abs(transform.d);
|
|
7146
7209
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7147
|
-
const [x, y] =
|
|
7210
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
7148
7211
|
return [
|
|
7149
7212
|
{
|
|
7150
7213
|
name: "rect",
|
|
@@ -7167,7 +7230,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7167
7230
|
}
|
|
7168
7231
|
if (pad.shape === "circle") {
|
|
7169
7232
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7170
|
-
const [x, y] =
|
|
7233
|
+
const [x, y] = applyToPoint42(transform, [pad.x, pad.y]);
|
|
7171
7234
|
return [
|
|
7172
7235
|
{
|
|
7173
7236
|
name: "circle",
|
|
@@ -7187,7 +7250,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7187
7250
|
}
|
|
7188
7251
|
if (pad.shape === "polygon") {
|
|
7189
7252
|
const points = (pad.points ?? []).map(
|
|
7190
|
-
(point) =>
|
|
7253
|
+
(point) => applyToPoint42(transform, [point.x, point.y])
|
|
7191
7254
|
);
|
|
7192
7255
|
return [
|
|
7193
7256
|
{
|
|
@@ -7371,8 +7434,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
7371
7434
|
}
|
|
7372
7435
|
}
|
|
7373
7436
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
7374
|
-
const [x1, y1] =
|
|
7375
|
-
const [x2, y2] =
|
|
7437
|
+
const [x1, y1] = applyToPoint43(transform, [minX, minY]);
|
|
7438
|
+
const [x2, y2] = applyToPoint43(transform, [maxX, maxY]);
|
|
7376
7439
|
const width = Math.abs(x2 - x1);
|
|
7377
7440
|
const height = Math.abs(y2 - y1);
|
|
7378
7441
|
const x = Math.min(x1, x2);
|
|
@@ -7401,7 +7464,7 @@ import {
|
|
|
7401
7464
|
} from "transformation-matrix";
|
|
7402
7465
|
|
|
7403
7466
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
7404
|
-
import { applyToPoint as
|
|
7467
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
7405
7468
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
7406
7469
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
7407
7470
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -7415,25 +7478,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7415
7478
|
let path;
|
|
7416
7479
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
7417
7480
|
path = outline.map((point, index) => {
|
|
7418
|
-
const [x, y] =
|
|
7481
|
+
const [x, y] = applyToPoint44(transform, [point.x, point.y]);
|
|
7419
7482
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
7420
7483
|
}).join(" ");
|
|
7421
7484
|
} else {
|
|
7422
7485
|
const halfWidth = width / 2;
|
|
7423
7486
|
const halfHeight = height / 2;
|
|
7424
|
-
const topLeft =
|
|
7487
|
+
const topLeft = applyToPoint44(transform, [
|
|
7425
7488
|
center.x - halfWidth,
|
|
7426
7489
|
center.y - halfHeight
|
|
7427
7490
|
]);
|
|
7428
|
-
const topRight =
|
|
7491
|
+
const topRight = applyToPoint44(transform, [
|
|
7429
7492
|
center.x + halfWidth,
|
|
7430
7493
|
center.y - halfHeight
|
|
7431
7494
|
]);
|
|
7432
|
-
const bottomRight =
|
|
7495
|
+
const bottomRight = applyToPoint44(transform, [
|
|
7433
7496
|
center.x + halfWidth,
|
|
7434
7497
|
center.y + halfHeight
|
|
7435
7498
|
]);
|
|
7436
|
-
const bottomLeft =
|
|
7499
|
+
const bottomLeft = applyToPoint44(transform, [
|
|
7437
7500
|
center.x - halfWidth,
|
|
7438
7501
|
center.y + halfHeight
|
|
7439
7502
|
]);
|
|
@@ -7451,10 +7514,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7451
7514
|
const halfWidth = width2 / 2;
|
|
7452
7515
|
const halfHeight = height2 / 2;
|
|
7453
7516
|
const [tl, tr, br, bl] = [
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7517
|
+
applyToPoint44(transform, [x - halfWidth, y - halfHeight]),
|
|
7518
|
+
applyToPoint44(transform, [x + halfWidth, y - halfHeight]),
|
|
7519
|
+
applyToPoint44(transform, [x + halfWidth, y + halfHeight]),
|
|
7520
|
+
applyToPoint44(transform, [x - halfWidth, y + halfHeight])
|
|
7458
7521
|
];
|
|
7459
7522
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
7460
7523
|
} else if (cutout.shape === "circle") {
|
|
@@ -7504,7 +7567,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7504
7567
|
|
|
7505
7568
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
7506
7569
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
7507
|
-
import { applyToPoint as
|
|
7570
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
7508
7571
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
7509
7572
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
7510
7573
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -7514,7 +7577,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7514
7577
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
7515
7578
|
return [];
|
|
7516
7579
|
}
|
|
7517
|
-
const [x, y] =
|
|
7580
|
+
const [x, y] = applyToPoint45(transform, [center.x, center.y]);
|
|
7518
7581
|
const scaledWidth = width * Math.abs(transform.a);
|
|
7519
7582
|
const scaledHeight = height * Math.abs(transform.d);
|
|
7520
7583
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -7575,11 +7638,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7575
7638
|
}
|
|
7576
7639
|
|
|
7577
7640
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
7578
|
-
import { applyToPoint as
|
|
7641
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
7579
7642
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
7580
7643
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
7581
7644
|
const { transform } = ctx;
|
|
7582
|
-
const [x, y] =
|
|
7645
|
+
const [x, y] = applyToPoint46(transform, [hole.x, hole.y]);
|
|
7583
7646
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
7584
7647
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
7585
7648
|
const radius = scaledDiameter / 2;
|
|
@@ -7643,12 +7706,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
7643
7706
|
}
|
|
7644
7707
|
|
|
7645
7708
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
7646
|
-
import { applyToPoint as
|
|
7709
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7647
7710
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
7648
7711
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
7649
7712
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
7650
7713
|
const { transform } = ctx;
|
|
7651
|
-
const [x, y] =
|
|
7714
|
+
const [x, y] = applyToPoint47(transform, [hole.x, hole.y]);
|
|
7652
7715
|
if (hole.shape === "pill") {
|
|
7653
7716
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
7654
7717
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -7883,14 +7946,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
7883
7946
|
}
|
|
7884
7947
|
|
|
7885
7948
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
7886
|
-
import { applyToPoint as
|
|
7949
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
7887
7950
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
7888
7951
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
7889
7952
|
const { transform } = ctx;
|
|
7890
7953
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7891
7954
|
const width = pad.width * Math.abs(transform.a);
|
|
7892
7955
|
const height = pad.height * Math.abs(transform.d);
|
|
7893
|
-
const [x, y] =
|
|
7956
|
+
const [x, y] = applyToPoint48(transform, [pad.x, pad.y]);
|
|
7894
7957
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7895
7958
|
return [
|
|
7896
7959
|
{
|
|
@@ -7933,7 +7996,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7933
7996
|
const width = pad.width * Math.abs(transform.a);
|
|
7934
7997
|
const height = pad.height * Math.abs(transform.d);
|
|
7935
7998
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7936
|
-
const [x, y] =
|
|
7999
|
+
const [x, y] = applyToPoint48(transform, [pad.x, pad.y]);
|
|
7937
8000
|
return [
|
|
7938
8001
|
{
|
|
7939
8002
|
name: "rect",
|
|
@@ -7956,7 +8019,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7956
8019
|
}
|
|
7957
8020
|
if (pad.shape === "circle") {
|
|
7958
8021
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7959
|
-
const [x, y] =
|
|
8022
|
+
const [x, y] = applyToPoint48(transform, [pad.x, pad.y]);
|
|
7960
8023
|
return [
|
|
7961
8024
|
{
|
|
7962
8025
|
name: "circle",
|
|
@@ -7976,7 +8039,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7976
8039
|
}
|
|
7977
8040
|
if (pad.shape === "polygon") {
|
|
7978
8041
|
const points = (pad.points ?? []).map(
|
|
7979
|
-
(point) =>
|
|
8042
|
+
(point) => applyToPoint48(transform, [point.x, point.y])
|
|
7980
8043
|
);
|
|
7981
8044
|
return [
|
|
7982
8045
|
{
|
|
@@ -7997,7 +8060,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7997
8060
|
}
|
|
7998
8061
|
|
|
7999
8062
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
8000
|
-
import { applyToPoint as
|
|
8063
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
8001
8064
|
import { calculateElbow } from "calculate-elbow";
|
|
8002
8065
|
|
|
8003
8066
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -8074,7 +8137,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8074
8137
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
8075
8138
|
if (!label_info) return [];
|
|
8076
8139
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
8077
|
-
const [port_x, port_y] =
|
|
8140
|
+
const [port_x, port_y] = applyToPoint49(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
8078
8141
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
8079
8142
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
8080
8143
|
const elbow_path = calculateElbow(
|
|
@@ -8215,7 +8278,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8215
8278
|
}
|
|
8216
8279
|
|
|
8217
8280
|
// lib/pinout/calculate-label-positions.ts
|
|
8218
|
-
import { applyToPoint as
|
|
8281
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
8219
8282
|
|
|
8220
8283
|
// lib/pinout/constants.ts
|
|
8221
8284
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -8253,7 +8316,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8253
8316
|
);
|
|
8254
8317
|
const mapToEdgePort = (pinout_label) => ({
|
|
8255
8318
|
pcb_port: pinout_label.pcb_port,
|
|
8256
|
-
y:
|
|
8319
|
+
y: applyToPoint50(transform, [
|
|
8257
8320
|
pinout_label.pcb_port.x,
|
|
8258
8321
|
pinout_label.pcb_port.y
|
|
8259
8322
|
])[1],
|
|
@@ -8268,7 +8331,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8268
8331
|
} else {
|
|
8269
8332
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
8270
8333
|
pcb_port: pinout_label.pcb_port,
|
|
8271
|
-
y:
|
|
8334
|
+
y: applyToPoint50(transform, [
|
|
8272
8335
|
pinout_label.pcb_port.x,
|
|
8273
8336
|
pinout_label.pcb_port.y
|
|
8274
8337
|
])[1],
|
|
@@ -8276,7 +8339,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8276
8339
|
})).sort((a, b) => a.y - b.y);
|
|
8277
8340
|
}
|
|
8278
8341
|
if (edge_ports.length === 0) return;
|
|
8279
|
-
const board_edge_x =
|
|
8342
|
+
const board_edge_x = applyToPoint50(transform, [
|
|
8280
8343
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
8281
8344
|
0
|
|
8282
8345
|
])[0];
|
|
@@ -8698,14 +8761,14 @@ import {
|
|
|
8698
8761
|
} from "transformation-matrix";
|
|
8699
8762
|
|
|
8700
8763
|
// lib/sch/draw-schematic-grid.ts
|
|
8701
|
-
import { applyToPoint as
|
|
8764
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
8702
8765
|
function drawSchematicGrid(params) {
|
|
8703
8766
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
8704
8767
|
const cellSize = params.cellSize ?? 1;
|
|
8705
8768
|
const labelCells = params.labelCells ?? false;
|
|
8706
8769
|
const gridLines = [];
|
|
8707
8770
|
const transformPoint = (x, y) => {
|
|
8708
|
-
const [transformedX, transformedY] =
|
|
8771
|
+
const [transformedX, transformedY] = applyToPoint51(params.transform, [x, y]);
|
|
8709
8772
|
return { x: transformedX, y: transformedY };
|
|
8710
8773
|
};
|
|
8711
8774
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -8786,15 +8849,15 @@ function drawSchematicGrid(params) {
|
|
|
8786
8849
|
}
|
|
8787
8850
|
|
|
8788
8851
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
8789
|
-
import { applyToPoint as
|
|
8852
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
8790
8853
|
function drawSchematicLabeledPoints(params) {
|
|
8791
8854
|
const { points, transform } = params;
|
|
8792
8855
|
const labeledPointsGroup = [];
|
|
8793
8856
|
for (const point of points) {
|
|
8794
|
-
const [x1, y1] =
|
|
8795
|
-
const [x2, y2] =
|
|
8796
|
-
const [x3, y3] =
|
|
8797
|
-
const [x4, y4] =
|
|
8857
|
+
const [x1, y1] = applyToPoint52(transform, [point.x - 0.1, point.y - 0.1]);
|
|
8858
|
+
const [x2, y2] = applyToPoint52(transform, [point.x + 0.1, point.y + 0.1]);
|
|
8859
|
+
const [x3, y3] = applyToPoint52(transform, [point.x - 0.1, point.y + 0.1]);
|
|
8860
|
+
const [x4, y4] = applyToPoint52(transform, [point.x + 0.1, point.y - 0.1]);
|
|
8798
8861
|
labeledPointsGroup.push({
|
|
8799
8862
|
name: "path",
|
|
8800
8863
|
type: "element",
|
|
@@ -8805,7 +8868,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
8805
8868
|
"stroke-opacity": "0.7"
|
|
8806
8869
|
}
|
|
8807
8870
|
});
|
|
8808
|
-
const [labelX, labelY] =
|
|
8871
|
+
const [labelX, labelY] = applyToPoint52(transform, [
|
|
8809
8872
|
point.x + 0.15,
|
|
8810
8873
|
point.y - 0.15
|
|
8811
8874
|
]);
|
|
@@ -9923,7 +9986,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
9923
9986
|
import { symbols } from "schematic-symbols";
|
|
9924
9987
|
import "svgson";
|
|
9925
9988
|
import {
|
|
9926
|
-
applyToPoint as
|
|
9989
|
+
applyToPoint as applyToPoint54,
|
|
9927
9990
|
compose as compose11
|
|
9928
9991
|
} from "transformation-matrix";
|
|
9929
9992
|
|
|
@@ -10007,13 +10070,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
10007
10070
|
}
|
|
10008
10071
|
|
|
10009
10072
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
10010
|
-
import { applyToPoint as
|
|
10073
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
10011
10074
|
var createSvgSchErrorText = ({
|
|
10012
10075
|
text,
|
|
10013
10076
|
realCenter,
|
|
10014
10077
|
realToScreenTransform
|
|
10015
10078
|
}) => {
|
|
10016
|
-
const screenCenter =
|
|
10079
|
+
const screenCenter = applyToPoint53(realToScreenTransform, realCenter);
|
|
10017
10080
|
return {
|
|
10018
10081
|
type: "element",
|
|
10019
10082
|
name: "text",
|
|
@@ -10122,11 +10185,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10122
10185
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
10123
10186
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
10124
10187
|
};
|
|
10125
|
-
const [screenMinX, screenMinY] =
|
|
10188
|
+
const [screenMinX, screenMinY] = applyToPoint54(
|
|
10126
10189
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10127
10190
|
[bounds.minX, bounds.minY]
|
|
10128
10191
|
);
|
|
10129
|
-
const [screenMaxX, screenMaxY] =
|
|
10192
|
+
const [screenMaxX, screenMaxY] = applyToPoint54(
|
|
10130
10193
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10131
10194
|
[bounds.maxX, bounds.maxY]
|
|
10132
10195
|
);
|
|
@@ -10155,7 +10218,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10155
10218
|
name: "path",
|
|
10156
10219
|
attributes: {
|
|
10157
10220
|
d: points.map((p, i) => {
|
|
10158
|
-
const [x, y] =
|
|
10221
|
+
const [x, y] = applyToPoint54(
|
|
10159
10222
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10160
10223
|
[p.x, p.y]
|
|
10161
10224
|
);
|
|
@@ -10171,7 +10234,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10171
10234
|
});
|
|
10172
10235
|
}
|
|
10173
10236
|
for (const text of texts) {
|
|
10174
|
-
const screenTextPos =
|
|
10237
|
+
const screenTextPos = applyToPoint54(
|
|
10175
10238
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10176
10239
|
text
|
|
10177
10240
|
);
|
|
@@ -10223,7 +10286,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10223
10286
|
});
|
|
10224
10287
|
}
|
|
10225
10288
|
for (const box of boxes) {
|
|
10226
|
-
const screenBoxPos =
|
|
10289
|
+
const screenBoxPos = applyToPoint54(
|
|
10227
10290
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10228
10291
|
box
|
|
10229
10292
|
);
|
|
@@ -10247,7 +10310,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10247
10310
|
}
|
|
10248
10311
|
for (const port of symbol.ports) {
|
|
10249
10312
|
if (connectedSymbolPorts.has(port)) continue;
|
|
10250
|
-
const screenPortPos =
|
|
10313
|
+
const screenPortPos = applyToPoint54(
|
|
10251
10314
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10252
10315
|
port
|
|
10253
10316
|
);
|
|
@@ -10267,7 +10330,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10267
10330
|
});
|
|
10268
10331
|
}
|
|
10269
10332
|
for (const circle of circles) {
|
|
10270
|
-
const screenCirclePos =
|
|
10333
|
+
const screenCirclePos = applyToPoint54(
|
|
10271
10334
|
compose11(realToScreenTransform, transformFromSymbolToReal),
|
|
10272
10335
|
circle
|
|
10273
10336
|
);
|
|
@@ -10294,14 +10357,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10294
10357
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
10295
10358
|
import "schematic-symbols";
|
|
10296
10359
|
import "svgson";
|
|
10297
|
-
import { applyToPoint as
|
|
10360
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
10298
10361
|
|
|
10299
10362
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
10300
10363
|
import "transformation-matrix";
|
|
10301
10364
|
import "@tscircuit/circuit-json-util";
|
|
10302
10365
|
|
|
10303
10366
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
10304
|
-
import { applyToPoint as
|
|
10367
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
10305
10368
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
10306
10369
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
10307
10370
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -10354,8 +10417,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10354
10417
|
realEdgePos.y += realPinLineLength;
|
|
10355
10418
|
break;
|
|
10356
10419
|
}
|
|
10357
|
-
const screenSchPortPos =
|
|
10358
|
-
const screenRealEdgePos =
|
|
10420
|
+
const screenSchPortPos = applyToPoint55(transform, schPort.center);
|
|
10421
|
+
const screenRealEdgePos = applyToPoint55(transform, realEdgePos);
|
|
10359
10422
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
10360
10423
|
const realLineEnd = { ...schPort.center };
|
|
10361
10424
|
if (!isConnected) {
|
|
@@ -10374,7 +10437,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10374
10437
|
break;
|
|
10375
10438
|
}
|
|
10376
10439
|
}
|
|
10377
|
-
const screenLineEnd =
|
|
10440
|
+
const screenLineEnd = applyToPoint55(transform, realLineEnd);
|
|
10378
10441
|
svgObjects.push({
|
|
10379
10442
|
name: "line",
|
|
10380
10443
|
type: "element",
|
|
@@ -10495,7 +10558,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10495
10558
|
};
|
|
10496
10559
|
|
|
10497
10560
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
10498
|
-
import { applyToPoint as
|
|
10561
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
10499
10562
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
10500
10563
|
const svgObjects = [];
|
|
10501
10564
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -10513,7 +10576,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10513
10576
|
} else {
|
|
10514
10577
|
realPinNumberPos.y += 0.02;
|
|
10515
10578
|
}
|
|
10516
|
-
const screenPinNumberTextPos =
|
|
10579
|
+
const screenPinNumberTextPos = applyToPoint56(transform, realPinNumberPos);
|
|
10517
10580
|
svgObjects.push({
|
|
10518
10581
|
name: "text",
|
|
10519
10582
|
type: "element",
|
|
@@ -10543,7 +10606,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10543
10606
|
};
|
|
10544
10607
|
|
|
10545
10608
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
10546
|
-
import { applyToPoint as
|
|
10609
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
10547
10610
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
10548
10611
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
10549
10612
|
const svgObjects = [];
|
|
@@ -10557,7 +10620,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
10557
10620
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
10558
10621
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10559
10622
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10560
|
-
const screenPinNumberTextPos =
|
|
10623
|
+
const screenPinNumberTextPos = applyToPoint57(transform, realPinNumberPos);
|
|
10561
10624
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
10562
10625
|
if (!label) return [];
|
|
10563
10626
|
const isNegated = label.startsWith("N_");
|
|
@@ -10605,13 +10668,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
10605
10668
|
};
|
|
10606
10669
|
|
|
10607
10670
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
10608
|
-
import { applyToPoint as
|
|
10671
|
+
import { applyToPoint as applyToPoint59 } from "transformation-matrix";
|
|
10609
10672
|
var createSvgSchText = ({
|
|
10610
10673
|
elm,
|
|
10611
10674
|
transform,
|
|
10612
10675
|
colorMap: colorMap2
|
|
10613
10676
|
}) => {
|
|
10614
|
-
const center =
|
|
10677
|
+
const center = applyToPoint59(transform, elm.position);
|
|
10615
10678
|
const textAnchorMap = {
|
|
10616
10679
|
center: "middle",
|
|
10617
10680
|
center_right: "end",
|
|
@@ -10695,11 +10758,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
10695
10758
|
colorMap: colorMap2
|
|
10696
10759
|
}) => {
|
|
10697
10760
|
const svgObjects = [];
|
|
10698
|
-
const componentScreenTopLeft =
|
|
10761
|
+
const componentScreenTopLeft = applyToPoint60(transform, {
|
|
10699
10762
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
10700
10763
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
10701
10764
|
});
|
|
10702
|
-
const componentScreenBottomRight =
|
|
10765
|
+
const componentScreenBottomRight = applyToPoint60(transform, {
|
|
10703
10766
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
10704
10767
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
10705
10768
|
});
|
|
@@ -10785,13 +10848,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
10785
10848
|
}
|
|
10786
10849
|
|
|
10787
10850
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
10788
|
-
import { applyToPoint as
|
|
10851
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
10789
10852
|
function createSvgObjectsFromSchVoltageProbe({
|
|
10790
10853
|
probe,
|
|
10791
10854
|
transform,
|
|
10792
10855
|
colorMap: colorMap2
|
|
10793
10856
|
}) {
|
|
10794
|
-
const [screenX, screenY] =
|
|
10857
|
+
const [screenX, screenY] = applyToPoint61(transform, [
|
|
10795
10858
|
probe.position.x,
|
|
10796
10859
|
probe.position.y
|
|
10797
10860
|
]);
|
|
@@ -10965,17 +11028,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
10965
11028
|
}
|
|
10966
11029
|
|
|
10967
11030
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
10968
|
-
import { applyToPoint as
|
|
11031
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
10969
11032
|
function createSvgObjectsFromSchDebugObject({
|
|
10970
11033
|
debugObject,
|
|
10971
11034
|
transform
|
|
10972
11035
|
}) {
|
|
10973
11036
|
if (debugObject.shape === "rect") {
|
|
10974
|
-
let [screenLeft, screenTop] =
|
|
11037
|
+
let [screenLeft, screenTop] = applyToPoint62(transform, [
|
|
10975
11038
|
debugObject.center.x - debugObject.size.width / 2,
|
|
10976
11039
|
debugObject.center.y - debugObject.size.height / 2
|
|
10977
11040
|
]);
|
|
10978
|
-
let [screenRight, screenBottom] =
|
|
11041
|
+
let [screenRight, screenBottom] = applyToPoint62(transform, [
|
|
10979
11042
|
debugObject.center.x + debugObject.size.width / 2,
|
|
10980
11043
|
debugObject.center.y + debugObject.size.height / 2
|
|
10981
11044
|
]);
|
|
@@ -10985,7 +11048,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
10985
11048
|
];
|
|
10986
11049
|
const width = Math.abs(screenRight - screenLeft);
|
|
10987
11050
|
const height = Math.abs(screenBottom - screenTop);
|
|
10988
|
-
const [screenCenterX, screenCenterY] =
|
|
11051
|
+
const [screenCenterX, screenCenterY] = applyToPoint62(transform, [
|
|
10989
11052
|
debugObject.center.x,
|
|
10990
11053
|
debugObject.center.y
|
|
10991
11054
|
]);
|
|
@@ -11031,11 +11094,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11031
11094
|
];
|
|
11032
11095
|
}
|
|
11033
11096
|
if (debugObject.shape === "line") {
|
|
11034
|
-
const [screenStartX, screenStartY] =
|
|
11097
|
+
const [screenStartX, screenStartY] = applyToPoint62(transform, [
|
|
11035
11098
|
debugObject.start.x,
|
|
11036
11099
|
debugObject.start.y
|
|
11037
11100
|
]);
|
|
11038
|
-
const [screenEndX, screenEndY] =
|
|
11101
|
+
const [screenEndX, screenEndY] = applyToPoint62(transform, [
|
|
11039
11102
|
debugObject.end.x,
|
|
11040
11103
|
debugObject.end.y
|
|
11041
11104
|
]);
|
|
@@ -11085,7 +11148,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
11085
11148
|
}
|
|
11086
11149
|
|
|
11087
11150
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
11088
|
-
import { applyToPoint as
|
|
11151
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
11089
11152
|
function createSchematicTrace({
|
|
11090
11153
|
trace,
|
|
11091
11154
|
transform,
|
|
@@ -11099,11 +11162,11 @@ function createSchematicTrace({
|
|
|
11099
11162
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
11100
11163
|
const edge = edges[edgeIndex];
|
|
11101
11164
|
if (edge.is_crossing) continue;
|
|
11102
|
-
const [screenFromX, screenFromY] =
|
|
11165
|
+
const [screenFromX, screenFromY] = applyToPoint63(transform, [
|
|
11103
11166
|
edge.from.x,
|
|
11104
11167
|
edge.from.y
|
|
11105
11168
|
]);
|
|
11106
|
-
const [screenToX, screenToY] =
|
|
11169
|
+
const [screenToX, screenToY] = applyToPoint63(transform, [
|
|
11107
11170
|
edge.to.x,
|
|
11108
11171
|
edge.to.y
|
|
11109
11172
|
]);
|
|
@@ -11147,11 +11210,11 @@ function createSchematicTrace({
|
|
|
11147
11210
|
}
|
|
11148
11211
|
for (const edge of edges) {
|
|
11149
11212
|
if (!edge.is_crossing) continue;
|
|
11150
|
-
const [screenFromX, screenFromY] =
|
|
11213
|
+
const [screenFromX, screenFromY] = applyToPoint63(transform, [
|
|
11151
11214
|
edge.from.x,
|
|
11152
11215
|
edge.from.y
|
|
11153
11216
|
]);
|
|
11154
|
-
const [screenToX, screenToY] =
|
|
11217
|
+
const [screenToX, screenToY] = applyToPoint63(transform, [
|
|
11155
11218
|
edge.to.x,
|
|
11156
11219
|
edge.to.y
|
|
11157
11220
|
]);
|
|
@@ -11195,7 +11258,7 @@ function createSchematicTrace({
|
|
|
11195
11258
|
}
|
|
11196
11259
|
if (trace.junctions) {
|
|
11197
11260
|
for (const junction of trace.junctions) {
|
|
11198
|
-
const [screenX, screenY] =
|
|
11261
|
+
const [screenX, screenY] = applyToPoint63(transform, [
|
|
11199
11262
|
junction.x,
|
|
11200
11263
|
junction.y
|
|
11201
11264
|
]);
|
|
@@ -11250,7 +11313,7 @@ function createSchematicTrace({
|
|
|
11250
11313
|
|
|
11251
11314
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
11252
11315
|
import {
|
|
11253
|
-
applyToPoint as
|
|
11316
|
+
applyToPoint as applyToPoint65,
|
|
11254
11317
|
compose as compose13,
|
|
11255
11318
|
rotate as rotate7,
|
|
11256
11319
|
scale as scale7,
|
|
@@ -11259,7 +11322,7 @@ import {
|
|
|
11259
11322
|
|
|
11260
11323
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
11261
11324
|
import {
|
|
11262
|
-
applyToPoint as
|
|
11325
|
+
applyToPoint as applyToPoint64,
|
|
11263
11326
|
compose as compose12,
|
|
11264
11327
|
rotate as rotate6,
|
|
11265
11328
|
scale as scale6,
|
|
@@ -11334,7 +11397,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11334
11397
|
x: symbolBounds.minX,
|
|
11335
11398
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
11336
11399
|
};
|
|
11337
|
-
const rotatedSymbolEnd =
|
|
11400
|
+
const rotatedSymbolEnd = applyToPoint64(rotationMatrix, symbolEndPoint);
|
|
11338
11401
|
const symbolToRealTransform = compose12(
|
|
11339
11402
|
translate12(
|
|
11340
11403
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -11344,11 +11407,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11344
11407
|
scale6(1)
|
|
11345
11408
|
// Use full symbol size
|
|
11346
11409
|
);
|
|
11347
|
-
const [screenMinX, screenMinY] =
|
|
11410
|
+
const [screenMinX, screenMinY] = applyToPoint64(
|
|
11348
11411
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11349
11412
|
[bounds.minX, bounds.minY]
|
|
11350
11413
|
);
|
|
11351
|
-
const [screenMaxX, screenMaxY] =
|
|
11414
|
+
const [screenMaxX, screenMaxY] = applyToPoint64(
|
|
11352
11415
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11353
11416
|
[bounds.maxX, bounds.maxY]
|
|
11354
11417
|
);
|
|
@@ -11372,7 +11435,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11372
11435
|
});
|
|
11373
11436
|
for (const path of symbolPaths) {
|
|
11374
11437
|
const symbolPath = path.points.map((p, i) => {
|
|
11375
|
-
const [x, y] =
|
|
11438
|
+
const [x, y] = applyToPoint64(
|
|
11376
11439
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11377
11440
|
[p.x, p.y]
|
|
11378
11441
|
);
|
|
@@ -11393,7 +11456,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11393
11456
|
});
|
|
11394
11457
|
}
|
|
11395
11458
|
for (const text of symbolTexts) {
|
|
11396
|
-
const screenTextPos =
|
|
11459
|
+
const screenTextPos = applyToPoint64(
|
|
11397
11460
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11398
11461
|
text
|
|
11399
11462
|
);
|
|
@@ -11435,7 +11498,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11435
11498
|
});
|
|
11436
11499
|
}
|
|
11437
11500
|
for (const box of symbolBoxes) {
|
|
11438
|
-
const screenBoxPos =
|
|
11501
|
+
const screenBoxPos = applyToPoint64(
|
|
11439
11502
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11440
11503
|
box
|
|
11441
11504
|
);
|
|
@@ -11458,7 +11521,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11458
11521
|
});
|
|
11459
11522
|
}
|
|
11460
11523
|
for (const circle of symbolCircles) {
|
|
11461
|
-
const screenCirclePos =
|
|
11524
|
+
const screenCirclePos = applyToPoint64(
|
|
11462
11525
|
compose12(realToScreenTransform, symbolToRealTransform),
|
|
11463
11526
|
circle
|
|
11464
11527
|
);
|
|
@@ -11503,14 +11566,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11503
11566
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
11504
11567
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
11505
11568
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
11506
|
-
const screenCenter =
|
|
11569
|
+
const screenCenter = applyToPoint65(realToScreenTransform, schNetLabel.center);
|
|
11507
11570
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
11508
11571
|
schNetLabel.anchor_side
|
|
11509
11572
|
);
|
|
11510
11573
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
11511
11574
|
screenTextGrowthVec.y *= -1;
|
|
11512
11575
|
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 ?
|
|
11576
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint65(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
11514
11577
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
11515
11578
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
11516
11579
|
};
|
|
@@ -11551,7 +11614,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11551
11614
|
y: -0.6
|
|
11552
11615
|
}
|
|
11553
11616
|
].map(
|
|
11554
|
-
(fontRelativePoint) =>
|
|
11617
|
+
(fontRelativePoint) => applyToPoint65(
|
|
11555
11618
|
compose13(
|
|
11556
11619
|
realToScreenTransform,
|
|
11557
11620
|
translate13(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -11628,17 +11691,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11628
11691
|
};
|
|
11629
11692
|
|
|
11630
11693
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
11631
|
-
import { applyToPoint as
|
|
11694
|
+
import { applyToPoint as applyToPoint66 } from "transformation-matrix";
|
|
11632
11695
|
var createSvgObjectsFromSchematicBox = ({
|
|
11633
11696
|
schematicBox,
|
|
11634
11697
|
transform,
|
|
11635
11698
|
colorMap: colorMap2
|
|
11636
11699
|
}) => {
|
|
11637
|
-
const topLeft =
|
|
11700
|
+
const topLeft = applyToPoint66(transform, {
|
|
11638
11701
|
x: schematicBox.x,
|
|
11639
11702
|
y: schematicBox.y
|
|
11640
11703
|
});
|
|
11641
|
-
const bottomRight =
|
|
11704
|
+
const bottomRight = applyToPoint66(transform, {
|
|
11642
11705
|
x: schematicBox.x + schematicBox.width,
|
|
11643
11706
|
y: schematicBox.y + schematicBox.height
|
|
11644
11707
|
});
|
|
@@ -11674,7 +11737,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
11674
11737
|
};
|
|
11675
11738
|
|
|
11676
11739
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
11677
|
-
import { applyToPoint as
|
|
11740
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
11678
11741
|
var createSvgObjectsFromSchematicTable = ({
|
|
11679
11742
|
schematicTable,
|
|
11680
11743
|
transform,
|
|
@@ -11707,11 +11770,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11707
11770
|
const svgObjects = [];
|
|
11708
11771
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
11709
11772
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
11710
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
11773
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint67(transform, [
|
|
11711
11774
|
topLeftX,
|
|
11712
11775
|
topLeftY
|
|
11713
11776
|
]);
|
|
11714
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
11777
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint67(transform, [
|
|
11715
11778
|
topLeftX + totalWidth,
|
|
11716
11779
|
topLeftY - totalHeight
|
|
11717
11780
|
]);
|
|
@@ -11743,8 +11806,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11743
11806
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
11744
11807
|
);
|
|
11745
11808
|
if (!isMerged) {
|
|
11746
|
-
const start =
|
|
11747
|
-
const end =
|
|
11809
|
+
const start = applyToPoint67(transform, { x: currentX, y: segmentStartY });
|
|
11810
|
+
const end = applyToPoint67(transform, { x: currentX, y: segmentEndY });
|
|
11748
11811
|
svgObjects.push({
|
|
11749
11812
|
name: "line",
|
|
11750
11813
|
type: "element",
|
|
@@ -11773,11 +11836,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11773
11836
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
11774
11837
|
);
|
|
11775
11838
|
if (!isMerged) {
|
|
11776
|
-
const start =
|
|
11839
|
+
const start = applyToPoint67(transform, {
|
|
11777
11840
|
x: segmentStartX,
|
|
11778
11841
|
y: currentY
|
|
11779
11842
|
});
|
|
11780
|
-
const end =
|
|
11843
|
+
const end = applyToPoint67(transform, { x: segmentEndX, y: currentY });
|
|
11781
11844
|
svgObjects.push({
|
|
11782
11845
|
name: "line",
|
|
11783
11846
|
type: "element",
|
|
@@ -11819,7 +11882,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11819
11882
|
} else if (vertical_align === "bottom") {
|
|
11820
11883
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
11821
11884
|
}
|
|
11822
|
-
const screenTextAnchorPos =
|
|
11885
|
+
const screenTextAnchorPos = applyToPoint67(transform, realTextAnchorPos);
|
|
11823
11886
|
const fontSize = getSchScreenFontSize(
|
|
11824
11887
|
transform,
|
|
11825
11888
|
"reference_designator",
|
|
@@ -11875,13 +11938,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11875
11938
|
|
|
11876
11939
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
11877
11940
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
11878
|
-
import { applyToPoint as
|
|
11941
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
11879
11942
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
11880
11943
|
var createSvgObjectsForSchPortHover = ({
|
|
11881
11944
|
schPort,
|
|
11882
11945
|
transform
|
|
11883
11946
|
}) => {
|
|
11884
|
-
const screenSchPortPos =
|
|
11947
|
+
const screenSchPortPos = applyToPoint68(transform, schPort.center);
|
|
11885
11948
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
11886
11949
|
return [
|
|
11887
11950
|
{
|
|
@@ -11926,14 +11989,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
11926
11989
|
};
|
|
11927
11990
|
|
|
11928
11991
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
11929
|
-
import { applyToPoint as
|
|
11992
|
+
import { applyToPoint as applyToPoint69 } from "transformation-matrix";
|
|
11930
11993
|
function createSvgObjectsFromSchematicLine({
|
|
11931
11994
|
schLine,
|
|
11932
11995
|
transform,
|
|
11933
11996
|
colorMap: colorMap2
|
|
11934
11997
|
}) {
|
|
11935
|
-
const p1 =
|
|
11936
|
-
const p2 =
|
|
11998
|
+
const p1 = applyToPoint69(transform, { x: schLine.x1, y: schLine.y1 });
|
|
11999
|
+
const p2 = applyToPoint69(transform, { x: schLine.x2, y: schLine.y2 });
|
|
11937
12000
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
11938
12001
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
11939
12002
|
return [
|
|
@@ -11962,13 +12025,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
11962
12025
|
}
|
|
11963
12026
|
|
|
11964
12027
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
11965
|
-
import { applyToPoint as
|
|
12028
|
+
import { applyToPoint as applyToPoint70 } from "transformation-matrix";
|
|
11966
12029
|
function createSvgObjectsFromSchematicCircle({
|
|
11967
12030
|
schCircle,
|
|
11968
12031
|
transform,
|
|
11969
12032
|
colorMap: colorMap2
|
|
11970
12033
|
}) {
|
|
11971
|
-
const center =
|
|
12034
|
+
const center = applyToPoint70(transform, schCircle.center);
|
|
11972
12035
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
11973
12036
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
11974
12037
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -11998,13 +12061,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
11998
12061
|
}
|
|
11999
12062
|
|
|
12000
12063
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
12001
|
-
import { applyToPoint as
|
|
12064
|
+
import { applyToPoint as applyToPoint71 } from "transformation-matrix";
|
|
12002
12065
|
function createSvgObjectsFromSchematicRect({
|
|
12003
12066
|
schRect,
|
|
12004
12067
|
transform,
|
|
12005
12068
|
colorMap: colorMap2
|
|
12006
12069
|
}) {
|
|
12007
|
-
const center =
|
|
12070
|
+
const center = applyToPoint71(transform, schRect.center);
|
|
12008
12071
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
12009
12072
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
12010
12073
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -12040,13 +12103,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
12040
12103
|
}
|
|
12041
12104
|
|
|
12042
12105
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
12043
|
-
import { applyToPoint as
|
|
12106
|
+
import { applyToPoint as applyToPoint72 } from "transformation-matrix";
|
|
12044
12107
|
function createSvgObjectsFromSchematicArc({
|
|
12045
12108
|
schArc,
|
|
12046
12109
|
transform,
|
|
12047
12110
|
colorMap: colorMap2
|
|
12048
12111
|
}) {
|
|
12049
|
-
const center =
|
|
12112
|
+
const center = applyToPoint72(transform, schArc.center);
|
|
12050
12113
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
12051
12114
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
12052
12115
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -13166,18 +13229,18 @@ function formatNumber2(value) {
|
|
|
13166
13229
|
import { distance as distance3 } from "circuit-json";
|
|
13167
13230
|
import { stringify as stringify7 } from "svgson";
|
|
13168
13231
|
import {
|
|
13169
|
-
applyToPoint as
|
|
13232
|
+
applyToPoint as applyToPoint75,
|
|
13170
13233
|
compose as compose16,
|
|
13171
13234
|
scale as scale9,
|
|
13172
13235
|
translate as translate16
|
|
13173
13236
|
} from "transformation-matrix";
|
|
13174
13237
|
|
|
13175
13238
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
13176
|
-
import { applyToPoint as
|
|
13239
|
+
import { applyToPoint as applyToPoint74 } from "transformation-matrix";
|
|
13177
13240
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
13178
13241
|
const { transform, layer: layerFilter } = ctx;
|
|
13179
13242
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
13180
|
-
const [x, y] =
|
|
13243
|
+
const [x, y] = applyToPoint74(transform, [solderPaste.x, solderPaste.y]);
|
|
13181
13244
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
13182
13245
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
13183
13246
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -13403,8 +13466,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
13403
13466
|
}
|
|
13404
13467
|
}
|
|
13405
13468
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
13406
|
-
const [x1, y1] =
|
|
13407
|
-
const [x2, y2] =
|
|
13469
|
+
const [x1, y1] = applyToPoint75(transform, [minX, minY]);
|
|
13470
|
+
const [x2, y2] = applyToPoint75(transform, [maxX, maxY]);
|
|
13408
13471
|
const width = Math.abs(x2 - x1);
|
|
13409
13472
|
const height = Math.abs(y2 - y1);
|
|
13410
13473
|
const x = Math.min(x1, x2);
|