circuit-to-svg 0.0.299 → 0.0.300
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 +234 -185
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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 applyToPoint34,
|
|
6
6
|
compose as compose6,
|
|
7
7
|
scale as scale3,
|
|
8
8
|
translate as translate6
|
|
@@ -3083,8 +3083,55 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
|
3083
3083
|
];
|
|
3084
3084
|
}
|
|
3085
3085
|
|
|
3086
|
-
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-
|
|
3086
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-silkscreen-pill.ts
|
|
3087
3087
|
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
3088
|
+
function createSvgObjectsFromPcbSilkscreenPill(pcbSilkscreenPill, ctx) {
|
|
3089
|
+
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
3090
|
+
const {
|
|
3091
|
+
center,
|
|
3092
|
+
width,
|
|
3093
|
+
height,
|
|
3094
|
+
layer = "top",
|
|
3095
|
+
pcb_silkscreen_pill_id
|
|
3096
|
+
} = pcbSilkscreenPill;
|
|
3097
|
+
if (layerFilter && layer !== layerFilter) return [];
|
|
3098
|
+
const [transformedX, transformedY] = applyToPoint19(transform, [
|
|
3099
|
+
center.x,
|
|
3100
|
+
center.y
|
|
3101
|
+
]);
|
|
3102
|
+
const transformedWidth = width * Math.abs(transform.a);
|
|
3103
|
+
const transformedHeight = height * Math.abs(transform.d);
|
|
3104
|
+
const minDimension = Math.min(width, height);
|
|
3105
|
+
const baseCornerRadius = minDimension / 2;
|
|
3106
|
+
const transformedCornerRadiusX = baseCornerRadius * Math.abs(transform.a);
|
|
3107
|
+
const transformedCornerRadiusY = baseCornerRadius * Math.abs(transform.d);
|
|
3108
|
+
const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
|
|
3109
|
+
const svgObject = {
|
|
3110
|
+
name: "rect",
|
|
3111
|
+
type: "element",
|
|
3112
|
+
attributes: {
|
|
3113
|
+
x: (transformedX - transformedWidth / 2).toString(),
|
|
3114
|
+
y: (transformedY - transformedHeight / 2).toString(),
|
|
3115
|
+
width: transformedWidth.toString(),
|
|
3116
|
+
height: transformedHeight.toString(),
|
|
3117
|
+
rx: transformedCornerRadiusX.toString(),
|
|
3118
|
+
ry: transformedCornerRadiusY.toString(),
|
|
3119
|
+
fill: "none",
|
|
3120
|
+
stroke: color,
|
|
3121
|
+
"stroke-width": (0.1 * Math.abs(transform.a)).toString(),
|
|
3122
|
+
class: `pcb-silkscreen-pill pcb-silkscreen-${layer}`,
|
|
3123
|
+
"data-pcb-silkscreen-pill-id": pcb_silkscreen_pill_id,
|
|
3124
|
+
"data-type": "pcb_silkscreen_pill",
|
|
3125
|
+
"data-pcb-layer": layer
|
|
3126
|
+
},
|
|
3127
|
+
value: "",
|
|
3128
|
+
children: []
|
|
3129
|
+
};
|
|
3130
|
+
return [svgObject];
|
|
3131
|
+
}
|
|
3132
|
+
|
|
3133
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-courtyard-rect.ts
|
|
3134
|
+
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
3088
3135
|
function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
|
|
3089
3136
|
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
3090
3137
|
const {
|
|
@@ -3103,7 +3150,7 @@ function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
|
|
|
3103
3150
|
});
|
|
3104
3151
|
return [];
|
|
3105
3152
|
}
|
|
3106
|
-
const [transformedX, transformedY] =
|
|
3153
|
+
const [transformedX, transformedY] = applyToPoint20(transform, [
|
|
3107
3154
|
center.x,
|
|
3108
3155
|
center.y
|
|
3109
3156
|
]);
|
|
@@ -3144,7 +3191,7 @@ function pairs(arr) {
|
|
|
3144
3191
|
}
|
|
3145
3192
|
|
|
3146
3193
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-trace.ts
|
|
3147
|
-
import { applyToPoint as
|
|
3194
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
3148
3195
|
function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
3149
3196
|
const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
|
|
3150
3197
|
if (!trace.route || !Array.isArray(trace.route) || trace.route.length < 2)
|
|
@@ -3152,8 +3199,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
3152
3199
|
const segments = pairs(trace.route);
|
|
3153
3200
|
const svgObjects = [];
|
|
3154
3201
|
for (const [start, end] of segments) {
|
|
3155
|
-
const startPoint =
|
|
3156
|
-
const endPoint =
|
|
3202
|
+
const startPoint = applyToPoint21(transform, [start.x, start.y]);
|
|
3203
|
+
const endPoint = applyToPoint21(transform, [end.x, end.y]);
|
|
3157
3204
|
const layer = "layer" in start ? start.layer : "layer" in end ? end.layer : null;
|
|
3158
3205
|
if (!layer) continue;
|
|
3159
3206
|
if (layerFilter && layer !== layerFilter) continue;
|
|
@@ -3208,7 +3255,7 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
3208
3255
|
}
|
|
3209
3256
|
|
|
3210
3257
|
// lib/pcb/svg-object-fns/create-svg-objects-from-smt-pads.ts
|
|
3211
|
-
import { applyToPoint as
|
|
3258
|
+
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
3212
3259
|
function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
3213
3260
|
const { transform, layer: layerFilter, colorMap: colorMap2, showSolderMask } = ctx;
|
|
3214
3261
|
if (layerFilter && pad.layer !== layerFilter) return [];
|
|
@@ -3219,7 +3266,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3219
3266
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
3220
3267
|
const width = pad.width * Math.abs(transform.a);
|
|
3221
3268
|
const height = pad.height * Math.abs(transform.d);
|
|
3222
|
-
const [x, y] =
|
|
3269
|
+
const [x, y] = applyToPoint22(transform, [pad.x, pad.y]);
|
|
3223
3270
|
const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
|
|
3224
3271
|
const scaledBorderRadius = cornerRadiusValue * Math.abs(transform.a);
|
|
3225
3272
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
@@ -3461,7 +3508,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3461
3508
|
const width = pad.width * Math.abs(transform.a);
|
|
3462
3509
|
const height = pad.height * Math.abs(transform.d);
|
|
3463
3510
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3464
|
-
const [x, y] =
|
|
3511
|
+
const [x, y] = applyToPoint22(transform, [pad.x, pad.y]);
|
|
3465
3512
|
const rotationTransformAttributes = isRotated ? {
|
|
3466
3513
|
transform: `translate(${x} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
|
|
3467
3514
|
} : void 0;
|
|
@@ -3579,7 +3626,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3579
3626
|
}
|
|
3580
3627
|
if (pad.shape === "circle") {
|
|
3581
3628
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3582
|
-
const [x, y] =
|
|
3629
|
+
const [x, y] = applyToPoint22(transform, [pad.x, pad.y]);
|
|
3583
3630
|
const padElement = {
|
|
3584
3631
|
name: "circle",
|
|
3585
3632
|
type: "element",
|
|
@@ -3669,7 +3716,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3669
3716
|
}
|
|
3670
3717
|
if (pad.shape === "polygon") {
|
|
3671
3718
|
const points = (pad.points ?? []).map(
|
|
3672
|
-
(point) =>
|
|
3719
|
+
(point) => applyToPoint22(transform, [point.x, point.y])
|
|
3673
3720
|
);
|
|
3674
3721
|
const padElement = {
|
|
3675
3722
|
name: "polygon",
|
|
@@ -3768,10 +3815,10 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3768
3815
|
}
|
|
3769
3816
|
|
|
3770
3817
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
|
|
3771
|
-
import { applyToPoint as
|
|
3818
|
+
import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
3772
3819
|
|
|
3773
3820
|
// lib/utils/create-pcb-component-anchor-offset-indicators.ts
|
|
3774
|
-
import { applyToPoint as
|
|
3821
|
+
import { applyToPoint as applyToPoint23 } from "transformation-matrix";
|
|
3775
3822
|
var OFFSET_THRESHOLD_MM = 0.05;
|
|
3776
3823
|
var TICK_SIZE_PX = 4;
|
|
3777
3824
|
var LABEL_GAP_PX = 8;
|
|
@@ -3798,11 +3845,11 @@ function createAnchorOffsetIndicators(params) {
|
|
|
3798
3845
|
displayYOffset
|
|
3799
3846
|
} = params;
|
|
3800
3847
|
const objects = [];
|
|
3801
|
-
const [screenGroupAnchorX, screenGroupAnchorY] =
|
|
3848
|
+
const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint23(transform, [
|
|
3802
3849
|
groupAnchorPosition.x,
|
|
3803
3850
|
groupAnchorPosition.y
|
|
3804
3851
|
]);
|
|
3805
|
-
const [screenComponentX, screenComponentY] =
|
|
3852
|
+
const [screenComponentX, screenComponentY] = applyToPoint23(transform, [
|
|
3806
3853
|
componentPosition.x,
|
|
3807
3854
|
componentPosition.y
|
|
3808
3855
|
]);
|
|
@@ -4153,25 +4200,25 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
4153
4200
|
let path;
|
|
4154
4201
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4155
4202
|
path = outline.map((point, index) => {
|
|
4156
|
-
const [x, y] =
|
|
4203
|
+
const [x, y] = applyToPoint24(transform, [point.x, point.y]);
|
|
4157
4204
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4158
4205
|
}).join(" ");
|
|
4159
4206
|
} else {
|
|
4160
4207
|
const halfWidth = width / 2;
|
|
4161
4208
|
const halfHeight = height / 2;
|
|
4162
|
-
const topLeft =
|
|
4209
|
+
const topLeft = applyToPoint24(transform, [
|
|
4163
4210
|
center.x - halfWidth,
|
|
4164
4211
|
center.y - halfHeight
|
|
4165
4212
|
]);
|
|
4166
|
-
const topRight =
|
|
4213
|
+
const topRight = applyToPoint24(transform, [
|
|
4167
4214
|
center.x + halfWidth,
|
|
4168
4215
|
center.y - halfHeight
|
|
4169
4216
|
]);
|
|
4170
|
-
const bottomRight =
|
|
4217
|
+
const bottomRight = applyToPoint24(transform, [
|
|
4171
4218
|
center.x + halfWidth,
|
|
4172
4219
|
center.y + halfHeight
|
|
4173
4220
|
]);
|
|
4174
|
-
const bottomLeft =
|
|
4221
|
+
const bottomLeft = applyToPoint24(transform, [
|
|
4175
4222
|
center.x - halfWidth,
|
|
4176
4223
|
center.y + halfHeight
|
|
4177
4224
|
]);
|
|
@@ -4238,7 +4285,7 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
4238
4285
|
}
|
|
4239
4286
|
|
|
4240
4287
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
|
|
4241
|
-
import { applyToPoint as
|
|
4288
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
4242
4289
|
function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
4243
4290
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
4244
4291
|
const width = Number(pcbPanel.width);
|
|
@@ -4246,19 +4293,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
4246
4293
|
const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
|
|
4247
4294
|
const halfWidth = width / 2;
|
|
4248
4295
|
const halfHeight = height / 2;
|
|
4249
|
-
const topLeft =
|
|
4296
|
+
const topLeft = applyToPoint25(transform, [
|
|
4250
4297
|
center.x - halfWidth,
|
|
4251
4298
|
center.y - halfHeight
|
|
4252
4299
|
]);
|
|
4253
|
-
const topRight =
|
|
4300
|
+
const topRight = applyToPoint25(transform, [
|
|
4254
4301
|
center.x + halfWidth,
|
|
4255
4302
|
center.y - halfHeight
|
|
4256
4303
|
]);
|
|
4257
|
-
const bottomRight =
|
|
4304
|
+
const bottomRight = applyToPoint25(transform, [
|
|
4258
4305
|
center.x + halfWidth,
|
|
4259
4306
|
center.y + halfHeight
|
|
4260
4307
|
]);
|
|
4261
|
-
const bottomLeft =
|
|
4308
|
+
const bottomLeft = applyToPoint25(transform, [
|
|
4262
4309
|
center.x - halfWidth,
|
|
4263
4310
|
center.y + halfHeight
|
|
4264
4311
|
]);
|
|
@@ -4287,10 +4334,10 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
4287
4334
|
}
|
|
4288
4335
|
|
|
4289
4336
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
4290
|
-
import { applyToPoint as
|
|
4337
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
4291
4338
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
4292
4339
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
4293
|
-
const [x, y] =
|
|
4340
|
+
const [x, y] = applyToPoint26(transform, [hole.x, hole.y]);
|
|
4294
4341
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
4295
4342
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
4296
4343
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -4336,11 +4383,11 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
4336
4383
|
}
|
|
4337
4384
|
|
|
4338
4385
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
4339
|
-
import { applyToPoint as
|
|
4386
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
4340
4387
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
4341
4388
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
4342
4389
|
const layer = ctx.layer ?? "top";
|
|
4343
|
-
const [x, y] =
|
|
4390
|
+
const [x, y] = applyToPoint27(transform, [hole.x, hole.y]);
|
|
4344
4391
|
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
4345
4392
|
const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
|
|
4346
4393
|
const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
|
|
@@ -4837,7 +4884,7 @@ import {
|
|
|
4837
4884
|
getFullConnectivityMapFromCircuitJson
|
|
4838
4885
|
} from "circuit-json-to-connectivity-map";
|
|
4839
4886
|
import "svgson";
|
|
4840
|
-
import { applyToPoint as
|
|
4887
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
4841
4888
|
|
|
4842
4889
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
4843
4890
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -4917,11 +4964,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
4917
4964
|
});
|
|
4918
4965
|
const svgObjects = [];
|
|
4919
4966
|
for (const line of ratsNestLines) {
|
|
4920
|
-
const transformedStart =
|
|
4967
|
+
const transformedStart = applyToPoint28(transform, [
|
|
4921
4968
|
line.startPoint.x,
|
|
4922
4969
|
line.startPoint.y
|
|
4923
4970
|
]);
|
|
4924
|
-
const transformedEnd =
|
|
4971
|
+
const transformedEnd = applyToPoint28(transform, [
|
|
4925
4972
|
line.endPoint.x,
|
|
4926
4973
|
line.endPoint.y
|
|
4927
4974
|
]);
|
|
@@ -4949,7 +4996,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
4949
4996
|
|
|
4950
4997
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
4951
4998
|
import {
|
|
4952
|
-
applyToPoint as
|
|
4999
|
+
applyToPoint as applyToPoint29,
|
|
4953
5000
|
compose as compose4,
|
|
4954
5001
|
rotate as rotate4,
|
|
4955
5002
|
translate as translate4,
|
|
@@ -4959,7 +5006,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
4959
5006
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
4960
5007
|
if (cutout.shape === "rect") {
|
|
4961
5008
|
const rectCutout = cutout;
|
|
4962
|
-
const [cx, cy] =
|
|
5009
|
+
const [cx, cy] = applyToPoint29(transform, [
|
|
4963
5010
|
rectCutout.center.x,
|
|
4964
5011
|
rectCutout.center.y
|
|
4965
5012
|
]);
|
|
@@ -5001,7 +5048,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5001
5048
|
}
|
|
5002
5049
|
if (cutout.shape === "circle") {
|
|
5003
5050
|
const circleCutout = cutout;
|
|
5004
|
-
const [cx, cy] =
|
|
5051
|
+
const [cx, cy] = applyToPoint29(transform, [
|
|
5005
5052
|
circleCutout.center.x,
|
|
5006
5053
|
circleCutout.center.y
|
|
5007
5054
|
]);
|
|
@@ -5028,7 +5075,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5028
5075
|
const polygonCutout = cutout;
|
|
5029
5076
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
5030
5077
|
const transformedPoints = polygonCutout.points.map(
|
|
5031
|
-
(p) =>
|
|
5078
|
+
(p) => applyToPoint29(transform, [p.x, p.y])
|
|
5032
5079
|
);
|
|
5033
5080
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5034
5081
|
return [
|
|
@@ -5052,7 +5099,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5052
5099
|
|
|
5053
5100
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
5054
5101
|
import {
|
|
5055
|
-
applyToPoint as
|
|
5102
|
+
applyToPoint as applyToPoint31,
|
|
5056
5103
|
compose as compose5,
|
|
5057
5104
|
rotate as rotate5,
|
|
5058
5105
|
toString as matrixToString8,
|
|
@@ -5060,11 +5107,11 @@ import {
|
|
|
5060
5107
|
} from "transformation-matrix";
|
|
5061
5108
|
|
|
5062
5109
|
// lib/utils/ring-to-path-d.ts
|
|
5063
|
-
import { applyToPoint as
|
|
5110
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
5064
5111
|
function ringToPathD(vertices, transform) {
|
|
5065
5112
|
if (vertices.length === 0) return "";
|
|
5066
5113
|
const transformedVertices = vertices.map((v) => {
|
|
5067
|
-
const [x, y] =
|
|
5114
|
+
const [x, y] = applyToPoint30(transform, [v.x, v.y]);
|
|
5068
5115
|
return { ...v, x, y };
|
|
5069
5116
|
});
|
|
5070
5117
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -5153,7 +5200,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5153
5200
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
5154
5201
|
const maskOverlayOpacity = "0.9";
|
|
5155
5202
|
if (pour.shape === "rect") {
|
|
5156
|
-
const [cx, cy] =
|
|
5203
|
+
const [cx, cy] = applyToPoint31(transform, [pour.center.x, pour.center.y]);
|
|
5157
5204
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
5158
5205
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
5159
5206
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -5205,7 +5252,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5205
5252
|
if (pour.shape === "polygon") {
|
|
5206
5253
|
if (!pour.points || pour.points.length === 0) return [];
|
|
5207
5254
|
const transformedPoints = pour.points.map(
|
|
5208
|
-
(p) =>
|
|
5255
|
+
(p) => applyToPoint31(transform, [p.x, p.y])
|
|
5209
5256
|
);
|
|
5210
5257
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5211
5258
|
const copperPolygon = {
|
|
@@ -5428,11 +5475,11 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
5428
5475
|
}
|
|
5429
5476
|
|
|
5430
5477
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
5431
|
-
import { applyToPoint as
|
|
5478
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
5432
5479
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
5433
5480
|
const { transform, circuitJson } = ctx;
|
|
5434
5481
|
const { center, width, height, rotation = 0 } = component;
|
|
5435
|
-
const [x, y] =
|
|
5482
|
+
const [x, y] = applyToPoint32(transform, [center.x, center.y]);
|
|
5436
5483
|
const scaledWidth = width * Math.abs(transform.a);
|
|
5437
5484
|
const scaledHeight = height * Math.abs(transform.d);
|
|
5438
5485
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
@@ -5504,7 +5551,7 @@ function getParentAnchorPosition(component, circuitJson) {
|
|
|
5504
5551
|
}
|
|
5505
5552
|
|
|
5506
5553
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
5507
|
-
import { applyToPoint as
|
|
5554
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
5508
5555
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
5509
5556
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
5510
5557
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -5548,7 +5595,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5548
5595
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
5549
5596
|
)) {
|
|
5550
5597
|
const path = outline.map((point, index) => {
|
|
5551
|
-
const [x, y] =
|
|
5598
|
+
const [x, y] = applyToPoint33(transform, [point.x, point.y]);
|
|
5552
5599
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5553
5600
|
}).join(" ");
|
|
5554
5601
|
svgObjects.push({
|
|
@@ -5569,11 +5616,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5569
5616
|
}
|
|
5570
5617
|
const halfWidth = width / 2;
|
|
5571
5618
|
const halfHeight = height / 2;
|
|
5572
|
-
const [topLeftX, topLeftY] =
|
|
5619
|
+
const [topLeftX, topLeftY] = applyToPoint33(transform, [
|
|
5573
5620
|
center.x - halfWidth,
|
|
5574
5621
|
center.y + halfHeight
|
|
5575
5622
|
]);
|
|
5576
|
-
const [bottomRightX, bottomRightY] =
|
|
5623
|
+
const [bottomRightX, bottomRightY] = applyToPoint33(transform, [
|
|
5577
5624
|
center.x + halfWidth,
|
|
5578
5625
|
center.y - halfHeight
|
|
5579
5626
|
]);
|
|
@@ -5627,7 +5674,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5627
5674
|
var package_default = {
|
|
5628
5675
|
name: "circuit-to-svg",
|
|
5629
5676
|
type: "module",
|
|
5630
|
-
version: "0.0.
|
|
5677
|
+
version: "0.0.299",
|
|
5631
5678
|
description: "Convert Circuit JSON to SVG",
|
|
5632
5679
|
main: "dist/index.js",
|
|
5633
5680
|
files: [
|
|
@@ -6232,6 +6279,8 @@ function createSvgObjects({
|
|
|
6232
6279
|
return createSvgObjectsFromPcbSilkscreenCircle(elm, ctx);
|
|
6233
6280
|
case "pcb_silkscreen_line":
|
|
6234
6281
|
return createSvgObjectsFromPcbSilkscreenLine(elm, ctx);
|
|
6282
|
+
case "pcb_silkscreen_pill":
|
|
6283
|
+
return createSvgObjectsFromPcbSilkscreenPill(elm, ctx);
|
|
6235
6284
|
case "pcb_copper_text":
|
|
6236
6285
|
return createSvgObjectsFromPcbCopperText(elm, ctx);
|
|
6237
6286
|
case "pcb_courtyard_rect":
|
|
@@ -6272,8 +6321,8 @@ function createSvgObjects({
|
|
|
6272
6321
|
}
|
|
6273
6322
|
}
|
|
6274
6323
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
6275
|
-
const [x1, y1] =
|
|
6276
|
-
const [x2, y2] =
|
|
6324
|
+
const [x1, y1] = applyToPoint34(transform, [minX, minY]);
|
|
6325
|
+
const [x2, y2] = applyToPoint34(transform, [maxX, maxY]);
|
|
6277
6326
|
const width = Math.abs(x2 - x1);
|
|
6278
6327
|
const height = Math.abs(y2 - y1);
|
|
6279
6328
|
const x = Math.min(x1, x2);
|
|
@@ -6303,14 +6352,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
6303
6352
|
import { stringify as stringify2 } from "svgson";
|
|
6304
6353
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
6305
6354
|
import {
|
|
6306
|
-
applyToPoint as
|
|
6355
|
+
applyToPoint as applyToPoint41,
|
|
6307
6356
|
compose as compose7,
|
|
6308
6357
|
scale as scale4,
|
|
6309
6358
|
translate as translate7
|
|
6310
6359
|
} from "transformation-matrix";
|
|
6311
6360
|
|
|
6312
6361
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
6313
|
-
import { applyToPoint as
|
|
6362
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
6314
6363
|
var DEFAULT_BOARD_STYLE = {
|
|
6315
6364
|
fill: "none",
|
|
6316
6365
|
stroke: "rgb(0,0,0)",
|
|
@@ -6322,25 +6371,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6322
6371
|
let path;
|
|
6323
6372
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
6324
6373
|
path = outline.map((point, index) => {
|
|
6325
|
-
const [x, y] =
|
|
6374
|
+
const [x, y] = applyToPoint35(transform, [point.x, point.y]);
|
|
6326
6375
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
6327
6376
|
}).join(" ");
|
|
6328
6377
|
} else {
|
|
6329
6378
|
const halfWidth = width / 2;
|
|
6330
6379
|
const halfHeight = height / 2;
|
|
6331
|
-
const topLeft =
|
|
6380
|
+
const topLeft = applyToPoint35(transform, [
|
|
6332
6381
|
center.x - halfWidth,
|
|
6333
6382
|
center.y - halfHeight
|
|
6334
6383
|
]);
|
|
6335
|
-
const topRight =
|
|
6384
|
+
const topRight = applyToPoint35(transform, [
|
|
6336
6385
|
center.x + halfWidth,
|
|
6337
6386
|
center.y - halfHeight
|
|
6338
6387
|
]);
|
|
6339
|
-
const bottomRight =
|
|
6388
|
+
const bottomRight = applyToPoint35(transform, [
|
|
6340
6389
|
center.x + halfWidth,
|
|
6341
6390
|
center.y + halfHeight
|
|
6342
6391
|
]);
|
|
6343
|
-
const bottomLeft =
|
|
6392
|
+
const bottomLeft = applyToPoint35(transform, [
|
|
6344
6393
|
center.x - halfWidth,
|
|
6345
6394
|
center.y + halfHeight
|
|
6346
6395
|
]);
|
|
@@ -6366,7 +6415,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6366
6415
|
}
|
|
6367
6416
|
|
|
6368
6417
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
6369
|
-
import { applyToPoint as
|
|
6418
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
6370
6419
|
|
|
6371
6420
|
// lib/utils/get-sch-font-size.ts
|
|
6372
6421
|
import "transformation-matrix";
|
|
@@ -6392,8 +6441,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
6392
6441
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
6393
6442
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
6394
6443
|
return null;
|
|
6395
|
-
const [x, y] =
|
|
6396
|
-
const [pinX, pinY] =
|
|
6444
|
+
const [x, y] = applyToPoint37(transform, [center.x, center.y]);
|
|
6445
|
+
const [pinX, pinY] = applyToPoint37(transform, [portPosition.x, portPosition.y]);
|
|
6397
6446
|
const scaledWidth = width * Math.abs(transform.a);
|
|
6398
6447
|
const scaledHeight = height * Math.abs(transform.d);
|
|
6399
6448
|
const isTopLayer = layer === "top";
|
|
@@ -6555,11 +6604,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
6555
6604
|
}
|
|
6556
6605
|
|
|
6557
6606
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
6558
|
-
import { applyToPoint as
|
|
6607
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
6559
6608
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
6560
6609
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
6561
6610
|
const { transform } = ctx;
|
|
6562
|
-
const [x, y] =
|
|
6611
|
+
const [x, y] = applyToPoint38(transform, [hole.x, hole.y]);
|
|
6563
6612
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
6564
6613
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
6565
6614
|
const radius = scaledDiameter / 2;
|
|
@@ -6623,12 +6672,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
6623
6672
|
}
|
|
6624
6673
|
|
|
6625
6674
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
6626
|
-
import { applyToPoint as
|
|
6675
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
6627
6676
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
6628
6677
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
6629
6678
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
6630
6679
|
const { transform } = ctx;
|
|
6631
|
-
const [x, y] =
|
|
6680
|
+
const [x, y] = applyToPoint39(transform, [hole.x, hole.y]);
|
|
6632
6681
|
if (hole.shape === "pill") {
|
|
6633
6682
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
6634
6683
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -6723,7 +6772,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6723
6772
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
6724
6773
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
6725
6774
|
const holeRadius = scaledHoleDiameter / 2;
|
|
6726
|
-
const [holeCx, holeCy] =
|
|
6775
|
+
const [holeCx, holeCy] = applyToPoint39(transform, [
|
|
6727
6776
|
circularHole.x + circularHole.hole_offset_x,
|
|
6728
6777
|
circularHole.y + circularHole.hole_offset_y
|
|
6729
6778
|
]);
|
|
@@ -6781,7 +6830,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6781
6830
|
const pillHoleWithOffsets = pillHole;
|
|
6782
6831
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
6783
6832
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
6784
|
-
const [holeCenterX, holeCenterY] =
|
|
6833
|
+
const [holeCenterX, holeCenterY] = applyToPoint39(transform, [
|
|
6785
6834
|
pillHole.x + holeOffsetX,
|
|
6786
6835
|
pillHole.y + holeOffsetY
|
|
6787
6836
|
]);
|
|
@@ -6843,7 +6892,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6843
6892
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
6844
6893
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
6845
6894
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
6846
|
-
const [holeCenterX, holeCenterY] =
|
|
6895
|
+
const [holeCenterX, holeCenterY] = applyToPoint39(transform, [
|
|
6847
6896
|
rotatedHole.x + holeOffsetX,
|
|
6848
6897
|
rotatedHole.y + holeOffsetY
|
|
6849
6898
|
]);
|
|
@@ -6899,14 +6948,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6899
6948
|
}
|
|
6900
6949
|
|
|
6901
6950
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
6902
|
-
import { applyToPoint as
|
|
6951
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
6903
6952
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
6904
6953
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
6905
6954
|
const { transform } = ctx;
|
|
6906
6955
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
6907
6956
|
const width = pad.width * Math.abs(transform.a);
|
|
6908
6957
|
const height = pad.height * Math.abs(transform.d);
|
|
6909
|
-
const [x, y] =
|
|
6958
|
+
const [x, y] = applyToPoint40(transform, [pad.x, pad.y]);
|
|
6910
6959
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
6911
6960
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
6912
6961
|
return [
|
|
@@ -6958,7 +7007,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
6958
7007
|
const width = pad.width * Math.abs(transform.a);
|
|
6959
7008
|
const height = pad.height * Math.abs(transform.d);
|
|
6960
7009
|
const radius = pad.radius * Math.abs(transform.a);
|
|
6961
|
-
const [x, y] =
|
|
7010
|
+
const [x, y] = applyToPoint40(transform, [pad.x, pad.y]);
|
|
6962
7011
|
return [
|
|
6963
7012
|
{
|
|
6964
7013
|
name: "rect",
|
|
@@ -6981,7 +7030,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
6981
7030
|
}
|
|
6982
7031
|
if (pad.shape === "circle") {
|
|
6983
7032
|
const radius = pad.radius * Math.abs(transform.a);
|
|
6984
|
-
const [x, y] =
|
|
7033
|
+
const [x, y] = applyToPoint40(transform, [pad.x, pad.y]);
|
|
6985
7034
|
return [
|
|
6986
7035
|
{
|
|
6987
7036
|
name: "circle",
|
|
@@ -7001,7 +7050,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
7001
7050
|
}
|
|
7002
7051
|
if (pad.shape === "polygon") {
|
|
7003
7052
|
const points = (pad.points ?? []).map(
|
|
7004
|
-
(point) =>
|
|
7053
|
+
(point) => applyToPoint40(transform, [point.x, point.y])
|
|
7005
7054
|
);
|
|
7006
7055
|
return [
|
|
7007
7056
|
{
|
|
@@ -7185,8 +7234,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
7185
7234
|
}
|
|
7186
7235
|
}
|
|
7187
7236
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
7188
|
-
const [x1, y1] =
|
|
7189
|
-
const [x2, y2] =
|
|
7237
|
+
const [x1, y1] = applyToPoint41(transform, [minX, minY]);
|
|
7238
|
+
const [x2, y2] = applyToPoint41(transform, [maxX, maxY]);
|
|
7190
7239
|
const width = Math.abs(x2 - x1);
|
|
7191
7240
|
const height = Math.abs(y2 - y1);
|
|
7192
7241
|
const x = Math.min(x1, x2);
|
|
@@ -7215,7 +7264,7 @@ import {
|
|
|
7215
7264
|
} from "transformation-matrix";
|
|
7216
7265
|
|
|
7217
7266
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
7218
|
-
import { applyToPoint as
|
|
7267
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
7219
7268
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
7220
7269
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
7221
7270
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -7229,25 +7278,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7229
7278
|
let path;
|
|
7230
7279
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
7231
7280
|
path = outline.map((point, index) => {
|
|
7232
|
-
const [x, y] =
|
|
7281
|
+
const [x, y] = applyToPoint42(transform, [point.x, point.y]);
|
|
7233
7282
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
7234
7283
|
}).join(" ");
|
|
7235
7284
|
} else {
|
|
7236
7285
|
const halfWidth = width / 2;
|
|
7237
7286
|
const halfHeight = height / 2;
|
|
7238
|
-
const topLeft =
|
|
7287
|
+
const topLeft = applyToPoint42(transform, [
|
|
7239
7288
|
center.x - halfWidth,
|
|
7240
7289
|
center.y - halfHeight
|
|
7241
7290
|
]);
|
|
7242
|
-
const topRight =
|
|
7291
|
+
const topRight = applyToPoint42(transform, [
|
|
7243
7292
|
center.x + halfWidth,
|
|
7244
7293
|
center.y - halfHeight
|
|
7245
7294
|
]);
|
|
7246
|
-
const bottomRight =
|
|
7295
|
+
const bottomRight = applyToPoint42(transform, [
|
|
7247
7296
|
center.x + halfWidth,
|
|
7248
7297
|
center.y + halfHeight
|
|
7249
7298
|
]);
|
|
7250
|
-
const bottomLeft =
|
|
7299
|
+
const bottomLeft = applyToPoint42(transform, [
|
|
7251
7300
|
center.x - halfWidth,
|
|
7252
7301
|
center.y + halfHeight
|
|
7253
7302
|
]);
|
|
@@ -7265,10 +7314,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7265
7314
|
const halfWidth = width2 / 2;
|
|
7266
7315
|
const halfHeight = height2 / 2;
|
|
7267
7316
|
const [tl, tr, br, bl] = [
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7317
|
+
applyToPoint42(transform, [x - halfWidth, y - halfHeight]),
|
|
7318
|
+
applyToPoint42(transform, [x + halfWidth, y - halfHeight]),
|
|
7319
|
+
applyToPoint42(transform, [x + halfWidth, y + halfHeight]),
|
|
7320
|
+
applyToPoint42(transform, [x - halfWidth, y + halfHeight])
|
|
7272
7321
|
];
|
|
7273
7322
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
7274
7323
|
} else if (cutout.shape === "circle") {
|
|
@@ -7318,7 +7367,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7318
7367
|
|
|
7319
7368
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
7320
7369
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
7321
|
-
import { applyToPoint as
|
|
7370
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
7322
7371
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
7323
7372
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
7324
7373
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -7328,7 +7377,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7328
7377
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
7329
7378
|
return [];
|
|
7330
7379
|
}
|
|
7331
|
-
const [x, y] =
|
|
7380
|
+
const [x, y] = applyToPoint43(transform, [center.x, center.y]);
|
|
7332
7381
|
const scaledWidth = width * Math.abs(transform.a);
|
|
7333
7382
|
const scaledHeight = height * Math.abs(transform.d);
|
|
7334
7383
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -7389,11 +7438,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7389
7438
|
}
|
|
7390
7439
|
|
|
7391
7440
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
7392
|
-
import { applyToPoint as
|
|
7441
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
7393
7442
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
7394
7443
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
7395
7444
|
const { transform } = ctx;
|
|
7396
|
-
const [x, y] =
|
|
7445
|
+
const [x, y] = applyToPoint44(transform, [hole.x, hole.y]);
|
|
7397
7446
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
7398
7447
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
7399
7448
|
const radius = scaledDiameter / 2;
|
|
@@ -7457,12 +7506,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
7457
7506
|
}
|
|
7458
7507
|
|
|
7459
7508
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
7460
|
-
import { applyToPoint as
|
|
7509
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
7461
7510
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
7462
7511
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
7463
7512
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
7464
7513
|
const { transform } = ctx;
|
|
7465
|
-
const [x, y] =
|
|
7514
|
+
const [x, y] = applyToPoint45(transform, [hole.x, hole.y]);
|
|
7466
7515
|
if (hole.shape === "pill") {
|
|
7467
7516
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
7468
7517
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -7697,14 +7746,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
7697
7746
|
}
|
|
7698
7747
|
|
|
7699
7748
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
7700
|
-
import { applyToPoint as
|
|
7749
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
7701
7750
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
7702
7751
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
7703
7752
|
const { transform } = ctx;
|
|
7704
7753
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7705
7754
|
const width = pad.width * Math.abs(transform.a);
|
|
7706
7755
|
const height = pad.height * Math.abs(transform.d);
|
|
7707
|
-
const [x, y] =
|
|
7756
|
+
const [x, y] = applyToPoint46(transform, [pad.x, pad.y]);
|
|
7708
7757
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7709
7758
|
return [
|
|
7710
7759
|
{
|
|
@@ -7747,7 +7796,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7747
7796
|
const width = pad.width * Math.abs(transform.a);
|
|
7748
7797
|
const height = pad.height * Math.abs(transform.d);
|
|
7749
7798
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7750
|
-
const [x, y] =
|
|
7799
|
+
const [x, y] = applyToPoint46(transform, [pad.x, pad.y]);
|
|
7751
7800
|
return [
|
|
7752
7801
|
{
|
|
7753
7802
|
name: "rect",
|
|
@@ -7770,7 +7819,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7770
7819
|
}
|
|
7771
7820
|
if (pad.shape === "circle") {
|
|
7772
7821
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7773
|
-
const [x, y] =
|
|
7822
|
+
const [x, y] = applyToPoint46(transform, [pad.x, pad.y]);
|
|
7774
7823
|
return [
|
|
7775
7824
|
{
|
|
7776
7825
|
name: "circle",
|
|
@@ -7790,7 +7839,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7790
7839
|
}
|
|
7791
7840
|
if (pad.shape === "polygon") {
|
|
7792
7841
|
const points = (pad.points ?? []).map(
|
|
7793
|
-
(point) =>
|
|
7842
|
+
(point) => applyToPoint46(transform, [point.x, point.y])
|
|
7794
7843
|
);
|
|
7795
7844
|
return [
|
|
7796
7845
|
{
|
|
@@ -7811,7 +7860,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7811
7860
|
}
|
|
7812
7861
|
|
|
7813
7862
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
7814
|
-
import { applyToPoint as
|
|
7863
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7815
7864
|
import { calculateElbow } from "calculate-elbow";
|
|
7816
7865
|
|
|
7817
7866
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -7888,7 +7937,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
7888
7937
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
7889
7938
|
if (!label_info) return [];
|
|
7890
7939
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
7891
|
-
const [port_x, port_y] =
|
|
7940
|
+
const [port_x, port_y] = applyToPoint47(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
7892
7941
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
7893
7942
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
7894
7943
|
const elbow_path = calculateElbow(
|
|
@@ -8029,7 +8078,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8029
8078
|
}
|
|
8030
8079
|
|
|
8031
8080
|
// lib/pinout/calculate-label-positions.ts
|
|
8032
|
-
import { applyToPoint as
|
|
8081
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
8033
8082
|
|
|
8034
8083
|
// lib/pinout/constants.ts
|
|
8035
8084
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -8067,7 +8116,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8067
8116
|
);
|
|
8068
8117
|
const mapToEdgePort = (pinout_label) => ({
|
|
8069
8118
|
pcb_port: pinout_label.pcb_port,
|
|
8070
|
-
y:
|
|
8119
|
+
y: applyToPoint48(transform, [
|
|
8071
8120
|
pinout_label.pcb_port.x,
|
|
8072
8121
|
pinout_label.pcb_port.y
|
|
8073
8122
|
])[1],
|
|
@@ -8082,7 +8131,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8082
8131
|
} else {
|
|
8083
8132
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
8084
8133
|
pcb_port: pinout_label.pcb_port,
|
|
8085
|
-
y:
|
|
8134
|
+
y: applyToPoint48(transform, [
|
|
8086
8135
|
pinout_label.pcb_port.x,
|
|
8087
8136
|
pinout_label.pcb_port.y
|
|
8088
8137
|
])[1],
|
|
@@ -8090,7 +8139,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8090
8139
|
})).sort((a, b) => a.y - b.y);
|
|
8091
8140
|
}
|
|
8092
8141
|
if (edge_ports.length === 0) return;
|
|
8093
|
-
const board_edge_x =
|
|
8142
|
+
const board_edge_x = applyToPoint48(transform, [
|
|
8094
8143
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
8095
8144
|
0
|
|
8096
8145
|
])[0];
|
|
@@ -8512,14 +8561,14 @@ import {
|
|
|
8512
8561
|
} from "transformation-matrix";
|
|
8513
8562
|
|
|
8514
8563
|
// lib/sch/draw-schematic-grid.ts
|
|
8515
|
-
import { applyToPoint as
|
|
8564
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
8516
8565
|
function drawSchematicGrid(params) {
|
|
8517
8566
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
8518
8567
|
const cellSize = params.cellSize ?? 1;
|
|
8519
8568
|
const labelCells = params.labelCells ?? false;
|
|
8520
8569
|
const gridLines = [];
|
|
8521
8570
|
const transformPoint = (x, y) => {
|
|
8522
|
-
const [transformedX, transformedY] =
|
|
8571
|
+
const [transformedX, transformedY] = applyToPoint49(params.transform, [x, y]);
|
|
8523
8572
|
return { x: transformedX, y: transformedY };
|
|
8524
8573
|
};
|
|
8525
8574
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -8600,15 +8649,15 @@ function drawSchematicGrid(params) {
|
|
|
8600
8649
|
}
|
|
8601
8650
|
|
|
8602
8651
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
8603
|
-
import { applyToPoint as
|
|
8652
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
8604
8653
|
function drawSchematicLabeledPoints(params) {
|
|
8605
8654
|
const { points, transform } = params;
|
|
8606
8655
|
const labeledPointsGroup = [];
|
|
8607
8656
|
for (const point of points) {
|
|
8608
|
-
const [x1, y1] =
|
|
8609
|
-
const [x2, y2] =
|
|
8610
|
-
const [x3, y3] =
|
|
8611
|
-
const [x4, y4] =
|
|
8657
|
+
const [x1, y1] = applyToPoint50(transform, [point.x - 0.1, point.y - 0.1]);
|
|
8658
|
+
const [x2, y2] = applyToPoint50(transform, [point.x + 0.1, point.y + 0.1]);
|
|
8659
|
+
const [x3, y3] = applyToPoint50(transform, [point.x - 0.1, point.y + 0.1]);
|
|
8660
|
+
const [x4, y4] = applyToPoint50(transform, [point.x + 0.1, point.y - 0.1]);
|
|
8612
8661
|
labeledPointsGroup.push({
|
|
8613
8662
|
name: "path",
|
|
8614
8663
|
type: "element",
|
|
@@ -8619,7 +8668,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
8619
8668
|
"stroke-opacity": "0.7"
|
|
8620
8669
|
}
|
|
8621
8670
|
});
|
|
8622
|
-
const [labelX, labelY] =
|
|
8671
|
+
const [labelX, labelY] = applyToPoint50(transform, [
|
|
8623
8672
|
point.x + 0.15,
|
|
8624
8673
|
point.y - 0.15
|
|
8625
8674
|
]);
|
|
@@ -9737,7 +9786,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
9737
9786
|
import { symbols } from "schematic-symbols";
|
|
9738
9787
|
import "svgson";
|
|
9739
9788
|
import {
|
|
9740
|
-
applyToPoint as
|
|
9789
|
+
applyToPoint as applyToPoint52,
|
|
9741
9790
|
compose as compose10
|
|
9742
9791
|
} from "transformation-matrix";
|
|
9743
9792
|
|
|
@@ -9821,13 +9870,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
9821
9870
|
}
|
|
9822
9871
|
|
|
9823
9872
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
9824
|
-
import { applyToPoint as
|
|
9873
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
9825
9874
|
var createSvgSchErrorText = ({
|
|
9826
9875
|
text,
|
|
9827
9876
|
realCenter,
|
|
9828
9877
|
realToScreenTransform
|
|
9829
9878
|
}) => {
|
|
9830
|
-
const screenCenter =
|
|
9879
|
+
const screenCenter = applyToPoint51(realToScreenTransform, realCenter);
|
|
9831
9880
|
return {
|
|
9832
9881
|
type: "element",
|
|
9833
9882
|
name: "text",
|
|
@@ -9936,11 +9985,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
9936
9985
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
9937
9986
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
9938
9987
|
};
|
|
9939
|
-
const [screenMinX, screenMinY] =
|
|
9988
|
+
const [screenMinX, screenMinY] = applyToPoint52(
|
|
9940
9989
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
9941
9990
|
[bounds.minX, bounds.minY]
|
|
9942
9991
|
);
|
|
9943
|
-
const [screenMaxX, screenMaxY] =
|
|
9992
|
+
const [screenMaxX, screenMaxY] = applyToPoint52(
|
|
9944
9993
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
9945
9994
|
[bounds.maxX, bounds.maxY]
|
|
9946
9995
|
);
|
|
@@ -9969,7 +10018,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
9969
10018
|
name: "path",
|
|
9970
10019
|
attributes: {
|
|
9971
10020
|
d: points.map((p, i) => {
|
|
9972
|
-
const [x, y] =
|
|
10021
|
+
const [x, y] = applyToPoint52(
|
|
9973
10022
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
9974
10023
|
[p.x, p.y]
|
|
9975
10024
|
);
|
|
@@ -9985,7 +10034,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
9985
10034
|
});
|
|
9986
10035
|
}
|
|
9987
10036
|
for (const text of texts) {
|
|
9988
|
-
const screenTextPos =
|
|
10037
|
+
const screenTextPos = applyToPoint52(
|
|
9989
10038
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
9990
10039
|
text
|
|
9991
10040
|
);
|
|
@@ -10037,7 +10086,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10037
10086
|
});
|
|
10038
10087
|
}
|
|
10039
10088
|
for (const box of boxes) {
|
|
10040
|
-
const screenBoxPos =
|
|
10089
|
+
const screenBoxPos = applyToPoint52(
|
|
10041
10090
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
10042
10091
|
box
|
|
10043
10092
|
);
|
|
@@ -10061,7 +10110,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10061
10110
|
}
|
|
10062
10111
|
for (const port of symbol.ports) {
|
|
10063
10112
|
if (connectedSymbolPorts.has(port)) continue;
|
|
10064
|
-
const screenPortPos =
|
|
10113
|
+
const screenPortPos = applyToPoint52(
|
|
10065
10114
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
10066
10115
|
port
|
|
10067
10116
|
);
|
|
@@ -10081,7 +10130,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10081
10130
|
});
|
|
10082
10131
|
}
|
|
10083
10132
|
for (const circle of circles) {
|
|
10084
|
-
const screenCirclePos =
|
|
10133
|
+
const screenCirclePos = applyToPoint52(
|
|
10085
10134
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
10086
10135
|
circle
|
|
10087
10136
|
);
|
|
@@ -10108,14 +10157,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10108
10157
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
10109
10158
|
import "schematic-symbols";
|
|
10110
10159
|
import "svgson";
|
|
10111
|
-
import { applyToPoint as
|
|
10160
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
10112
10161
|
|
|
10113
10162
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
10114
10163
|
import "transformation-matrix";
|
|
10115
10164
|
import "@tscircuit/circuit-json-util";
|
|
10116
10165
|
|
|
10117
10166
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
10118
|
-
import { applyToPoint as
|
|
10167
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
10119
10168
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
10120
10169
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
10121
10170
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -10168,8 +10217,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10168
10217
|
realEdgePos.y += realPinLineLength;
|
|
10169
10218
|
break;
|
|
10170
10219
|
}
|
|
10171
|
-
const screenSchPortPos =
|
|
10172
|
-
const screenRealEdgePos =
|
|
10220
|
+
const screenSchPortPos = applyToPoint53(transform, schPort.center);
|
|
10221
|
+
const screenRealEdgePos = applyToPoint53(transform, realEdgePos);
|
|
10173
10222
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
10174
10223
|
const realLineEnd = { ...schPort.center };
|
|
10175
10224
|
if (!isConnected) {
|
|
@@ -10188,7 +10237,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10188
10237
|
break;
|
|
10189
10238
|
}
|
|
10190
10239
|
}
|
|
10191
|
-
const screenLineEnd =
|
|
10240
|
+
const screenLineEnd = applyToPoint53(transform, realLineEnd);
|
|
10192
10241
|
svgObjects.push({
|
|
10193
10242
|
name: "line",
|
|
10194
10243
|
type: "element",
|
|
@@ -10309,7 +10358,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10309
10358
|
};
|
|
10310
10359
|
|
|
10311
10360
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
10312
|
-
import { applyToPoint as
|
|
10361
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
10313
10362
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
10314
10363
|
const svgObjects = [];
|
|
10315
10364
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -10327,7 +10376,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10327
10376
|
} else {
|
|
10328
10377
|
realPinNumberPos.y += 0.02;
|
|
10329
10378
|
}
|
|
10330
|
-
const screenPinNumberTextPos =
|
|
10379
|
+
const screenPinNumberTextPos = applyToPoint54(transform, realPinNumberPos);
|
|
10331
10380
|
svgObjects.push({
|
|
10332
10381
|
name: "text",
|
|
10333
10382
|
type: "element",
|
|
@@ -10357,7 +10406,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10357
10406
|
};
|
|
10358
10407
|
|
|
10359
10408
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
10360
|
-
import { applyToPoint as
|
|
10409
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
10361
10410
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
10362
10411
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
10363
10412
|
const svgObjects = [];
|
|
@@ -10371,7 +10420,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
10371
10420
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
10372
10421
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10373
10422
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10374
|
-
const screenPinNumberTextPos =
|
|
10423
|
+
const screenPinNumberTextPos = applyToPoint55(transform, realPinNumberPos);
|
|
10375
10424
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
10376
10425
|
if (!label) return [];
|
|
10377
10426
|
const isNegated = label.startsWith("N_");
|
|
@@ -10419,13 +10468,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
10419
10468
|
};
|
|
10420
10469
|
|
|
10421
10470
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
10422
|
-
import { applyToPoint as
|
|
10471
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
10423
10472
|
var createSvgSchText = ({
|
|
10424
10473
|
elm,
|
|
10425
10474
|
transform,
|
|
10426
10475
|
colorMap: colorMap2
|
|
10427
10476
|
}) => {
|
|
10428
|
-
const center =
|
|
10477
|
+
const center = applyToPoint57(transform, elm.position);
|
|
10429
10478
|
const textAnchorMap = {
|
|
10430
10479
|
center: "middle",
|
|
10431
10480
|
center_right: "end",
|
|
@@ -10509,11 +10558,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
10509
10558
|
colorMap: colorMap2
|
|
10510
10559
|
}) => {
|
|
10511
10560
|
const svgObjects = [];
|
|
10512
|
-
const componentScreenTopLeft =
|
|
10561
|
+
const componentScreenTopLeft = applyToPoint58(transform, {
|
|
10513
10562
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
10514
10563
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
10515
10564
|
});
|
|
10516
|
-
const componentScreenBottomRight =
|
|
10565
|
+
const componentScreenBottomRight = applyToPoint58(transform, {
|
|
10517
10566
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
10518
10567
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
10519
10568
|
});
|
|
@@ -10599,13 +10648,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
10599
10648
|
}
|
|
10600
10649
|
|
|
10601
10650
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
10602
|
-
import { applyToPoint as
|
|
10651
|
+
import { applyToPoint as applyToPoint59 } from "transformation-matrix";
|
|
10603
10652
|
function createSvgObjectsFromSchVoltageProbe({
|
|
10604
10653
|
probe,
|
|
10605
10654
|
transform,
|
|
10606
10655
|
colorMap: colorMap2
|
|
10607
10656
|
}) {
|
|
10608
|
-
const [screenX, screenY] =
|
|
10657
|
+
const [screenX, screenY] = applyToPoint59(transform, [
|
|
10609
10658
|
probe.position.x,
|
|
10610
10659
|
probe.position.y
|
|
10611
10660
|
]);
|
|
@@ -10779,17 +10828,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
10779
10828
|
}
|
|
10780
10829
|
|
|
10781
10830
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
10782
|
-
import { applyToPoint as
|
|
10831
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
10783
10832
|
function createSvgObjectsFromSchDebugObject({
|
|
10784
10833
|
debugObject,
|
|
10785
10834
|
transform
|
|
10786
10835
|
}) {
|
|
10787
10836
|
if (debugObject.shape === "rect") {
|
|
10788
|
-
let [screenLeft, screenTop] =
|
|
10837
|
+
let [screenLeft, screenTop] = applyToPoint60(transform, [
|
|
10789
10838
|
debugObject.center.x - debugObject.size.width / 2,
|
|
10790
10839
|
debugObject.center.y - debugObject.size.height / 2
|
|
10791
10840
|
]);
|
|
10792
|
-
let [screenRight, screenBottom] =
|
|
10841
|
+
let [screenRight, screenBottom] = applyToPoint60(transform, [
|
|
10793
10842
|
debugObject.center.x + debugObject.size.width / 2,
|
|
10794
10843
|
debugObject.center.y + debugObject.size.height / 2
|
|
10795
10844
|
]);
|
|
@@ -10799,7 +10848,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
10799
10848
|
];
|
|
10800
10849
|
const width = Math.abs(screenRight - screenLeft);
|
|
10801
10850
|
const height = Math.abs(screenBottom - screenTop);
|
|
10802
|
-
const [screenCenterX, screenCenterY] =
|
|
10851
|
+
const [screenCenterX, screenCenterY] = applyToPoint60(transform, [
|
|
10803
10852
|
debugObject.center.x,
|
|
10804
10853
|
debugObject.center.y
|
|
10805
10854
|
]);
|
|
@@ -10845,11 +10894,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
10845
10894
|
];
|
|
10846
10895
|
}
|
|
10847
10896
|
if (debugObject.shape === "line") {
|
|
10848
|
-
const [screenStartX, screenStartY] =
|
|
10897
|
+
const [screenStartX, screenStartY] = applyToPoint60(transform, [
|
|
10849
10898
|
debugObject.start.x,
|
|
10850
10899
|
debugObject.start.y
|
|
10851
10900
|
]);
|
|
10852
|
-
const [screenEndX, screenEndY] =
|
|
10901
|
+
const [screenEndX, screenEndY] = applyToPoint60(transform, [
|
|
10853
10902
|
debugObject.end.x,
|
|
10854
10903
|
debugObject.end.y
|
|
10855
10904
|
]);
|
|
@@ -10899,7 +10948,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
10899
10948
|
}
|
|
10900
10949
|
|
|
10901
10950
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
10902
|
-
import { applyToPoint as
|
|
10951
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
10903
10952
|
function createSchematicTrace({
|
|
10904
10953
|
trace,
|
|
10905
10954
|
transform,
|
|
@@ -10913,11 +10962,11 @@ function createSchematicTrace({
|
|
|
10913
10962
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
10914
10963
|
const edge = edges[edgeIndex];
|
|
10915
10964
|
if (edge.is_crossing) continue;
|
|
10916
|
-
const [screenFromX, screenFromY] =
|
|
10965
|
+
const [screenFromX, screenFromY] = applyToPoint61(transform, [
|
|
10917
10966
|
edge.from.x,
|
|
10918
10967
|
edge.from.y
|
|
10919
10968
|
]);
|
|
10920
|
-
const [screenToX, screenToY] =
|
|
10969
|
+
const [screenToX, screenToY] = applyToPoint61(transform, [
|
|
10921
10970
|
edge.to.x,
|
|
10922
10971
|
edge.to.y
|
|
10923
10972
|
]);
|
|
@@ -10961,11 +11010,11 @@ function createSchematicTrace({
|
|
|
10961
11010
|
}
|
|
10962
11011
|
for (const edge of edges) {
|
|
10963
11012
|
if (!edge.is_crossing) continue;
|
|
10964
|
-
const [screenFromX, screenFromY] =
|
|
11013
|
+
const [screenFromX, screenFromY] = applyToPoint61(transform, [
|
|
10965
11014
|
edge.from.x,
|
|
10966
11015
|
edge.from.y
|
|
10967
11016
|
]);
|
|
10968
|
-
const [screenToX, screenToY] =
|
|
11017
|
+
const [screenToX, screenToY] = applyToPoint61(transform, [
|
|
10969
11018
|
edge.to.x,
|
|
10970
11019
|
edge.to.y
|
|
10971
11020
|
]);
|
|
@@ -11009,7 +11058,7 @@ function createSchematicTrace({
|
|
|
11009
11058
|
}
|
|
11010
11059
|
if (trace.junctions) {
|
|
11011
11060
|
for (const junction of trace.junctions) {
|
|
11012
|
-
const [screenX, screenY] =
|
|
11061
|
+
const [screenX, screenY] = applyToPoint61(transform, [
|
|
11013
11062
|
junction.x,
|
|
11014
11063
|
junction.y
|
|
11015
11064
|
]);
|
|
@@ -11064,7 +11113,7 @@ function createSchematicTrace({
|
|
|
11064
11113
|
|
|
11065
11114
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
11066
11115
|
import {
|
|
11067
|
-
applyToPoint as
|
|
11116
|
+
applyToPoint as applyToPoint63,
|
|
11068
11117
|
compose as compose12,
|
|
11069
11118
|
rotate as rotate7,
|
|
11070
11119
|
scale as scale7,
|
|
@@ -11073,7 +11122,7 @@ import {
|
|
|
11073
11122
|
|
|
11074
11123
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
11075
11124
|
import {
|
|
11076
|
-
applyToPoint as
|
|
11125
|
+
applyToPoint as applyToPoint62,
|
|
11077
11126
|
compose as compose11,
|
|
11078
11127
|
rotate as rotate6,
|
|
11079
11128
|
scale as scale6,
|
|
@@ -11148,7 +11197,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11148
11197
|
x: symbolBounds.minX,
|
|
11149
11198
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
11150
11199
|
};
|
|
11151
|
-
const rotatedSymbolEnd =
|
|
11200
|
+
const rotatedSymbolEnd = applyToPoint62(rotationMatrix, symbolEndPoint);
|
|
11152
11201
|
const symbolToRealTransform = compose11(
|
|
11153
11202
|
translate11(
|
|
11154
11203
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -11158,11 +11207,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11158
11207
|
scale6(1)
|
|
11159
11208
|
// Use full symbol size
|
|
11160
11209
|
);
|
|
11161
|
-
const [screenMinX, screenMinY] =
|
|
11210
|
+
const [screenMinX, screenMinY] = applyToPoint62(
|
|
11162
11211
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11163
11212
|
[bounds.minX, bounds.minY]
|
|
11164
11213
|
);
|
|
11165
|
-
const [screenMaxX, screenMaxY] =
|
|
11214
|
+
const [screenMaxX, screenMaxY] = applyToPoint62(
|
|
11166
11215
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11167
11216
|
[bounds.maxX, bounds.maxY]
|
|
11168
11217
|
);
|
|
@@ -11186,7 +11235,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11186
11235
|
});
|
|
11187
11236
|
for (const path of symbolPaths) {
|
|
11188
11237
|
const symbolPath = path.points.map((p, i) => {
|
|
11189
|
-
const [x, y] =
|
|
11238
|
+
const [x, y] = applyToPoint62(
|
|
11190
11239
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11191
11240
|
[p.x, p.y]
|
|
11192
11241
|
);
|
|
@@ -11207,7 +11256,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11207
11256
|
});
|
|
11208
11257
|
}
|
|
11209
11258
|
for (const text of symbolTexts) {
|
|
11210
|
-
const screenTextPos =
|
|
11259
|
+
const screenTextPos = applyToPoint62(
|
|
11211
11260
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11212
11261
|
text
|
|
11213
11262
|
);
|
|
@@ -11249,7 +11298,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11249
11298
|
});
|
|
11250
11299
|
}
|
|
11251
11300
|
for (const box of symbolBoxes) {
|
|
11252
|
-
const screenBoxPos =
|
|
11301
|
+
const screenBoxPos = applyToPoint62(
|
|
11253
11302
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11254
11303
|
box
|
|
11255
11304
|
);
|
|
@@ -11272,7 +11321,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11272
11321
|
});
|
|
11273
11322
|
}
|
|
11274
11323
|
for (const circle of symbolCircles) {
|
|
11275
|
-
const screenCirclePos =
|
|
11324
|
+
const screenCirclePos = applyToPoint62(
|
|
11276
11325
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11277
11326
|
circle
|
|
11278
11327
|
);
|
|
@@ -11317,14 +11366,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11317
11366
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
11318
11367
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
11319
11368
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
11320
|
-
const screenCenter =
|
|
11369
|
+
const screenCenter = applyToPoint63(realToScreenTransform, schNetLabel.center);
|
|
11321
11370
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
11322
11371
|
schNetLabel.anchor_side
|
|
11323
11372
|
);
|
|
11324
11373
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
11325
11374
|
screenTextGrowthVec.y *= -1;
|
|
11326
11375
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
11327
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
11376
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint63(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
11328
11377
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
11329
11378
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
11330
11379
|
};
|
|
@@ -11365,7 +11414,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11365
11414
|
y: -0.6
|
|
11366
11415
|
}
|
|
11367
11416
|
].map(
|
|
11368
|
-
(fontRelativePoint) =>
|
|
11417
|
+
(fontRelativePoint) => applyToPoint63(
|
|
11369
11418
|
compose12(
|
|
11370
11419
|
realToScreenTransform,
|
|
11371
11420
|
translate12(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -11442,17 +11491,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11442
11491
|
};
|
|
11443
11492
|
|
|
11444
11493
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
11445
|
-
import { applyToPoint as
|
|
11494
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
11446
11495
|
var createSvgObjectsFromSchematicBox = ({
|
|
11447
11496
|
schematicBox,
|
|
11448
11497
|
transform,
|
|
11449
11498
|
colorMap: colorMap2
|
|
11450
11499
|
}) => {
|
|
11451
|
-
const topLeft =
|
|
11500
|
+
const topLeft = applyToPoint64(transform, {
|
|
11452
11501
|
x: schematicBox.x,
|
|
11453
11502
|
y: schematicBox.y
|
|
11454
11503
|
});
|
|
11455
|
-
const bottomRight =
|
|
11504
|
+
const bottomRight = applyToPoint64(transform, {
|
|
11456
11505
|
x: schematicBox.x + schematicBox.width,
|
|
11457
11506
|
y: schematicBox.y + schematicBox.height
|
|
11458
11507
|
});
|
|
@@ -11488,7 +11537,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
11488
11537
|
};
|
|
11489
11538
|
|
|
11490
11539
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
11491
|
-
import { applyToPoint as
|
|
11540
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
11492
11541
|
var createSvgObjectsFromSchematicTable = ({
|
|
11493
11542
|
schematicTable,
|
|
11494
11543
|
transform,
|
|
@@ -11521,11 +11570,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11521
11570
|
const svgObjects = [];
|
|
11522
11571
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
11523
11572
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
11524
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
11573
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint65(transform, [
|
|
11525
11574
|
topLeftX,
|
|
11526
11575
|
topLeftY
|
|
11527
11576
|
]);
|
|
11528
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
11577
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint65(transform, [
|
|
11529
11578
|
topLeftX + totalWidth,
|
|
11530
11579
|
topLeftY - totalHeight
|
|
11531
11580
|
]);
|
|
@@ -11557,8 +11606,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11557
11606
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
11558
11607
|
);
|
|
11559
11608
|
if (!isMerged) {
|
|
11560
|
-
const start =
|
|
11561
|
-
const end =
|
|
11609
|
+
const start = applyToPoint65(transform, { x: currentX, y: segmentStartY });
|
|
11610
|
+
const end = applyToPoint65(transform, { x: currentX, y: segmentEndY });
|
|
11562
11611
|
svgObjects.push({
|
|
11563
11612
|
name: "line",
|
|
11564
11613
|
type: "element",
|
|
@@ -11587,11 +11636,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11587
11636
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
11588
11637
|
);
|
|
11589
11638
|
if (!isMerged) {
|
|
11590
|
-
const start =
|
|
11639
|
+
const start = applyToPoint65(transform, {
|
|
11591
11640
|
x: segmentStartX,
|
|
11592
11641
|
y: currentY
|
|
11593
11642
|
});
|
|
11594
|
-
const end =
|
|
11643
|
+
const end = applyToPoint65(transform, { x: segmentEndX, y: currentY });
|
|
11595
11644
|
svgObjects.push({
|
|
11596
11645
|
name: "line",
|
|
11597
11646
|
type: "element",
|
|
@@ -11633,7 +11682,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11633
11682
|
} else if (vertical_align === "bottom") {
|
|
11634
11683
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
11635
11684
|
}
|
|
11636
|
-
const screenTextAnchorPos =
|
|
11685
|
+
const screenTextAnchorPos = applyToPoint65(transform, realTextAnchorPos);
|
|
11637
11686
|
const fontSize = getSchScreenFontSize(
|
|
11638
11687
|
transform,
|
|
11639
11688
|
"reference_designator",
|
|
@@ -11689,13 +11738,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11689
11738
|
|
|
11690
11739
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
11691
11740
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
11692
|
-
import { applyToPoint as
|
|
11741
|
+
import { applyToPoint as applyToPoint66 } from "transformation-matrix";
|
|
11693
11742
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
11694
11743
|
var createSvgObjectsForSchPortHover = ({
|
|
11695
11744
|
schPort,
|
|
11696
11745
|
transform
|
|
11697
11746
|
}) => {
|
|
11698
|
-
const screenSchPortPos =
|
|
11747
|
+
const screenSchPortPos = applyToPoint66(transform, schPort.center);
|
|
11699
11748
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
11700
11749
|
return [
|
|
11701
11750
|
{
|
|
@@ -11740,14 +11789,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
11740
11789
|
};
|
|
11741
11790
|
|
|
11742
11791
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
11743
|
-
import { applyToPoint as
|
|
11792
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
11744
11793
|
function createSvgObjectsFromSchematicLine({
|
|
11745
11794
|
schLine,
|
|
11746
11795
|
transform,
|
|
11747
11796
|
colorMap: colorMap2
|
|
11748
11797
|
}) {
|
|
11749
|
-
const p1 =
|
|
11750
|
-
const p2 =
|
|
11798
|
+
const p1 = applyToPoint67(transform, { x: schLine.x1, y: schLine.y1 });
|
|
11799
|
+
const p2 = applyToPoint67(transform, { x: schLine.x2, y: schLine.y2 });
|
|
11751
11800
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
11752
11801
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
11753
11802
|
return [
|
|
@@ -11776,13 +11825,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
11776
11825
|
}
|
|
11777
11826
|
|
|
11778
11827
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
11779
|
-
import { applyToPoint as
|
|
11828
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
11780
11829
|
function createSvgObjectsFromSchematicCircle({
|
|
11781
11830
|
schCircle,
|
|
11782
11831
|
transform,
|
|
11783
11832
|
colorMap: colorMap2
|
|
11784
11833
|
}) {
|
|
11785
|
-
const center =
|
|
11834
|
+
const center = applyToPoint68(transform, schCircle.center);
|
|
11786
11835
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
11787
11836
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
11788
11837
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -11812,13 +11861,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
11812
11861
|
}
|
|
11813
11862
|
|
|
11814
11863
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
11815
|
-
import { applyToPoint as
|
|
11864
|
+
import { applyToPoint as applyToPoint69 } from "transformation-matrix";
|
|
11816
11865
|
function createSvgObjectsFromSchematicRect({
|
|
11817
11866
|
schRect,
|
|
11818
11867
|
transform,
|
|
11819
11868
|
colorMap: colorMap2
|
|
11820
11869
|
}) {
|
|
11821
|
-
const center =
|
|
11870
|
+
const center = applyToPoint69(transform, schRect.center);
|
|
11822
11871
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
11823
11872
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
11824
11873
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -11854,13 +11903,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
11854
11903
|
}
|
|
11855
11904
|
|
|
11856
11905
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
11857
|
-
import { applyToPoint as
|
|
11906
|
+
import { applyToPoint as applyToPoint70 } from "transformation-matrix";
|
|
11858
11907
|
function createSvgObjectsFromSchematicArc({
|
|
11859
11908
|
schArc,
|
|
11860
11909
|
transform,
|
|
11861
11910
|
colorMap: colorMap2
|
|
11862
11911
|
}) {
|
|
11863
|
-
const center =
|
|
11912
|
+
const center = applyToPoint70(transform, schArc.center);
|
|
11864
11913
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
11865
11914
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
11866
11915
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -12980,18 +13029,18 @@ function formatNumber2(value) {
|
|
|
12980
13029
|
import { distance as distance3 } from "circuit-json";
|
|
12981
13030
|
import { stringify as stringify7 } from "svgson";
|
|
12982
13031
|
import {
|
|
12983
|
-
applyToPoint as
|
|
13032
|
+
applyToPoint as applyToPoint73,
|
|
12984
13033
|
compose as compose15,
|
|
12985
13034
|
scale as scale9,
|
|
12986
13035
|
translate as translate15
|
|
12987
13036
|
} from "transformation-matrix";
|
|
12988
13037
|
|
|
12989
13038
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
12990
|
-
import { applyToPoint as
|
|
13039
|
+
import { applyToPoint as applyToPoint72 } from "transformation-matrix";
|
|
12991
13040
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
12992
13041
|
const { transform, layer: layerFilter } = ctx;
|
|
12993
13042
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
12994
|
-
const [x, y] =
|
|
13043
|
+
const [x, y] = applyToPoint72(transform, [solderPaste.x, solderPaste.y]);
|
|
12995
13044
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
12996
13045
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
12997
13046
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -13217,8 +13266,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
13217
13266
|
}
|
|
13218
13267
|
}
|
|
13219
13268
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
13220
|
-
const [x1, y1] =
|
|
13221
|
-
const [x2, y2] =
|
|
13269
|
+
const [x1, y1] = applyToPoint73(transform, [minX, minY]);
|
|
13270
|
+
const [x2, y2] = applyToPoint73(transform, [maxX, maxY]);
|
|
13222
13271
|
const width = Math.abs(x2 - x1);
|
|
13223
13272
|
const height = Math.abs(y2 - y1);
|
|
13224
13273
|
const x = Math.min(x1, x2);
|