circuit-to-svg 0.0.298 → 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 +277 -217
- 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 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
|
]);
|
|
@@ -4128,32 +4175,50 @@ function formatOffsetLabel(axis, offsetMm, displayOffset) {
|
|
|
4128
4175
|
return `${axis}: ${valueStr}${unitSuffix}`;
|
|
4129
4176
|
}
|
|
4130
4177
|
|
|
4178
|
+
// lib/utils/get-point-from-elm.ts
|
|
4179
|
+
function getPointFromElm(elm) {
|
|
4180
|
+
const candidate = elm?.anchor_position ?? elm?.center;
|
|
4181
|
+
if (candidate && typeof candidate.x === "number" && typeof candidate.y === "number") {
|
|
4182
|
+
return { x: candidate.x, y: candidate.y };
|
|
4183
|
+
}
|
|
4184
|
+
return void 0;
|
|
4185
|
+
}
|
|
4186
|
+
|
|
4131
4187
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-board.ts
|
|
4132
4188
|
function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
4133
4189
|
const { transform, colorMap: colorMap2, showSolderMask, circuitJson } = ctx;
|
|
4134
|
-
const {
|
|
4190
|
+
const {
|
|
4191
|
+
width,
|
|
4192
|
+
height,
|
|
4193
|
+
center,
|
|
4194
|
+
outline,
|
|
4195
|
+
position_mode,
|
|
4196
|
+
anchor_position: boardAnchorPosition,
|
|
4197
|
+
display_offset_x,
|
|
4198
|
+
display_offset_y
|
|
4199
|
+
} = pcbBoard;
|
|
4135
4200
|
let path;
|
|
4136
4201
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4137
4202
|
path = outline.map((point, index) => {
|
|
4138
|
-
const [x, y] =
|
|
4203
|
+
const [x, y] = applyToPoint24(transform, [point.x, point.y]);
|
|
4139
4204
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4140
4205
|
}).join(" ");
|
|
4141
4206
|
} else {
|
|
4142
4207
|
const halfWidth = width / 2;
|
|
4143
4208
|
const halfHeight = height / 2;
|
|
4144
|
-
const topLeft =
|
|
4209
|
+
const topLeft = applyToPoint24(transform, [
|
|
4145
4210
|
center.x - halfWidth,
|
|
4146
4211
|
center.y - halfHeight
|
|
4147
4212
|
]);
|
|
4148
|
-
const topRight =
|
|
4213
|
+
const topRight = applyToPoint24(transform, [
|
|
4149
4214
|
center.x + halfWidth,
|
|
4150
4215
|
center.y - halfHeight
|
|
4151
4216
|
]);
|
|
4152
|
-
const bottomRight =
|
|
4217
|
+
const bottomRight = applyToPoint24(transform, [
|
|
4153
4218
|
center.x + halfWidth,
|
|
4154
4219
|
center.y + halfHeight
|
|
4155
4220
|
]);
|
|
4156
|
-
const bottomLeft =
|
|
4221
|
+
const bottomLeft = applyToPoint24(transform, [
|
|
4157
4222
|
center.x - halfWidth,
|
|
4158
4223
|
center.y + halfHeight
|
|
4159
4224
|
]);
|
|
@@ -4195,28 +4260,32 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
4195
4260
|
"data-pcb-layer": "board"
|
|
4196
4261
|
}
|
|
4197
4262
|
});
|
|
4198
|
-
if (ctx.showAnchorOffsets && circuitJson) {
|
|
4263
|
+
if (ctx.showAnchorOffsets && circuitJson && position_mode === "relative_to_panel_anchor") {
|
|
4199
4264
|
const panel = circuitJson.find(
|
|
4200
4265
|
(elm) => elm.type === "pcb_panel"
|
|
4201
4266
|
);
|
|
4202
4267
|
if (panel) {
|
|
4203
|
-
const
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4268
|
+
const panelAnchorPosition = getPointFromElm(panel);
|
|
4269
|
+
if (panelAnchorPosition) {
|
|
4270
|
+
svgObjects.push(
|
|
4271
|
+
...createAnchorOffsetIndicators({
|
|
4272
|
+
groupAnchorPosition: panelAnchorPosition,
|
|
4273
|
+
componentPosition: boardAnchorPosition ?? center,
|
|
4274
|
+
transform,
|
|
4275
|
+
componentWidth: width,
|
|
4276
|
+
componentHeight: height,
|
|
4277
|
+
displayXOffset: display_offset_x,
|
|
4278
|
+
displayYOffset: display_offset_y
|
|
4279
|
+
})
|
|
4280
|
+
);
|
|
4281
|
+
}
|
|
4213
4282
|
}
|
|
4214
4283
|
}
|
|
4215
4284
|
return svgObjects;
|
|
4216
4285
|
}
|
|
4217
4286
|
|
|
4218
4287
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-panel.ts
|
|
4219
|
-
import { applyToPoint as
|
|
4288
|
+
import { applyToPoint as applyToPoint25 } from "transformation-matrix";
|
|
4220
4289
|
function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
4221
4290
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
4222
4291
|
const width = Number(pcbPanel.width);
|
|
@@ -4224,19 +4293,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
4224
4293
|
const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
|
|
4225
4294
|
const halfWidth = width / 2;
|
|
4226
4295
|
const halfHeight = height / 2;
|
|
4227
|
-
const topLeft =
|
|
4296
|
+
const topLeft = applyToPoint25(transform, [
|
|
4228
4297
|
center.x - halfWidth,
|
|
4229
4298
|
center.y - halfHeight
|
|
4230
4299
|
]);
|
|
4231
|
-
const topRight =
|
|
4300
|
+
const topRight = applyToPoint25(transform, [
|
|
4232
4301
|
center.x + halfWidth,
|
|
4233
4302
|
center.y - halfHeight
|
|
4234
4303
|
]);
|
|
4235
|
-
const bottomRight =
|
|
4304
|
+
const bottomRight = applyToPoint25(transform, [
|
|
4236
4305
|
center.x + halfWidth,
|
|
4237
4306
|
center.y + halfHeight
|
|
4238
4307
|
]);
|
|
4239
|
-
const bottomLeft =
|
|
4308
|
+
const bottomLeft = applyToPoint25(transform, [
|
|
4240
4309
|
center.x - halfWidth,
|
|
4241
4310
|
center.y + halfHeight
|
|
4242
4311
|
]);
|
|
@@ -4265,10 +4334,10 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
4265
4334
|
}
|
|
4266
4335
|
|
|
4267
4336
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-via.ts
|
|
4268
|
-
import { applyToPoint as
|
|
4337
|
+
import { applyToPoint as applyToPoint26 } from "transformation-matrix";
|
|
4269
4338
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
4270
4339
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
4271
|
-
const [x, y] =
|
|
4340
|
+
const [x, y] = applyToPoint26(transform, [hole.x, hole.y]);
|
|
4272
4341
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
4273
4342
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
4274
4343
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -4314,11 +4383,11 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
4314
4383
|
}
|
|
4315
4384
|
|
|
4316
4385
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-hole.ts
|
|
4317
|
-
import { applyToPoint as
|
|
4386
|
+
import { applyToPoint as applyToPoint27 } from "transformation-matrix";
|
|
4318
4387
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
4319
4388
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
4320
4389
|
const layer = ctx.layer ?? "top";
|
|
4321
|
-
const [x, y] =
|
|
4390
|
+
const [x, y] = applyToPoint27(transform, [hole.x, hole.y]);
|
|
4322
4391
|
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
4323
4392
|
const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
|
|
4324
4393
|
const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
|
|
@@ -4815,7 +4884,7 @@ import {
|
|
|
4815
4884
|
getFullConnectivityMapFromCircuitJson
|
|
4816
4885
|
} from "circuit-json-to-connectivity-map";
|
|
4817
4886
|
import "svgson";
|
|
4818
|
-
import { applyToPoint as
|
|
4887
|
+
import { applyToPoint as applyToPoint28 } from "transformation-matrix";
|
|
4819
4888
|
|
|
4820
4889
|
// lib/pcb/create-svg-objects-from-pcb-rats-nest/get-element-position.ts
|
|
4821
4890
|
import { su } from "@tscircuit/circuit-json-util";
|
|
@@ -4895,11 +4964,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
4895
4964
|
});
|
|
4896
4965
|
const svgObjects = [];
|
|
4897
4966
|
for (const line of ratsNestLines) {
|
|
4898
|
-
const transformedStart =
|
|
4967
|
+
const transformedStart = applyToPoint28(transform, [
|
|
4899
4968
|
line.startPoint.x,
|
|
4900
4969
|
line.startPoint.y
|
|
4901
4970
|
]);
|
|
4902
|
-
const transformedEnd =
|
|
4971
|
+
const transformedEnd = applyToPoint28(transform, [
|
|
4903
4972
|
line.endPoint.x,
|
|
4904
4973
|
line.endPoint.y
|
|
4905
4974
|
]);
|
|
@@ -4927,7 +4996,7 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
4927
4996
|
|
|
4928
4997
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-cutout.ts
|
|
4929
4998
|
import {
|
|
4930
|
-
applyToPoint as
|
|
4999
|
+
applyToPoint as applyToPoint29,
|
|
4931
5000
|
compose as compose4,
|
|
4932
5001
|
rotate as rotate4,
|
|
4933
5002
|
translate as translate4,
|
|
@@ -4937,7 +5006,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
4937
5006
|
const { transform, colorMap: colorMap2 } = ctx;
|
|
4938
5007
|
if (cutout.shape === "rect") {
|
|
4939
5008
|
const rectCutout = cutout;
|
|
4940
|
-
const [cx, cy] =
|
|
5009
|
+
const [cx, cy] = applyToPoint29(transform, [
|
|
4941
5010
|
rectCutout.center.x,
|
|
4942
5011
|
rectCutout.center.y
|
|
4943
5012
|
]);
|
|
@@ -4979,7 +5048,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
4979
5048
|
}
|
|
4980
5049
|
if (cutout.shape === "circle") {
|
|
4981
5050
|
const circleCutout = cutout;
|
|
4982
|
-
const [cx, cy] =
|
|
5051
|
+
const [cx, cy] = applyToPoint29(transform, [
|
|
4983
5052
|
circleCutout.center.x,
|
|
4984
5053
|
circleCutout.center.y
|
|
4985
5054
|
]);
|
|
@@ -5006,7 +5075,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5006
5075
|
const polygonCutout = cutout;
|
|
5007
5076
|
if (!polygonCutout.points || polygonCutout.points.length === 0) return [];
|
|
5008
5077
|
const transformedPoints = polygonCutout.points.map(
|
|
5009
|
-
(p) =>
|
|
5078
|
+
(p) => applyToPoint29(transform, [p.x, p.y])
|
|
5010
5079
|
);
|
|
5011
5080
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5012
5081
|
return [
|
|
@@ -5030,7 +5099,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
5030
5099
|
|
|
5031
5100
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-copper-pour.ts
|
|
5032
5101
|
import {
|
|
5033
|
-
applyToPoint as
|
|
5102
|
+
applyToPoint as applyToPoint31,
|
|
5034
5103
|
compose as compose5,
|
|
5035
5104
|
rotate as rotate5,
|
|
5036
5105
|
toString as matrixToString8,
|
|
@@ -5038,11 +5107,11 @@ import {
|
|
|
5038
5107
|
} from "transformation-matrix";
|
|
5039
5108
|
|
|
5040
5109
|
// lib/utils/ring-to-path-d.ts
|
|
5041
|
-
import { applyToPoint as
|
|
5110
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
5042
5111
|
function ringToPathD(vertices, transform) {
|
|
5043
5112
|
if (vertices.length === 0) return "";
|
|
5044
5113
|
const transformedVertices = vertices.map((v) => {
|
|
5045
|
-
const [x, y] =
|
|
5114
|
+
const [x, y] = applyToPoint30(transform, [v.x, v.y]);
|
|
5046
5115
|
return { ...v, x, y };
|
|
5047
5116
|
});
|
|
5048
5117
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -5131,7 +5200,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5131
5200
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
5132
5201
|
const maskOverlayOpacity = "0.9";
|
|
5133
5202
|
if (pour.shape === "rect") {
|
|
5134
|
-
const [cx, cy] =
|
|
5203
|
+
const [cx, cy] = applyToPoint31(transform, [pour.center.x, pour.center.y]);
|
|
5135
5204
|
const scaledWidth = pour.width * Math.abs(transform.a);
|
|
5136
5205
|
const scaledHeight = pour.height * Math.abs(transform.d);
|
|
5137
5206
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -5183,7 +5252,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
5183
5252
|
if (pour.shape === "polygon") {
|
|
5184
5253
|
if (!pour.points || pour.points.length === 0) return [];
|
|
5185
5254
|
const transformedPoints = pour.points.map(
|
|
5186
|
-
(p) =>
|
|
5255
|
+
(p) => applyToPoint31(transform, [p.x, p.y])
|
|
5187
5256
|
);
|
|
5188
5257
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
5189
5258
|
const copperPolygon = {
|
|
@@ -5406,32 +5475,21 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
5406
5475
|
}
|
|
5407
5476
|
|
|
5408
5477
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
5409
|
-
import { applyToPoint as
|
|
5410
|
-
|
|
5411
|
-
// lib/utils/get-point-from-elm.ts
|
|
5412
|
-
function getPointFromElm(elm) {
|
|
5413
|
-
const candidate = elm?.anchor_position ?? elm?.center;
|
|
5414
|
-
if (candidate && typeof candidate.x === "number" && typeof candidate.y === "number") {
|
|
5415
|
-
return { x: candidate.x, y: candidate.y };
|
|
5416
|
-
}
|
|
5417
|
-
return void 0;
|
|
5418
|
-
}
|
|
5419
|
-
|
|
5420
|
-
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
5478
|
+
import { applyToPoint as applyToPoint32 } from "transformation-matrix";
|
|
5421
5479
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
5422
5480
|
const { transform, circuitJson } = ctx;
|
|
5423
5481
|
const { center, width, height, rotation = 0 } = component;
|
|
5424
|
-
const [x, y] =
|
|
5482
|
+
const [x, y] = applyToPoint32(transform, [center.x, center.y]);
|
|
5425
5483
|
const scaledWidth = width * Math.abs(transform.a);
|
|
5426
5484
|
const scaledHeight = height * Math.abs(transform.d);
|
|
5427
5485
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
5428
5486
|
const svgObjects = [];
|
|
5429
5487
|
if (ctx.showAnchorOffsets && circuitJson && component.position_mode === "relative_to_group_anchor" && (component.positioned_relative_to_pcb_group_id || component.positioned_relative_to_pcb_board_id)) {
|
|
5430
|
-
const
|
|
5431
|
-
if (
|
|
5488
|
+
const parentAnchorPosition = getParentAnchorPosition(component, circuitJson);
|
|
5489
|
+
if (parentAnchorPosition) {
|
|
5432
5490
|
svgObjects.push(
|
|
5433
5491
|
...createAnchorOffsetIndicators({
|
|
5434
|
-
groupAnchorPosition:
|
|
5492
|
+
groupAnchorPosition: parentAnchorPosition,
|
|
5435
5493
|
componentPosition: center,
|
|
5436
5494
|
transform,
|
|
5437
5495
|
componentWidth: width,
|
|
@@ -5474,7 +5532,7 @@ function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
|
5474
5532
|
});
|
|
5475
5533
|
return svgObjects;
|
|
5476
5534
|
}
|
|
5477
|
-
function
|
|
5535
|
+
function getParentAnchorPosition(component, circuitJson) {
|
|
5478
5536
|
if (component.positioned_relative_to_pcb_group_id) {
|
|
5479
5537
|
const pcbGroup = circuitJson.find(
|
|
5480
5538
|
(elm) => elm.type === "pcb_group" && elm.pcb_group_id === component.positioned_relative_to_pcb_group_id
|
|
@@ -5493,7 +5551,7 @@ function getAnchorPosition(component, circuitJson) {
|
|
|
5493
5551
|
}
|
|
5494
5552
|
|
|
5495
5553
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
5496
|
-
import { applyToPoint as
|
|
5554
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
5497
5555
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
5498
5556
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
5499
5557
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -5501,11 +5559,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5501
5559
|
const { center, width, height } = pcbGroup;
|
|
5502
5560
|
const svgObjects = [];
|
|
5503
5561
|
if (ctx.showAnchorOffsets && pcbGroup.position_mode === "relative_to_group_anchor" && circuitJson) {
|
|
5504
|
-
const
|
|
5505
|
-
if (
|
|
5562
|
+
const parentAnchorPosition = getParentAnchorPosition2(pcbGroup, circuitJson);
|
|
5563
|
+
if (parentAnchorPosition) {
|
|
5506
5564
|
svgObjects.push(
|
|
5507
5565
|
...createAnchorOffsetIndicators({
|
|
5508
|
-
groupAnchorPosition:
|
|
5566
|
+
groupAnchorPosition: parentAnchorPosition,
|
|
5509
5567
|
componentPosition: pcbGroup.anchor_position ?? pcbGroup.center,
|
|
5510
5568
|
transform,
|
|
5511
5569
|
componentWidth: pcbGroup.width,
|
|
@@ -5537,7 +5595,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5537
5595
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
5538
5596
|
)) {
|
|
5539
5597
|
const path = outline.map((point, index) => {
|
|
5540
|
-
const [x, y] =
|
|
5598
|
+
const [x, y] = applyToPoint33(transform, [point.x, point.y]);
|
|
5541
5599
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5542
5600
|
}).join(" ");
|
|
5543
5601
|
svgObjects.push({
|
|
@@ -5558,11 +5616,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5558
5616
|
}
|
|
5559
5617
|
const halfWidth = width / 2;
|
|
5560
5618
|
const halfHeight = height / 2;
|
|
5561
|
-
const [topLeftX, topLeftY] =
|
|
5619
|
+
const [topLeftX, topLeftY] = applyToPoint33(transform, [
|
|
5562
5620
|
center.x - halfWidth,
|
|
5563
5621
|
center.y + halfHeight
|
|
5564
5622
|
]);
|
|
5565
|
-
const [bottomRightX, bottomRightY] =
|
|
5623
|
+
const [bottomRightX, bottomRightY] = applyToPoint33(transform, [
|
|
5566
5624
|
center.x + halfWidth,
|
|
5567
5625
|
center.y - halfHeight
|
|
5568
5626
|
]);
|
|
@@ -5586,7 +5644,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
5586
5644
|
svgObjects.push(svgObject);
|
|
5587
5645
|
return svgObjects;
|
|
5588
5646
|
}
|
|
5589
|
-
function
|
|
5647
|
+
function getParentAnchorPosition2(group, circuitJson) {
|
|
5590
5648
|
if (group.positioned_relative_to_pcb_group_id) {
|
|
5591
5649
|
const pcbGroup = circuitJson.find(
|
|
5592
5650
|
(elm) => elm.type === "pcb_group" && elm.pcb_group_id === group.positioned_relative_to_pcb_group_id
|
|
@@ -5616,7 +5674,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5616
5674
|
var package_default = {
|
|
5617
5675
|
name: "circuit-to-svg",
|
|
5618
5676
|
type: "module",
|
|
5619
|
-
version: "0.0.
|
|
5677
|
+
version: "0.0.299",
|
|
5620
5678
|
description: "Convert Circuit JSON to SVG",
|
|
5621
5679
|
main: "dist/index.js",
|
|
5622
5680
|
files: [
|
|
@@ -5639,7 +5697,7 @@ var package_default = {
|
|
|
5639
5697
|
"@vitejs/plugin-react": "5.0.0",
|
|
5640
5698
|
biome: "^0.3.3",
|
|
5641
5699
|
"bun-match-svg": "^0.0.12",
|
|
5642
|
-
"circuit-json": "^0.0.
|
|
5700
|
+
"circuit-json": "^0.0.342",
|
|
5643
5701
|
esbuild: "^0.20.2",
|
|
5644
5702
|
"performance-now": "^2.1.0",
|
|
5645
5703
|
react: "19.1.0",
|
|
@@ -6221,6 +6279,8 @@ function createSvgObjects({
|
|
|
6221
6279
|
return createSvgObjectsFromPcbSilkscreenCircle(elm, ctx);
|
|
6222
6280
|
case "pcb_silkscreen_line":
|
|
6223
6281
|
return createSvgObjectsFromPcbSilkscreenLine(elm, ctx);
|
|
6282
|
+
case "pcb_silkscreen_pill":
|
|
6283
|
+
return createSvgObjectsFromPcbSilkscreenPill(elm, ctx);
|
|
6224
6284
|
case "pcb_copper_text":
|
|
6225
6285
|
return createSvgObjectsFromPcbCopperText(elm, ctx);
|
|
6226
6286
|
case "pcb_courtyard_rect":
|
|
@@ -6261,8 +6321,8 @@ function createSvgObjects({
|
|
|
6261
6321
|
}
|
|
6262
6322
|
}
|
|
6263
6323
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
6264
|
-
const [x1, y1] =
|
|
6265
|
-
const [x2, y2] =
|
|
6324
|
+
const [x1, y1] = applyToPoint34(transform, [minX, minY]);
|
|
6325
|
+
const [x2, y2] = applyToPoint34(transform, [maxX, maxY]);
|
|
6266
6326
|
const width = Math.abs(x2 - x1);
|
|
6267
6327
|
const height = Math.abs(y2 - y1);
|
|
6268
6328
|
const x = Math.min(x1, x2);
|
|
@@ -6292,14 +6352,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
6292
6352
|
import { stringify as stringify2 } from "svgson";
|
|
6293
6353
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
6294
6354
|
import {
|
|
6295
|
-
applyToPoint as
|
|
6355
|
+
applyToPoint as applyToPoint41,
|
|
6296
6356
|
compose as compose7,
|
|
6297
6357
|
scale as scale4,
|
|
6298
6358
|
translate as translate7
|
|
6299
6359
|
} from "transformation-matrix";
|
|
6300
6360
|
|
|
6301
6361
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
6302
|
-
import { applyToPoint as
|
|
6362
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
6303
6363
|
var DEFAULT_BOARD_STYLE = {
|
|
6304
6364
|
fill: "none",
|
|
6305
6365
|
stroke: "rgb(0,0,0)",
|
|
@@ -6311,25 +6371,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6311
6371
|
let path;
|
|
6312
6372
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
6313
6373
|
path = outline.map((point, index) => {
|
|
6314
|
-
const [x, y] =
|
|
6374
|
+
const [x, y] = applyToPoint35(transform, [point.x, point.y]);
|
|
6315
6375
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
6316
6376
|
}).join(" ");
|
|
6317
6377
|
} else {
|
|
6318
6378
|
const halfWidth = width / 2;
|
|
6319
6379
|
const halfHeight = height / 2;
|
|
6320
|
-
const topLeft =
|
|
6380
|
+
const topLeft = applyToPoint35(transform, [
|
|
6321
6381
|
center.x - halfWidth,
|
|
6322
6382
|
center.y - halfHeight
|
|
6323
6383
|
]);
|
|
6324
|
-
const topRight =
|
|
6384
|
+
const topRight = applyToPoint35(transform, [
|
|
6325
6385
|
center.x + halfWidth,
|
|
6326
6386
|
center.y - halfHeight
|
|
6327
6387
|
]);
|
|
6328
|
-
const bottomRight =
|
|
6388
|
+
const bottomRight = applyToPoint35(transform, [
|
|
6329
6389
|
center.x + halfWidth,
|
|
6330
6390
|
center.y + halfHeight
|
|
6331
6391
|
]);
|
|
6332
|
-
const bottomLeft =
|
|
6392
|
+
const bottomLeft = applyToPoint35(transform, [
|
|
6333
6393
|
center.x - halfWidth,
|
|
6334
6394
|
center.y + halfHeight
|
|
6335
6395
|
]);
|
|
@@ -6355,7 +6415,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
6355
6415
|
}
|
|
6356
6416
|
|
|
6357
6417
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
6358
|
-
import { applyToPoint as
|
|
6418
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
6359
6419
|
|
|
6360
6420
|
// lib/utils/get-sch-font-size.ts
|
|
6361
6421
|
import "transformation-matrix";
|
|
@@ -6381,8 +6441,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
6381
6441
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
6382
6442
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
6383
6443
|
return null;
|
|
6384
|
-
const [x, y] =
|
|
6385
|
-
const [pinX, pinY] =
|
|
6444
|
+
const [x, y] = applyToPoint37(transform, [center.x, center.y]);
|
|
6445
|
+
const [pinX, pinY] = applyToPoint37(transform, [portPosition.x, portPosition.y]);
|
|
6386
6446
|
const scaledWidth = width * Math.abs(transform.a);
|
|
6387
6447
|
const scaledHeight = height * Math.abs(transform.d);
|
|
6388
6448
|
const isTopLayer = layer === "top";
|
|
@@ -6544,11 +6604,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
6544
6604
|
}
|
|
6545
6605
|
|
|
6546
6606
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
6547
|
-
import { applyToPoint as
|
|
6607
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
6548
6608
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
6549
6609
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
6550
6610
|
const { transform } = ctx;
|
|
6551
|
-
const [x, y] =
|
|
6611
|
+
const [x, y] = applyToPoint38(transform, [hole.x, hole.y]);
|
|
6552
6612
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
6553
6613
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
6554
6614
|
const radius = scaledDiameter / 2;
|
|
@@ -6612,12 +6672,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
6612
6672
|
}
|
|
6613
6673
|
|
|
6614
6674
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
6615
|
-
import { applyToPoint as
|
|
6675
|
+
import { applyToPoint as applyToPoint39 } from "transformation-matrix";
|
|
6616
6676
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
6617
6677
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
6618
6678
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
6619
6679
|
const { transform } = ctx;
|
|
6620
|
-
const [x, y] =
|
|
6680
|
+
const [x, y] = applyToPoint39(transform, [hole.x, hole.y]);
|
|
6621
6681
|
if (hole.shape === "pill") {
|
|
6622
6682
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
6623
6683
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -6712,7 +6772,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6712
6772
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
6713
6773
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
6714
6774
|
const holeRadius = scaledHoleDiameter / 2;
|
|
6715
|
-
const [holeCx, holeCy] =
|
|
6775
|
+
const [holeCx, holeCy] = applyToPoint39(transform, [
|
|
6716
6776
|
circularHole.x + circularHole.hole_offset_x,
|
|
6717
6777
|
circularHole.y + circularHole.hole_offset_y
|
|
6718
6778
|
]);
|
|
@@ -6770,7 +6830,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6770
6830
|
const pillHoleWithOffsets = pillHole;
|
|
6771
6831
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
6772
6832
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
6773
|
-
const [holeCenterX, holeCenterY] =
|
|
6833
|
+
const [holeCenterX, holeCenterY] = applyToPoint39(transform, [
|
|
6774
6834
|
pillHole.x + holeOffsetX,
|
|
6775
6835
|
pillHole.y + holeOffsetY
|
|
6776
6836
|
]);
|
|
@@ -6832,7 +6892,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6832
6892
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
6833
6893
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
6834
6894
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
6835
|
-
const [holeCenterX, holeCenterY] =
|
|
6895
|
+
const [holeCenterX, holeCenterY] = applyToPoint39(transform, [
|
|
6836
6896
|
rotatedHole.x + holeOffsetX,
|
|
6837
6897
|
rotatedHole.y + holeOffsetY
|
|
6838
6898
|
]);
|
|
@@ -6888,14 +6948,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
6888
6948
|
}
|
|
6889
6949
|
|
|
6890
6950
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
6891
|
-
import { applyToPoint as
|
|
6951
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
6892
6952
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
6893
6953
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
6894
6954
|
const { transform } = ctx;
|
|
6895
6955
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
6896
6956
|
const width = pad.width * Math.abs(transform.a);
|
|
6897
6957
|
const height = pad.height * Math.abs(transform.d);
|
|
6898
|
-
const [x, y] =
|
|
6958
|
+
const [x, y] = applyToPoint40(transform, [pad.x, pad.y]);
|
|
6899
6959
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
6900
6960
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
6901
6961
|
return [
|
|
@@ -6947,7 +7007,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
6947
7007
|
const width = pad.width * Math.abs(transform.a);
|
|
6948
7008
|
const height = pad.height * Math.abs(transform.d);
|
|
6949
7009
|
const radius = pad.radius * Math.abs(transform.a);
|
|
6950
|
-
const [x, y] =
|
|
7010
|
+
const [x, y] = applyToPoint40(transform, [pad.x, pad.y]);
|
|
6951
7011
|
return [
|
|
6952
7012
|
{
|
|
6953
7013
|
name: "rect",
|
|
@@ -6970,7 +7030,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
6970
7030
|
}
|
|
6971
7031
|
if (pad.shape === "circle") {
|
|
6972
7032
|
const radius = pad.radius * Math.abs(transform.a);
|
|
6973
|
-
const [x, y] =
|
|
7033
|
+
const [x, y] = applyToPoint40(transform, [pad.x, pad.y]);
|
|
6974
7034
|
return [
|
|
6975
7035
|
{
|
|
6976
7036
|
name: "circle",
|
|
@@ -6990,7 +7050,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
6990
7050
|
}
|
|
6991
7051
|
if (pad.shape === "polygon") {
|
|
6992
7052
|
const points = (pad.points ?? []).map(
|
|
6993
|
-
(point) =>
|
|
7053
|
+
(point) => applyToPoint40(transform, [point.x, point.y])
|
|
6994
7054
|
);
|
|
6995
7055
|
return [
|
|
6996
7056
|
{
|
|
@@ -7174,8 +7234,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
7174
7234
|
}
|
|
7175
7235
|
}
|
|
7176
7236
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
7177
|
-
const [x1, y1] =
|
|
7178
|
-
const [x2, y2] =
|
|
7237
|
+
const [x1, y1] = applyToPoint41(transform, [minX, minY]);
|
|
7238
|
+
const [x2, y2] = applyToPoint41(transform, [maxX, maxY]);
|
|
7179
7239
|
const width = Math.abs(x2 - x1);
|
|
7180
7240
|
const height = Math.abs(y2 - y1);
|
|
7181
7241
|
const x = Math.min(x1, x2);
|
|
@@ -7204,7 +7264,7 @@ import {
|
|
|
7204
7264
|
} from "transformation-matrix";
|
|
7205
7265
|
|
|
7206
7266
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
7207
|
-
import { applyToPoint as
|
|
7267
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
7208
7268
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
7209
7269
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
7210
7270
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -7218,25 +7278,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7218
7278
|
let path;
|
|
7219
7279
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
7220
7280
|
path = outline.map((point, index) => {
|
|
7221
|
-
const [x, y] =
|
|
7281
|
+
const [x, y] = applyToPoint42(transform, [point.x, point.y]);
|
|
7222
7282
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
7223
7283
|
}).join(" ");
|
|
7224
7284
|
} else {
|
|
7225
7285
|
const halfWidth = width / 2;
|
|
7226
7286
|
const halfHeight = height / 2;
|
|
7227
|
-
const topLeft =
|
|
7287
|
+
const topLeft = applyToPoint42(transform, [
|
|
7228
7288
|
center.x - halfWidth,
|
|
7229
7289
|
center.y - halfHeight
|
|
7230
7290
|
]);
|
|
7231
|
-
const topRight =
|
|
7291
|
+
const topRight = applyToPoint42(transform, [
|
|
7232
7292
|
center.x + halfWidth,
|
|
7233
7293
|
center.y - halfHeight
|
|
7234
7294
|
]);
|
|
7235
|
-
const bottomRight =
|
|
7295
|
+
const bottomRight = applyToPoint42(transform, [
|
|
7236
7296
|
center.x + halfWidth,
|
|
7237
7297
|
center.y + halfHeight
|
|
7238
7298
|
]);
|
|
7239
|
-
const bottomLeft =
|
|
7299
|
+
const bottomLeft = applyToPoint42(transform, [
|
|
7240
7300
|
center.x - halfWidth,
|
|
7241
7301
|
center.y + halfHeight
|
|
7242
7302
|
]);
|
|
@@ -7254,10 +7314,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7254
7314
|
const halfWidth = width2 / 2;
|
|
7255
7315
|
const halfHeight = height2 / 2;
|
|
7256
7316
|
const [tl, tr, br, bl] = [
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
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])
|
|
7261
7321
|
];
|
|
7262
7322
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
7263
7323
|
} else if (cutout.shape === "circle") {
|
|
@@ -7307,7 +7367,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
7307
7367
|
|
|
7308
7368
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
7309
7369
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
7310
|
-
import { applyToPoint as
|
|
7370
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
7311
7371
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
7312
7372
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
7313
7373
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -7317,7 +7377,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7317
7377
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
7318
7378
|
return [];
|
|
7319
7379
|
}
|
|
7320
|
-
const [x, y] =
|
|
7380
|
+
const [x, y] = applyToPoint43(transform, [center.x, center.y]);
|
|
7321
7381
|
const scaledWidth = width * Math.abs(transform.a);
|
|
7322
7382
|
const scaledHeight = height * Math.abs(transform.d);
|
|
7323
7383
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -7378,11 +7438,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
7378
7438
|
}
|
|
7379
7439
|
|
|
7380
7440
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
7381
|
-
import { applyToPoint as
|
|
7441
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
7382
7442
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
7383
7443
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
7384
7444
|
const { transform } = ctx;
|
|
7385
|
-
const [x, y] =
|
|
7445
|
+
const [x, y] = applyToPoint44(transform, [hole.x, hole.y]);
|
|
7386
7446
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
7387
7447
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
7388
7448
|
const radius = scaledDiameter / 2;
|
|
@@ -7446,12 +7506,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
7446
7506
|
}
|
|
7447
7507
|
|
|
7448
7508
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
7449
|
-
import { applyToPoint as
|
|
7509
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
7450
7510
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
7451
7511
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
7452
7512
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
7453
7513
|
const { transform } = ctx;
|
|
7454
|
-
const [x, y] =
|
|
7514
|
+
const [x, y] = applyToPoint45(transform, [hole.x, hole.y]);
|
|
7455
7515
|
if (hole.shape === "pill") {
|
|
7456
7516
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
7457
7517
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -7686,14 +7746,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
7686
7746
|
}
|
|
7687
7747
|
|
|
7688
7748
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
7689
|
-
import { applyToPoint as
|
|
7749
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
7690
7750
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
7691
7751
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
7692
7752
|
const { transform } = ctx;
|
|
7693
7753
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
7694
7754
|
const width = pad.width * Math.abs(transform.a);
|
|
7695
7755
|
const height = pad.height * Math.abs(transform.d);
|
|
7696
|
-
const [x, y] =
|
|
7756
|
+
const [x, y] = applyToPoint46(transform, [pad.x, pad.y]);
|
|
7697
7757
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
7698
7758
|
return [
|
|
7699
7759
|
{
|
|
@@ -7736,7 +7796,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7736
7796
|
const width = pad.width * Math.abs(transform.a);
|
|
7737
7797
|
const height = pad.height * Math.abs(transform.d);
|
|
7738
7798
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7739
|
-
const [x, y] =
|
|
7799
|
+
const [x, y] = applyToPoint46(transform, [pad.x, pad.y]);
|
|
7740
7800
|
return [
|
|
7741
7801
|
{
|
|
7742
7802
|
name: "rect",
|
|
@@ -7759,7 +7819,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7759
7819
|
}
|
|
7760
7820
|
if (pad.shape === "circle") {
|
|
7761
7821
|
const radius = pad.radius * Math.abs(transform.a);
|
|
7762
|
-
const [x, y] =
|
|
7822
|
+
const [x, y] = applyToPoint46(transform, [pad.x, pad.y]);
|
|
7763
7823
|
return [
|
|
7764
7824
|
{
|
|
7765
7825
|
name: "circle",
|
|
@@ -7779,7 +7839,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7779
7839
|
}
|
|
7780
7840
|
if (pad.shape === "polygon") {
|
|
7781
7841
|
const points = (pad.points ?? []).map(
|
|
7782
|
-
(point) =>
|
|
7842
|
+
(point) => applyToPoint46(transform, [point.x, point.y])
|
|
7783
7843
|
);
|
|
7784
7844
|
return [
|
|
7785
7845
|
{
|
|
@@ -7800,7 +7860,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
7800
7860
|
}
|
|
7801
7861
|
|
|
7802
7862
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
7803
|
-
import { applyToPoint as
|
|
7863
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
7804
7864
|
import { calculateElbow } from "calculate-elbow";
|
|
7805
7865
|
|
|
7806
7866
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -7877,7 +7937,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
7877
7937
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
7878
7938
|
if (!label_info) return [];
|
|
7879
7939
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
7880
|
-
const [port_x, port_y] =
|
|
7940
|
+
const [port_x, port_y] = applyToPoint47(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
7881
7941
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
7882
7942
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
7883
7943
|
const elbow_path = calculateElbow(
|
|
@@ -8018,7 +8078,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
8018
8078
|
}
|
|
8019
8079
|
|
|
8020
8080
|
// lib/pinout/calculate-label-positions.ts
|
|
8021
|
-
import { applyToPoint as
|
|
8081
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
8022
8082
|
|
|
8023
8083
|
// lib/pinout/constants.ts
|
|
8024
8084
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -8056,7 +8116,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8056
8116
|
);
|
|
8057
8117
|
const mapToEdgePort = (pinout_label) => ({
|
|
8058
8118
|
pcb_port: pinout_label.pcb_port,
|
|
8059
|
-
y:
|
|
8119
|
+
y: applyToPoint48(transform, [
|
|
8060
8120
|
pinout_label.pcb_port.x,
|
|
8061
8121
|
pinout_label.pcb_port.y
|
|
8062
8122
|
])[1],
|
|
@@ -8071,7 +8131,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8071
8131
|
} else {
|
|
8072
8132
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
8073
8133
|
pcb_port: pinout_label.pcb_port,
|
|
8074
|
-
y:
|
|
8134
|
+
y: applyToPoint48(transform, [
|
|
8075
8135
|
pinout_label.pcb_port.x,
|
|
8076
8136
|
pinout_label.pcb_port.y
|
|
8077
8137
|
])[1],
|
|
@@ -8079,7 +8139,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
8079
8139
|
})).sort((a, b) => a.y - b.y);
|
|
8080
8140
|
}
|
|
8081
8141
|
if (edge_ports.length === 0) return;
|
|
8082
|
-
const board_edge_x =
|
|
8142
|
+
const board_edge_x = applyToPoint48(transform, [
|
|
8083
8143
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
8084
8144
|
0
|
|
8085
8145
|
])[0];
|
|
@@ -8501,14 +8561,14 @@ import {
|
|
|
8501
8561
|
} from "transformation-matrix";
|
|
8502
8562
|
|
|
8503
8563
|
// lib/sch/draw-schematic-grid.ts
|
|
8504
|
-
import { applyToPoint as
|
|
8564
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
8505
8565
|
function drawSchematicGrid(params) {
|
|
8506
8566
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
8507
8567
|
const cellSize = params.cellSize ?? 1;
|
|
8508
8568
|
const labelCells = params.labelCells ?? false;
|
|
8509
8569
|
const gridLines = [];
|
|
8510
8570
|
const transformPoint = (x, y) => {
|
|
8511
|
-
const [transformedX, transformedY] =
|
|
8571
|
+
const [transformedX, transformedY] = applyToPoint49(params.transform, [x, y]);
|
|
8512
8572
|
return { x: transformedX, y: transformedY };
|
|
8513
8573
|
};
|
|
8514
8574
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -8589,15 +8649,15 @@ function drawSchematicGrid(params) {
|
|
|
8589
8649
|
}
|
|
8590
8650
|
|
|
8591
8651
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
8592
|
-
import { applyToPoint as
|
|
8652
|
+
import { applyToPoint as applyToPoint50 } from "transformation-matrix";
|
|
8593
8653
|
function drawSchematicLabeledPoints(params) {
|
|
8594
8654
|
const { points, transform } = params;
|
|
8595
8655
|
const labeledPointsGroup = [];
|
|
8596
8656
|
for (const point of points) {
|
|
8597
|
-
const [x1, y1] =
|
|
8598
|
-
const [x2, y2] =
|
|
8599
|
-
const [x3, y3] =
|
|
8600
|
-
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]);
|
|
8601
8661
|
labeledPointsGroup.push({
|
|
8602
8662
|
name: "path",
|
|
8603
8663
|
type: "element",
|
|
@@ -8608,7 +8668,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
8608
8668
|
"stroke-opacity": "0.7"
|
|
8609
8669
|
}
|
|
8610
8670
|
});
|
|
8611
|
-
const [labelX, labelY] =
|
|
8671
|
+
const [labelX, labelY] = applyToPoint50(transform, [
|
|
8612
8672
|
point.x + 0.15,
|
|
8613
8673
|
point.y - 0.15
|
|
8614
8674
|
]);
|
|
@@ -9726,7 +9786,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
9726
9786
|
import { symbols } from "schematic-symbols";
|
|
9727
9787
|
import "svgson";
|
|
9728
9788
|
import {
|
|
9729
|
-
applyToPoint as
|
|
9789
|
+
applyToPoint as applyToPoint52,
|
|
9730
9790
|
compose as compose10
|
|
9731
9791
|
} from "transformation-matrix";
|
|
9732
9792
|
|
|
@@ -9810,13 +9870,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
9810
9870
|
}
|
|
9811
9871
|
|
|
9812
9872
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
9813
|
-
import { applyToPoint as
|
|
9873
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
9814
9874
|
var createSvgSchErrorText = ({
|
|
9815
9875
|
text,
|
|
9816
9876
|
realCenter,
|
|
9817
9877
|
realToScreenTransform
|
|
9818
9878
|
}) => {
|
|
9819
|
-
const screenCenter =
|
|
9879
|
+
const screenCenter = applyToPoint51(realToScreenTransform, realCenter);
|
|
9820
9880
|
return {
|
|
9821
9881
|
type: "element",
|
|
9822
9882
|
name: "text",
|
|
@@ -9925,11 +9985,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
9925
9985
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
9926
9986
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
9927
9987
|
};
|
|
9928
|
-
const [screenMinX, screenMinY] =
|
|
9988
|
+
const [screenMinX, screenMinY] = applyToPoint52(
|
|
9929
9989
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
9930
9990
|
[bounds.minX, bounds.minY]
|
|
9931
9991
|
);
|
|
9932
|
-
const [screenMaxX, screenMaxY] =
|
|
9992
|
+
const [screenMaxX, screenMaxY] = applyToPoint52(
|
|
9933
9993
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
9934
9994
|
[bounds.maxX, bounds.maxY]
|
|
9935
9995
|
);
|
|
@@ -9958,7 +10018,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
9958
10018
|
name: "path",
|
|
9959
10019
|
attributes: {
|
|
9960
10020
|
d: points.map((p, i) => {
|
|
9961
|
-
const [x, y] =
|
|
10021
|
+
const [x, y] = applyToPoint52(
|
|
9962
10022
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
9963
10023
|
[p.x, p.y]
|
|
9964
10024
|
);
|
|
@@ -9974,7 +10034,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
9974
10034
|
});
|
|
9975
10035
|
}
|
|
9976
10036
|
for (const text of texts) {
|
|
9977
|
-
const screenTextPos =
|
|
10037
|
+
const screenTextPos = applyToPoint52(
|
|
9978
10038
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
9979
10039
|
text
|
|
9980
10040
|
);
|
|
@@ -10026,7 +10086,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10026
10086
|
});
|
|
10027
10087
|
}
|
|
10028
10088
|
for (const box of boxes) {
|
|
10029
|
-
const screenBoxPos =
|
|
10089
|
+
const screenBoxPos = applyToPoint52(
|
|
10030
10090
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
10031
10091
|
box
|
|
10032
10092
|
);
|
|
@@ -10050,7 +10110,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10050
10110
|
}
|
|
10051
10111
|
for (const port of symbol.ports) {
|
|
10052
10112
|
if (connectedSymbolPorts.has(port)) continue;
|
|
10053
|
-
const screenPortPos =
|
|
10113
|
+
const screenPortPos = applyToPoint52(
|
|
10054
10114
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
10055
10115
|
port
|
|
10056
10116
|
);
|
|
@@ -10070,7 +10130,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10070
10130
|
});
|
|
10071
10131
|
}
|
|
10072
10132
|
for (const circle of circles) {
|
|
10073
|
-
const screenCirclePos =
|
|
10133
|
+
const screenCirclePos = applyToPoint52(
|
|
10074
10134
|
compose10(realToScreenTransform, transformFromSymbolToReal),
|
|
10075
10135
|
circle
|
|
10076
10136
|
);
|
|
@@ -10097,14 +10157,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
10097
10157
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
10098
10158
|
import "schematic-symbols";
|
|
10099
10159
|
import "svgson";
|
|
10100
|
-
import { applyToPoint as
|
|
10160
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
10101
10161
|
|
|
10102
10162
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
10103
10163
|
import "transformation-matrix";
|
|
10104
10164
|
import "@tscircuit/circuit-json-util";
|
|
10105
10165
|
|
|
10106
10166
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
10107
|
-
import { applyToPoint as
|
|
10167
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
10108
10168
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
10109
10169
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
10110
10170
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -10157,8 +10217,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10157
10217
|
realEdgePos.y += realPinLineLength;
|
|
10158
10218
|
break;
|
|
10159
10219
|
}
|
|
10160
|
-
const screenSchPortPos =
|
|
10161
|
-
const screenRealEdgePos =
|
|
10220
|
+
const screenSchPortPos = applyToPoint53(transform, schPort.center);
|
|
10221
|
+
const screenRealEdgePos = applyToPoint53(transform, realEdgePos);
|
|
10162
10222
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
10163
10223
|
const realLineEnd = { ...schPort.center };
|
|
10164
10224
|
if (!isConnected) {
|
|
@@ -10177,7 +10237,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10177
10237
|
break;
|
|
10178
10238
|
}
|
|
10179
10239
|
}
|
|
10180
|
-
const screenLineEnd =
|
|
10240
|
+
const screenLineEnd = applyToPoint53(transform, realLineEnd);
|
|
10181
10241
|
svgObjects.push({
|
|
10182
10242
|
name: "line",
|
|
10183
10243
|
type: "element",
|
|
@@ -10298,7 +10358,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
10298
10358
|
};
|
|
10299
10359
|
|
|
10300
10360
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
10301
|
-
import { applyToPoint as
|
|
10361
|
+
import { applyToPoint as applyToPoint54 } from "transformation-matrix";
|
|
10302
10362
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
10303
10363
|
const svgObjects = [];
|
|
10304
10364
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -10316,7 +10376,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10316
10376
|
} else {
|
|
10317
10377
|
realPinNumberPos.y += 0.02;
|
|
10318
10378
|
}
|
|
10319
|
-
const screenPinNumberTextPos =
|
|
10379
|
+
const screenPinNumberTextPos = applyToPoint54(transform, realPinNumberPos);
|
|
10320
10380
|
svgObjects.push({
|
|
10321
10381
|
name: "text",
|
|
10322
10382
|
type: "element",
|
|
@@ -10346,7 +10406,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
10346
10406
|
};
|
|
10347
10407
|
|
|
10348
10408
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
10349
|
-
import { applyToPoint as
|
|
10409
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
10350
10410
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
10351
10411
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
10352
10412
|
const svgObjects = [];
|
|
@@ -10360,7 +10420,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
10360
10420
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
10361
10421
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10362
10422
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
10363
|
-
const screenPinNumberTextPos =
|
|
10423
|
+
const screenPinNumberTextPos = applyToPoint55(transform, realPinNumberPos);
|
|
10364
10424
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
10365
10425
|
if (!label) return [];
|
|
10366
10426
|
const isNegated = label.startsWith("N_");
|
|
@@ -10408,13 +10468,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
10408
10468
|
};
|
|
10409
10469
|
|
|
10410
10470
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
10411
|
-
import { applyToPoint as
|
|
10471
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
10412
10472
|
var createSvgSchText = ({
|
|
10413
10473
|
elm,
|
|
10414
10474
|
transform,
|
|
10415
10475
|
colorMap: colorMap2
|
|
10416
10476
|
}) => {
|
|
10417
|
-
const center =
|
|
10477
|
+
const center = applyToPoint57(transform, elm.position);
|
|
10418
10478
|
const textAnchorMap = {
|
|
10419
10479
|
center: "middle",
|
|
10420
10480
|
center_right: "end",
|
|
@@ -10498,11 +10558,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
10498
10558
|
colorMap: colorMap2
|
|
10499
10559
|
}) => {
|
|
10500
10560
|
const svgObjects = [];
|
|
10501
|
-
const componentScreenTopLeft =
|
|
10561
|
+
const componentScreenTopLeft = applyToPoint58(transform, {
|
|
10502
10562
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
10503
10563
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
10504
10564
|
});
|
|
10505
|
-
const componentScreenBottomRight =
|
|
10565
|
+
const componentScreenBottomRight = applyToPoint58(transform, {
|
|
10506
10566
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
10507
10567
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
10508
10568
|
});
|
|
@@ -10588,13 +10648,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
10588
10648
|
}
|
|
10589
10649
|
|
|
10590
10650
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
10591
|
-
import { applyToPoint as
|
|
10651
|
+
import { applyToPoint as applyToPoint59 } from "transformation-matrix";
|
|
10592
10652
|
function createSvgObjectsFromSchVoltageProbe({
|
|
10593
10653
|
probe,
|
|
10594
10654
|
transform,
|
|
10595
10655
|
colorMap: colorMap2
|
|
10596
10656
|
}) {
|
|
10597
|
-
const [screenX, screenY] =
|
|
10657
|
+
const [screenX, screenY] = applyToPoint59(transform, [
|
|
10598
10658
|
probe.position.x,
|
|
10599
10659
|
probe.position.y
|
|
10600
10660
|
]);
|
|
@@ -10768,17 +10828,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
10768
10828
|
}
|
|
10769
10829
|
|
|
10770
10830
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
10771
|
-
import { applyToPoint as
|
|
10831
|
+
import { applyToPoint as applyToPoint60 } from "transformation-matrix";
|
|
10772
10832
|
function createSvgObjectsFromSchDebugObject({
|
|
10773
10833
|
debugObject,
|
|
10774
10834
|
transform
|
|
10775
10835
|
}) {
|
|
10776
10836
|
if (debugObject.shape === "rect") {
|
|
10777
|
-
let [screenLeft, screenTop] =
|
|
10837
|
+
let [screenLeft, screenTop] = applyToPoint60(transform, [
|
|
10778
10838
|
debugObject.center.x - debugObject.size.width / 2,
|
|
10779
10839
|
debugObject.center.y - debugObject.size.height / 2
|
|
10780
10840
|
]);
|
|
10781
|
-
let [screenRight, screenBottom] =
|
|
10841
|
+
let [screenRight, screenBottom] = applyToPoint60(transform, [
|
|
10782
10842
|
debugObject.center.x + debugObject.size.width / 2,
|
|
10783
10843
|
debugObject.center.y + debugObject.size.height / 2
|
|
10784
10844
|
]);
|
|
@@ -10788,7 +10848,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
10788
10848
|
];
|
|
10789
10849
|
const width = Math.abs(screenRight - screenLeft);
|
|
10790
10850
|
const height = Math.abs(screenBottom - screenTop);
|
|
10791
|
-
const [screenCenterX, screenCenterY] =
|
|
10851
|
+
const [screenCenterX, screenCenterY] = applyToPoint60(transform, [
|
|
10792
10852
|
debugObject.center.x,
|
|
10793
10853
|
debugObject.center.y
|
|
10794
10854
|
]);
|
|
@@ -10834,11 +10894,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
10834
10894
|
];
|
|
10835
10895
|
}
|
|
10836
10896
|
if (debugObject.shape === "line") {
|
|
10837
|
-
const [screenStartX, screenStartY] =
|
|
10897
|
+
const [screenStartX, screenStartY] = applyToPoint60(transform, [
|
|
10838
10898
|
debugObject.start.x,
|
|
10839
10899
|
debugObject.start.y
|
|
10840
10900
|
]);
|
|
10841
|
-
const [screenEndX, screenEndY] =
|
|
10901
|
+
const [screenEndX, screenEndY] = applyToPoint60(transform, [
|
|
10842
10902
|
debugObject.end.x,
|
|
10843
10903
|
debugObject.end.y
|
|
10844
10904
|
]);
|
|
@@ -10888,7 +10948,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
10888
10948
|
}
|
|
10889
10949
|
|
|
10890
10950
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
10891
|
-
import { applyToPoint as
|
|
10951
|
+
import { applyToPoint as applyToPoint61 } from "transformation-matrix";
|
|
10892
10952
|
function createSchematicTrace({
|
|
10893
10953
|
trace,
|
|
10894
10954
|
transform,
|
|
@@ -10902,11 +10962,11 @@ function createSchematicTrace({
|
|
|
10902
10962
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
10903
10963
|
const edge = edges[edgeIndex];
|
|
10904
10964
|
if (edge.is_crossing) continue;
|
|
10905
|
-
const [screenFromX, screenFromY] =
|
|
10965
|
+
const [screenFromX, screenFromY] = applyToPoint61(transform, [
|
|
10906
10966
|
edge.from.x,
|
|
10907
10967
|
edge.from.y
|
|
10908
10968
|
]);
|
|
10909
|
-
const [screenToX, screenToY] =
|
|
10969
|
+
const [screenToX, screenToY] = applyToPoint61(transform, [
|
|
10910
10970
|
edge.to.x,
|
|
10911
10971
|
edge.to.y
|
|
10912
10972
|
]);
|
|
@@ -10950,11 +11010,11 @@ function createSchematicTrace({
|
|
|
10950
11010
|
}
|
|
10951
11011
|
for (const edge of edges) {
|
|
10952
11012
|
if (!edge.is_crossing) continue;
|
|
10953
|
-
const [screenFromX, screenFromY] =
|
|
11013
|
+
const [screenFromX, screenFromY] = applyToPoint61(transform, [
|
|
10954
11014
|
edge.from.x,
|
|
10955
11015
|
edge.from.y
|
|
10956
11016
|
]);
|
|
10957
|
-
const [screenToX, screenToY] =
|
|
11017
|
+
const [screenToX, screenToY] = applyToPoint61(transform, [
|
|
10958
11018
|
edge.to.x,
|
|
10959
11019
|
edge.to.y
|
|
10960
11020
|
]);
|
|
@@ -10998,7 +11058,7 @@ function createSchematicTrace({
|
|
|
10998
11058
|
}
|
|
10999
11059
|
if (trace.junctions) {
|
|
11000
11060
|
for (const junction of trace.junctions) {
|
|
11001
|
-
const [screenX, screenY] =
|
|
11061
|
+
const [screenX, screenY] = applyToPoint61(transform, [
|
|
11002
11062
|
junction.x,
|
|
11003
11063
|
junction.y
|
|
11004
11064
|
]);
|
|
@@ -11053,7 +11113,7 @@ function createSchematicTrace({
|
|
|
11053
11113
|
|
|
11054
11114
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
11055
11115
|
import {
|
|
11056
|
-
applyToPoint as
|
|
11116
|
+
applyToPoint as applyToPoint63,
|
|
11057
11117
|
compose as compose12,
|
|
11058
11118
|
rotate as rotate7,
|
|
11059
11119
|
scale as scale7,
|
|
@@ -11062,7 +11122,7 @@ import {
|
|
|
11062
11122
|
|
|
11063
11123
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
11064
11124
|
import {
|
|
11065
|
-
applyToPoint as
|
|
11125
|
+
applyToPoint as applyToPoint62,
|
|
11066
11126
|
compose as compose11,
|
|
11067
11127
|
rotate as rotate6,
|
|
11068
11128
|
scale as scale6,
|
|
@@ -11137,7 +11197,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11137
11197
|
x: symbolBounds.minX,
|
|
11138
11198
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
11139
11199
|
};
|
|
11140
|
-
const rotatedSymbolEnd =
|
|
11200
|
+
const rotatedSymbolEnd = applyToPoint62(rotationMatrix, symbolEndPoint);
|
|
11141
11201
|
const symbolToRealTransform = compose11(
|
|
11142
11202
|
translate11(
|
|
11143
11203
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -11147,11 +11207,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11147
11207
|
scale6(1)
|
|
11148
11208
|
// Use full symbol size
|
|
11149
11209
|
);
|
|
11150
|
-
const [screenMinX, screenMinY] =
|
|
11210
|
+
const [screenMinX, screenMinY] = applyToPoint62(
|
|
11151
11211
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11152
11212
|
[bounds.minX, bounds.minY]
|
|
11153
11213
|
);
|
|
11154
|
-
const [screenMaxX, screenMaxY] =
|
|
11214
|
+
const [screenMaxX, screenMaxY] = applyToPoint62(
|
|
11155
11215
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11156
11216
|
[bounds.maxX, bounds.maxY]
|
|
11157
11217
|
);
|
|
@@ -11175,7 +11235,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11175
11235
|
});
|
|
11176
11236
|
for (const path of symbolPaths) {
|
|
11177
11237
|
const symbolPath = path.points.map((p, i) => {
|
|
11178
|
-
const [x, y] =
|
|
11238
|
+
const [x, y] = applyToPoint62(
|
|
11179
11239
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11180
11240
|
[p.x, p.y]
|
|
11181
11241
|
);
|
|
@@ -11196,7 +11256,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11196
11256
|
});
|
|
11197
11257
|
}
|
|
11198
11258
|
for (const text of symbolTexts) {
|
|
11199
|
-
const screenTextPos =
|
|
11259
|
+
const screenTextPos = applyToPoint62(
|
|
11200
11260
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11201
11261
|
text
|
|
11202
11262
|
);
|
|
@@ -11238,7 +11298,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11238
11298
|
});
|
|
11239
11299
|
}
|
|
11240
11300
|
for (const box of symbolBoxes) {
|
|
11241
|
-
const screenBoxPos =
|
|
11301
|
+
const screenBoxPos = applyToPoint62(
|
|
11242
11302
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11243
11303
|
box
|
|
11244
11304
|
);
|
|
@@ -11261,7 +11321,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
11261
11321
|
});
|
|
11262
11322
|
}
|
|
11263
11323
|
for (const circle of symbolCircles) {
|
|
11264
|
-
const screenCirclePos =
|
|
11324
|
+
const screenCirclePos = applyToPoint62(
|
|
11265
11325
|
compose11(realToScreenTransform, symbolToRealTransform),
|
|
11266
11326
|
circle
|
|
11267
11327
|
);
|
|
@@ -11306,14 +11366,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11306
11366
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
11307
11367
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
11308
11368
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
11309
|
-
const screenCenter =
|
|
11369
|
+
const screenCenter = applyToPoint63(realToScreenTransform, schNetLabel.center);
|
|
11310
11370
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
11311
11371
|
schNetLabel.anchor_side
|
|
11312
11372
|
);
|
|
11313
11373
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
11314
11374
|
screenTextGrowthVec.y *= -1;
|
|
11315
11375
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
11316
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
11376
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint63(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
11317
11377
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
11318
11378
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
11319
11379
|
};
|
|
@@ -11354,7 +11414,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11354
11414
|
y: -0.6
|
|
11355
11415
|
}
|
|
11356
11416
|
].map(
|
|
11357
|
-
(fontRelativePoint) =>
|
|
11417
|
+
(fontRelativePoint) => applyToPoint63(
|
|
11358
11418
|
compose12(
|
|
11359
11419
|
realToScreenTransform,
|
|
11360
11420
|
translate12(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -11431,17 +11491,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
11431
11491
|
};
|
|
11432
11492
|
|
|
11433
11493
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
11434
|
-
import { applyToPoint as
|
|
11494
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
11435
11495
|
var createSvgObjectsFromSchematicBox = ({
|
|
11436
11496
|
schematicBox,
|
|
11437
11497
|
transform,
|
|
11438
11498
|
colorMap: colorMap2
|
|
11439
11499
|
}) => {
|
|
11440
|
-
const topLeft =
|
|
11500
|
+
const topLeft = applyToPoint64(transform, {
|
|
11441
11501
|
x: schematicBox.x,
|
|
11442
11502
|
y: schematicBox.y
|
|
11443
11503
|
});
|
|
11444
|
-
const bottomRight =
|
|
11504
|
+
const bottomRight = applyToPoint64(transform, {
|
|
11445
11505
|
x: schematicBox.x + schematicBox.width,
|
|
11446
11506
|
y: schematicBox.y + schematicBox.height
|
|
11447
11507
|
});
|
|
@@ -11477,7 +11537,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
11477
11537
|
};
|
|
11478
11538
|
|
|
11479
11539
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
11480
|
-
import { applyToPoint as
|
|
11540
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
11481
11541
|
var createSvgObjectsFromSchematicTable = ({
|
|
11482
11542
|
schematicTable,
|
|
11483
11543
|
transform,
|
|
@@ -11510,11 +11570,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11510
11570
|
const svgObjects = [];
|
|
11511
11571
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
11512
11572
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
11513
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
11573
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint65(transform, [
|
|
11514
11574
|
topLeftX,
|
|
11515
11575
|
topLeftY
|
|
11516
11576
|
]);
|
|
11517
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
11577
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint65(transform, [
|
|
11518
11578
|
topLeftX + totalWidth,
|
|
11519
11579
|
topLeftY - totalHeight
|
|
11520
11580
|
]);
|
|
@@ -11546,8 +11606,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11546
11606
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
11547
11607
|
);
|
|
11548
11608
|
if (!isMerged) {
|
|
11549
|
-
const start =
|
|
11550
|
-
const end =
|
|
11609
|
+
const start = applyToPoint65(transform, { x: currentX, y: segmentStartY });
|
|
11610
|
+
const end = applyToPoint65(transform, { x: currentX, y: segmentEndY });
|
|
11551
11611
|
svgObjects.push({
|
|
11552
11612
|
name: "line",
|
|
11553
11613
|
type: "element",
|
|
@@ -11576,11 +11636,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11576
11636
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
11577
11637
|
);
|
|
11578
11638
|
if (!isMerged) {
|
|
11579
|
-
const start =
|
|
11639
|
+
const start = applyToPoint65(transform, {
|
|
11580
11640
|
x: segmentStartX,
|
|
11581
11641
|
y: currentY
|
|
11582
11642
|
});
|
|
11583
|
-
const end =
|
|
11643
|
+
const end = applyToPoint65(transform, { x: segmentEndX, y: currentY });
|
|
11584
11644
|
svgObjects.push({
|
|
11585
11645
|
name: "line",
|
|
11586
11646
|
type: "element",
|
|
@@ -11622,7 +11682,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11622
11682
|
} else if (vertical_align === "bottom") {
|
|
11623
11683
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
11624
11684
|
}
|
|
11625
|
-
const screenTextAnchorPos =
|
|
11685
|
+
const screenTextAnchorPos = applyToPoint65(transform, realTextAnchorPos);
|
|
11626
11686
|
const fontSize = getSchScreenFontSize(
|
|
11627
11687
|
transform,
|
|
11628
11688
|
"reference_designator",
|
|
@@ -11678,13 +11738,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
11678
11738
|
|
|
11679
11739
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
11680
11740
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
11681
|
-
import { applyToPoint as
|
|
11741
|
+
import { applyToPoint as applyToPoint66 } from "transformation-matrix";
|
|
11682
11742
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
11683
11743
|
var createSvgObjectsForSchPortHover = ({
|
|
11684
11744
|
schPort,
|
|
11685
11745
|
transform
|
|
11686
11746
|
}) => {
|
|
11687
|
-
const screenSchPortPos =
|
|
11747
|
+
const screenSchPortPos = applyToPoint66(transform, schPort.center);
|
|
11688
11748
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
11689
11749
|
return [
|
|
11690
11750
|
{
|
|
@@ -11729,14 +11789,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
11729
11789
|
};
|
|
11730
11790
|
|
|
11731
11791
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
11732
|
-
import { applyToPoint as
|
|
11792
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
11733
11793
|
function createSvgObjectsFromSchematicLine({
|
|
11734
11794
|
schLine,
|
|
11735
11795
|
transform,
|
|
11736
11796
|
colorMap: colorMap2
|
|
11737
11797
|
}) {
|
|
11738
|
-
const p1 =
|
|
11739
|
-
const p2 =
|
|
11798
|
+
const p1 = applyToPoint67(transform, { x: schLine.x1, y: schLine.y1 });
|
|
11799
|
+
const p2 = applyToPoint67(transform, { x: schLine.x2, y: schLine.y2 });
|
|
11740
11800
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
11741
11801
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
11742
11802
|
return [
|
|
@@ -11765,13 +11825,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
11765
11825
|
}
|
|
11766
11826
|
|
|
11767
11827
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
11768
|
-
import { applyToPoint as
|
|
11828
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
11769
11829
|
function createSvgObjectsFromSchematicCircle({
|
|
11770
11830
|
schCircle,
|
|
11771
11831
|
transform,
|
|
11772
11832
|
colorMap: colorMap2
|
|
11773
11833
|
}) {
|
|
11774
|
-
const center =
|
|
11834
|
+
const center = applyToPoint68(transform, schCircle.center);
|
|
11775
11835
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
11776
11836
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
11777
11837
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -11801,13 +11861,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
11801
11861
|
}
|
|
11802
11862
|
|
|
11803
11863
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
11804
|
-
import { applyToPoint as
|
|
11864
|
+
import { applyToPoint as applyToPoint69 } from "transformation-matrix";
|
|
11805
11865
|
function createSvgObjectsFromSchematicRect({
|
|
11806
11866
|
schRect,
|
|
11807
11867
|
transform,
|
|
11808
11868
|
colorMap: colorMap2
|
|
11809
11869
|
}) {
|
|
11810
|
-
const center =
|
|
11870
|
+
const center = applyToPoint69(transform, schRect.center);
|
|
11811
11871
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
11812
11872
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
11813
11873
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -11843,13 +11903,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
11843
11903
|
}
|
|
11844
11904
|
|
|
11845
11905
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
11846
|
-
import { applyToPoint as
|
|
11906
|
+
import { applyToPoint as applyToPoint70 } from "transformation-matrix";
|
|
11847
11907
|
function createSvgObjectsFromSchematicArc({
|
|
11848
11908
|
schArc,
|
|
11849
11909
|
transform,
|
|
11850
11910
|
colorMap: colorMap2
|
|
11851
11911
|
}) {
|
|
11852
|
-
const center =
|
|
11912
|
+
const center = applyToPoint70(transform, schArc.center);
|
|
11853
11913
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
11854
11914
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
11855
11915
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -12969,18 +13029,18 @@ function formatNumber2(value) {
|
|
|
12969
13029
|
import { distance as distance3 } from "circuit-json";
|
|
12970
13030
|
import { stringify as stringify7 } from "svgson";
|
|
12971
13031
|
import {
|
|
12972
|
-
applyToPoint as
|
|
13032
|
+
applyToPoint as applyToPoint73,
|
|
12973
13033
|
compose as compose15,
|
|
12974
13034
|
scale as scale9,
|
|
12975
13035
|
translate as translate15
|
|
12976
13036
|
} from "transformation-matrix";
|
|
12977
13037
|
|
|
12978
13038
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
12979
|
-
import { applyToPoint as
|
|
13039
|
+
import { applyToPoint as applyToPoint72 } from "transformation-matrix";
|
|
12980
13040
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
12981
13041
|
const { transform, layer: layerFilter } = ctx;
|
|
12982
13042
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
12983
|
-
const [x, y] =
|
|
13043
|
+
const [x, y] = applyToPoint72(transform, [solderPaste.x, solderPaste.y]);
|
|
12984
13044
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
12985
13045
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
12986
13046
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -13206,8 +13266,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
13206
13266
|
}
|
|
13207
13267
|
}
|
|
13208
13268
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
13209
|
-
const [x1, y1] =
|
|
13210
|
-
const [x2, y2] =
|
|
13269
|
+
const [x1, y1] = applyToPoint73(transform, [minX, minY]);
|
|
13270
|
+
const [x2, y2] = applyToPoint73(transform, [maxX, maxY]);
|
|
13211
13271
|
const width = Math.abs(x2 - x1);
|
|
13212
13272
|
const height = Math.abs(y2 - y1);
|
|
13213
13273
|
const x = Math.min(x1, x2);
|