circuit-to-svg 0.0.263 → 0.0.265
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -0
- package/dist/index.js +523 -177
- 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 } from "circuit-json";
|
|
3
3
|
import { stringify } from "svgson";
|
|
4
4
|
import {
|
|
5
|
-
applyToPoint as
|
|
5
|
+
applyToPoint as applyToPoint32,
|
|
6
6
|
compose as compose5,
|
|
7
7
|
scale as scale2,
|
|
8
8
|
translate as translate5
|
|
@@ -1953,7 +1953,7 @@ import {
|
|
|
1953
1953
|
toString as matrixToString2
|
|
1954
1954
|
} from "transformation-matrix";
|
|
1955
1955
|
function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
1956
|
-
const { transform, layer: layerFilter, colorMap: colorMap2 } = ctx;
|
|
1956
|
+
const { transform, layer: layerFilter, colorMap: colorMap2, circuitJson } = ctx;
|
|
1957
1957
|
const {
|
|
1958
1958
|
anchor_position,
|
|
1959
1959
|
text,
|
|
@@ -2834,6 +2834,28 @@ function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
|
2834
2834
|
}
|
|
2835
2835
|
];
|
|
2836
2836
|
}
|
|
2837
|
+
if (hole.hole_shape === "rect") {
|
|
2838
|
+
const scaledWidth = hole.hole_width * Math.abs(transform.a);
|
|
2839
|
+
const scaledHeight = hole.hole_height * Math.abs(transform.a);
|
|
2840
|
+
return [
|
|
2841
|
+
{
|
|
2842
|
+
name: "rect",
|
|
2843
|
+
type: "element",
|
|
2844
|
+
attributes: {
|
|
2845
|
+
class: "pcb-hole",
|
|
2846
|
+
x: (x - scaledWidth / 2).toString(),
|
|
2847
|
+
y: (y - scaledHeight / 2).toString(),
|
|
2848
|
+
width: scaledWidth.toString(),
|
|
2849
|
+
height: scaledHeight.toString(),
|
|
2850
|
+
fill: colorMap2.drill,
|
|
2851
|
+
"data-type": "pcb_hole",
|
|
2852
|
+
"data-pcb-layer": "drill"
|
|
2853
|
+
},
|
|
2854
|
+
children: [],
|
|
2855
|
+
value: ""
|
|
2856
|
+
}
|
|
2857
|
+
];
|
|
2858
|
+
}
|
|
2837
2859
|
if (hole.hole_shape === "pill") {
|
|
2838
2860
|
const scaledWidth = hole.hole_width * Math.abs(transform.a);
|
|
2839
2861
|
const scaledHeight = hole.hole_height * Math.abs(transform.a);
|
|
@@ -3370,50 +3392,372 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
3370
3392
|
}
|
|
3371
3393
|
|
|
3372
3394
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
3395
|
+
import { applyToPoint as applyToPoint30 } from "transformation-matrix";
|
|
3396
|
+
|
|
3397
|
+
// lib/utils/create-pcb-component-anchor-offset-indicators.ts
|
|
3373
3398
|
import { applyToPoint as applyToPoint29 } from "transformation-matrix";
|
|
3399
|
+
var OFFSET_THRESHOLD_MM = 0.01;
|
|
3400
|
+
var TICK_SIZE_PX = 4;
|
|
3401
|
+
var LABEL_GAP_PX = 8;
|
|
3402
|
+
var LABEL_FONT_SIZE_PX = 11;
|
|
3403
|
+
var STROKE_WIDTH_PX = 1;
|
|
3404
|
+
var ANCHOR_MARKER_SIZE_PX = 5;
|
|
3405
|
+
var ANCHOR_MARKER_STROKE_WIDTH_PX = 1.5;
|
|
3406
|
+
var COMPONENT_GAP_PX = 15;
|
|
3407
|
+
var COMPONENT_SIDE_GAP_PX = 10;
|
|
3408
|
+
var DISTANCE_MULTIPLIER = 0.2;
|
|
3409
|
+
var MAX_OFFSET_PX = 50;
|
|
3410
|
+
function createAnchorOffsetIndicators(params) {
|
|
3411
|
+
const {
|
|
3412
|
+
groupAnchorPosition,
|
|
3413
|
+
componentPosition,
|
|
3414
|
+
transform,
|
|
3415
|
+
componentWidth = 0,
|
|
3416
|
+
componentHeight = 0
|
|
3417
|
+
} = params;
|
|
3418
|
+
const objects = [];
|
|
3419
|
+
const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint29(transform, [
|
|
3420
|
+
groupAnchorPosition.x,
|
|
3421
|
+
groupAnchorPosition.y
|
|
3422
|
+
]);
|
|
3423
|
+
const [screenComponentX, screenComponentY] = applyToPoint29(transform, [
|
|
3424
|
+
componentPosition.x,
|
|
3425
|
+
componentPosition.y
|
|
3426
|
+
]);
|
|
3427
|
+
const offsetX = componentPosition.x - groupAnchorPosition.x;
|
|
3428
|
+
const offsetY = componentPosition.y - groupAnchorPosition.y;
|
|
3429
|
+
const scale9 = Math.abs(transform.a);
|
|
3430
|
+
const screenComponentWidth = componentWidth * scale9;
|
|
3431
|
+
const screenComponentHeight = componentHeight * scale9;
|
|
3432
|
+
objects.push(createAnchorMarker(screenGroupAnchorX, screenGroupAnchorY));
|
|
3433
|
+
objects.push({
|
|
3434
|
+
name: "line",
|
|
3435
|
+
type: "element",
|
|
3436
|
+
attributes: {
|
|
3437
|
+
x1: screenGroupAnchorX.toString(),
|
|
3438
|
+
y1: screenGroupAnchorY.toString(),
|
|
3439
|
+
x2: screenComponentX.toString(),
|
|
3440
|
+
y2: screenComponentY.toString(),
|
|
3441
|
+
stroke: "#ffffff",
|
|
3442
|
+
"stroke-width": "0.5",
|
|
3443
|
+
"stroke-dasharray": "3,3",
|
|
3444
|
+
opacity: "0.5",
|
|
3445
|
+
class: "anchor-offset-connector"
|
|
3446
|
+
},
|
|
3447
|
+
children: [],
|
|
3448
|
+
value: ""
|
|
3449
|
+
});
|
|
3450
|
+
objects.push({
|
|
3451
|
+
name: "circle",
|
|
3452
|
+
type: "element",
|
|
3453
|
+
attributes: {
|
|
3454
|
+
cx: screenComponentX.toString(),
|
|
3455
|
+
cy: screenComponentY.toString(),
|
|
3456
|
+
r: "2",
|
|
3457
|
+
fill: "#ffffff",
|
|
3458
|
+
opacity: "0.7",
|
|
3459
|
+
class: "anchor-offset-component-marker"
|
|
3460
|
+
},
|
|
3461
|
+
children: [],
|
|
3462
|
+
value: ""
|
|
3463
|
+
});
|
|
3464
|
+
const yDistance = Math.abs(screenComponentY - screenGroupAnchorY);
|
|
3465
|
+
const xDistance = Math.abs(screenComponentX - screenGroupAnchorX);
|
|
3466
|
+
const totalDistance = Math.sqrt(xDistance * xDistance + yDistance * yDistance);
|
|
3467
|
+
const componentHeightOffset = screenComponentHeight / 2 + COMPONENT_GAP_PX;
|
|
3468
|
+
const dynamicOffset = Math.max(
|
|
3469
|
+
componentHeightOffset,
|
|
3470
|
+
Math.min(MAX_OFFSET_PX, totalDistance * DISTANCE_MULTIPLIER)
|
|
3471
|
+
);
|
|
3472
|
+
const horizontalLineY = offsetY > 0 ? screenComponentY - dynamicOffset : screenComponentY + dynamicOffset;
|
|
3473
|
+
const componentWidthOffset = screenComponentWidth / 2 + COMPONENT_SIDE_GAP_PX;
|
|
3474
|
+
const verticalLineX = offsetX > 0 ? screenComponentX + componentWidthOffset : screenComponentX - componentWidthOffset;
|
|
3475
|
+
if (Math.abs(offsetX) > OFFSET_THRESHOLD_MM) {
|
|
3476
|
+
objects.push(
|
|
3477
|
+
...createHorizontalDimension({
|
|
3478
|
+
startX: screenGroupAnchorX,
|
|
3479
|
+
endX: screenComponentX,
|
|
3480
|
+
y: horizontalLineY,
|
|
3481
|
+
offsetMm: offsetX,
|
|
3482
|
+
offsetY
|
|
3483
|
+
})
|
|
3484
|
+
);
|
|
3485
|
+
}
|
|
3486
|
+
if (Math.abs(offsetY) > OFFSET_THRESHOLD_MM) {
|
|
3487
|
+
objects.push(
|
|
3488
|
+
...createVerticalDimension({
|
|
3489
|
+
x: verticalLineX,
|
|
3490
|
+
startY: screenGroupAnchorY,
|
|
3491
|
+
endY: screenComponentY,
|
|
3492
|
+
offsetMm: -offsetY,
|
|
3493
|
+
offsetX
|
|
3494
|
+
})
|
|
3495
|
+
);
|
|
3496
|
+
}
|
|
3497
|
+
return objects;
|
|
3498
|
+
}
|
|
3499
|
+
function createAnchorMarker(x, y) {
|
|
3500
|
+
return {
|
|
3501
|
+
name: "g",
|
|
3502
|
+
type: "element",
|
|
3503
|
+
attributes: {
|
|
3504
|
+
class: "anchor-offset-marker",
|
|
3505
|
+
"data-type": "anchor_offset_marker"
|
|
3506
|
+
},
|
|
3507
|
+
children: [
|
|
3508
|
+
{
|
|
3509
|
+
name: "line",
|
|
3510
|
+
type: "element",
|
|
3511
|
+
attributes: {
|
|
3512
|
+
x1: x.toString(),
|
|
3513
|
+
y1: (y - ANCHOR_MARKER_SIZE_PX).toString(),
|
|
3514
|
+
x2: x.toString(),
|
|
3515
|
+
y2: (y + ANCHOR_MARKER_SIZE_PX).toString(),
|
|
3516
|
+
stroke: "#ffffff",
|
|
3517
|
+
"stroke-width": ANCHOR_MARKER_STROKE_WIDTH_PX.toString(),
|
|
3518
|
+
"stroke-linecap": "round"
|
|
3519
|
+
},
|
|
3520
|
+
children: [],
|
|
3521
|
+
value: ""
|
|
3522
|
+
},
|
|
3523
|
+
{
|
|
3524
|
+
name: "line",
|
|
3525
|
+
type: "element",
|
|
3526
|
+
attributes: {
|
|
3527
|
+
x1: (x - ANCHOR_MARKER_SIZE_PX).toString(),
|
|
3528
|
+
y1: y.toString(),
|
|
3529
|
+
x2: (x + ANCHOR_MARKER_SIZE_PX).toString(),
|
|
3530
|
+
y2: y.toString(),
|
|
3531
|
+
stroke: "#ffffff",
|
|
3532
|
+
"stroke-width": ANCHOR_MARKER_STROKE_WIDTH_PX.toString(),
|
|
3533
|
+
"stroke-linecap": "round"
|
|
3534
|
+
},
|
|
3535
|
+
children: [],
|
|
3536
|
+
value: ""
|
|
3537
|
+
}
|
|
3538
|
+
],
|
|
3539
|
+
value: ""
|
|
3540
|
+
};
|
|
3541
|
+
}
|
|
3542
|
+
function createHorizontalDimension({
|
|
3543
|
+
startX,
|
|
3544
|
+
endX,
|
|
3545
|
+
y,
|
|
3546
|
+
offsetMm,
|
|
3547
|
+
offsetY
|
|
3548
|
+
}) {
|
|
3549
|
+
const objects = [];
|
|
3550
|
+
objects.push({
|
|
3551
|
+
name: "line",
|
|
3552
|
+
type: "element",
|
|
3553
|
+
attributes: {
|
|
3554
|
+
x1: startX.toString(),
|
|
3555
|
+
y1: y.toString(),
|
|
3556
|
+
x2: endX.toString(),
|
|
3557
|
+
y2: y.toString(),
|
|
3558
|
+
stroke: "#ffffff",
|
|
3559
|
+
"stroke-width": STROKE_WIDTH_PX.toString(),
|
|
3560
|
+
class: "anchor-offset-dimension-x"
|
|
3561
|
+
},
|
|
3562
|
+
children: [],
|
|
3563
|
+
value: ""
|
|
3564
|
+
});
|
|
3565
|
+
objects.push({
|
|
3566
|
+
name: "line",
|
|
3567
|
+
type: "element",
|
|
3568
|
+
attributes: {
|
|
3569
|
+
x1: startX.toString(),
|
|
3570
|
+
y1: (y - TICK_SIZE_PX).toString(),
|
|
3571
|
+
x2: startX.toString(),
|
|
3572
|
+
y2: (y + TICK_SIZE_PX).toString(),
|
|
3573
|
+
stroke: "#ffffff",
|
|
3574
|
+
"stroke-width": STROKE_WIDTH_PX.toString()
|
|
3575
|
+
},
|
|
3576
|
+
children: [],
|
|
3577
|
+
value: ""
|
|
3578
|
+
});
|
|
3579
|
+
objects.push({
|
|
3580
|
+
name: "line",
|
|
3581
|
+
type: "element",
|
|
3582
|
+
attributes: {
|
|
3583
|
+
x1: endX.toString(),
|
|
3584
|
+
y1: (y - TICK_SIZE_PX).toString(),
|
|
3585
|
+
x2: endX.toString(),
|
|
3586
|
+
y2: (y + TICK_SIZE_PX).toString(),
|
|
3587
|
+
stroke: "#ffffff",
|
|
3588
|
+
"stroke-width": STROKE_WIDTH_PX.toString()
|
|
3589
|
+
},
|
|
3590
|
+
children: [],
|
|
3591
|
+
value: ""
|
|
3592
|
+
});
|
|
3593
|
+
const midX = (startX + endX) / 2;
|
|
3594
|
+
const labelY = offsetY > 0 ? y - TICK_SIZE_PX - LABEL_GAP_PX : y + TICK_SIZE_PX + LABEL_GAP_PX;
|
|
3595
|
+
objects.push({
|
|
3596
|
+
name: "text",
|
|
3597
|
+
type: "element",
|
|
3598
|
+
attributes: {
|
|
3599
|
+
x: midX.toString(),
|
|
3600
|
+
y: labelY.toString(),
|
|
3601
|
+
fill: "#ffffff",
|
|
3602
|
+
"font-size": LABEL_FONT_SIZE_PX.toString(),
|
|
3603
|
+
"font-family": "Arial, sans-serif",
|
|
3604
|
+
"text-anchor": "middle",
|
|
3605
|
+
"dominant-baseline": offsetY > 0 ? "baseline" : "hanging",
|
|
3606
|
+
class: "anchor-offset-label"
|
|
3607
|
+
},
|
|
3608
|
+
children: [
|
|
3609
|
+
{
|
|
3610
|
+
type: "text",
|
|
3611
|
+
value: `X: ${offsetMm.toFixed(2)}mm`,
|
|
3612
|
+
name: "",
|
|
3613
|
+
attributes: {},
|
|
3614
|
+
children: []
|
|
3615
|
+
}
|
|
3616
|
+
],
|
|
3617
|
+
value: ""
|
|
3618
|
+
});
|
|
3619
|
+
return objects;
|
|
3620
|
+
}
|
|
3621
|
+
function createVerticalDimension({
|
|
3622
|
+
x,
|
|
3623
|
+
startY,
|
|
3624
|
+
endY,
|
|
3625
|
+
offsetMm,
|
|
3626
|
+
offsetX
|
|
3627
|
+
}) {
|
|
3628
|
+
const objects = [];
|
|
3629
|
+
objects.push({
|
|
3630
|
+
name: "line",
|
|
3631
|
+
type: "element",
|
|
3632
|
+
attributes: {
|
|
3633
|
+
x1: x.toString(),
|
|
3634
|
+
y1: startY.toString(),
|
|
3635
|
+
x2: x.toString(),
|
|
3636
|
+
y2: endY.toString(),
|
|
3637
|
+
stroke: "#ffffff",
|
|
3638
|
+
"stroke-width": STROKE_WIDTH_PX.toString(),
|
|
3639
|
+
class: "anchor-offset-dimension-y"
|
|
3640
|
+
},
|
|
3641
|
+
children: [],
|
|
3642
|
+
value: ""
|
|
3643
|
+
});
|
|
3644
|
+
objects.push({
|
|
3645
|
+
name: "line",
|
|
3646
|
+
type: "element",
|
|
3647
|
+
attributes: {
|
|
3648
|
+
x1: (x - TICK_SIZE_PX).toString(),
|
|
3649
|
+
y1: startY.toString(),
|
|
3650
|
+
x2: (x + TICK_SIZE_PX).toString(),
|
|
3651
|
+
y2: startY.toString(),
|
|
3652
|
+
stroke: "#ffffff",
|
|
3653
|
+
"stroke-width": STROKE_WIDTH_PX.toString()
|
|
3654
|
+
},
|
|
3655
|
+
children: [],
|
|
3656
|
+
value: ""
|
|
3657
|
+
});
|
|
3658
|
+
objects.push({
|
|
3659
|
+
name: "line",
|
|
3660
|
+
type: "element",
|
|
3661
|
+
attributes: {
|
|
3662
|
+
x1: (x - TICK_SIZE_PX).toString(),
|
|
3663
|
+
y1: endY.toString(),
|
|
3664
|
+
x2: (x + TICK_SIZE_PX).toString(),
|
|
3665
|
+
y2: endY.toString(),
|
|
3666
|
+
stroke: "#ffffff",
|
|
3667
|
+
"stroke-width": STROKE_WIDTH_PX.toString()
|
|
3668
|
+
},
|
|
3669
|
+
children: [],
|
|
3670
|
+
value: ""
|
|
3671
|
+
});
|
|
3672
|
+
const midY = (startY + endY) / 2;
|
|
3673
|
+
const labelX = offsetX < 0 ? x - TICK_SIZE_PX - 4 : x + TICK_SIZE_PX + 4;
|
|
3674
|
+
objects.push({
|
|
3675
|
+
name: "text",
|
|
3676
|
+
type: "element",
|
|
3677
|
+
attributes: {
|
|
3678
|
+
x: labelX.toString(),
|
|
3679
|
+
y: midY.toString(),
|
|
3680
|
+
fill: "#ffffff",
|
|
3681
|
+
"font-size": LABEL_FONT_SIZE_PX.toString(),
|
|
3682
|
+
"font-family": "Arial, sans-serif",
|
|
3683
|
+
"text-anchor": offsetX < 0 ? "end" : "start",
|
|
3684
|
+
"dominant-baseline": "middle",
|
|
3685
|
+
class: "anchor-offset-label"
|
|
3686
|
+
},
|
|
3687
|
+
children: [
|
|
3688
|
+
{
|
|
3689
|
+
type: "text",
|
|
3690
|
+
value: `Y: ${offsetMm.toFixed(2)}mm`,
|
|
3691
|
+
name: "",
|
|
3692
|
+
attributes: {},
|
|
3693
|
+
children: []
|
|
3694
|
+
}
|
|
3695
|
+
],
|
|
3696
|
+
value: ""
|
|
3697
|
+
});
|
|
3698
|
+
return objects;
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3701
|
+
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-component.ts
|
|
3374
3702
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
3375
|
-
const { transform } = ctx;
|
|
3703
|
+
const { transform, circuitJson } = ctx;
|
|
3376
3704
|
const { center, width, height, rotation = 0 } = component;
|
|
3377
|
-
const [x, y] =
|
|
3705
|
+
const [x, y] = applyToPoint30(transform, [center.x, center.y]);
|
|
3378
3706
|
const scaledWidth = width * Math.abs(transform.a);
|
|
3379
3707
|
const scaledHeight = height * Math.abs(transform.d);
|
|
3380
3708
|
const transformStr = `translate(${x}, ${y}) rotate(${-rotation}) scale(1, -1)`;
|
|
3709
|
+
const svgObjects = [];
|
|
3710
|
+
if (ctx.showAnchorOffsets && component.positioned_relative_to_pcb_group_id && component.position_mode === "relative" && circuitJson) {
|
|
3711
|
+
const pcbGroup = circuitJson.find(
|
|
3712
|
+
(elm) => elm.type === "pcb_group" && elm.pcb_group_id === component.positioned_relative_to_pcb_group_id
|
|
3713
|
+
);
|
|
3714
|
+
if (pcbGroup?.center) {
|
|
3715
|
+
svgObjects.push(
|
|
3716
|
+
...createAnchorOffsetIndicators({
|
|
3717
|
+
groupAnchorPosition: pcbGroup.center,
|
|
3718
|
+
componentPosition: center,
|
|
3719
|
+
transform,
|
|
3720
|
+
componentWidth: width,
|
|
3721
|
+
componentHeight: height
|
|
3722
|
+
})
|
|
3723
|
+
);
|
|
3724
|
+
}
|
|
3725
|
+
}
|
|
3381
3726
|
if (!ctx.colorMap.debugComponent?.fill && !ctx.colorMap.debugComponent?.stroke) {
|
|
3382
|
-
return
|
|
3727
|
+
return svgObjects;
|
|
3383
3728
|
}
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
"data-pcb-layer": component.layer ?? "top"
|
|
3407
|
-
}
|
|
3729
|
+
svgObjects.push({
|
|
3730
|
+
name: "g",
|
|
3731
|
+
type: "element",
|
|
3732
|
+
attributes: {
|
|
3733
|
+
transform: transformStr,
|
|
3734
|
+
"data-type": "pcb_component",
|
|
3735
|
+
"data-pcb-layer": component.layer ?? "top"
|
|
3736
|
+
},
|
|
3737
|
+
children: [
|
|
3738
|
+
{
|
|
3739
|
+
name: "rect",
|
|
3740
|
+
type: "element",
|
|
3741
|
+
attributes: {
|
|
3742
|
+
class: "pcb-component",
|
|
3743
|
+
x: (-scaledWidth / 2).toString(),
|
|
3744
|
+
y: (-scaledHeight / 2).toString(),
|
|
3745
|
+
width: scaledWidth.toString(),
|
|
3746
|
+
height: scaledHeight.toString(),
|
|
3747
|
+
fill: ctx.colorMap.debugComponent.fill ?? "transparent",
|
|
3748
|
+
stroke: ctx.colorMap.debugComponent.stroke ?? "transparent",
|
|
3749
|
+
"data-type": "pcb_component",
|
|
3750
|
+
"data-pcb-layer": component.layer ?? "top"
|
|
3408
3751
|
}
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3752
|
+
}
|
|
3753
|
+
],
|
|
3754
|
+
value: ""
|
|
3755
|
+
});
|
|
3756
|
+
return svgObjects;
|
|
3413
3757
|
}
|
|
3414
3758
|
|
|
3415
3759
|
// lib/pcb/svg-object-fns/create-svg-objects-from-pcb-group.ts
|
|
3416
|
-
import { applyToPoint as
|
|
3760
|
+
import { applyToPoint as applyToPoint31 } from "transformation-matrix";
|
|
3417
3761
|
var DEFAULT_GROUP_COLOR = "rgba(100, 200, 255, 0.6)";
|
|
3418
3762
|
var DEFAULT_STROKE_WIDTH = 0.1;
|
|
3419
3763
|
function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
@@ -3440,7 +3784,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
3440
3784
|
(point) => point && typeof point.x === "number" && typeof point.y === "number"
|
|
3441
3785
|
)) {
|
|
3442
3786
|
const path = outline.map((point, index) => {
|
|
3443
|
-
const [x, y] =
|
|
3787
|
+
const [x, y] = applyToPoint31(transform, [point.x, point.y]);
|
|
3444
3788
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
3445
3789
|
}).join(" ");
|
|
3446
3790
|
return [
|
|
@@ -3462,11 +3806,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
3462
3806
|
}
|
|
3463
3807
|
const halfWidth = width / 2;
|
|
3464
3808
|
const halfHeight = height / 2;
|
|
3465
|
-
const [topLeftX, topLeftY] =
|
|
3809
|
+
const [topLeftX, topLeftY] = applyToPoint31(transform, [
|
|
3466
3810
|
center.x - halfWidth,
|
|
3467
3811
|
center.y + halfHeight
|
|
3468
3812
|
]);
|
|
3469
|
-
const [bottomRightX, bottomRightY] =
|
|
3813
|
+
const [bottomRightX, bottomRightY] = applyToPoint31(transform, [
|
|
3470
3814
|
center.x + halfWidth,
|
|
3471
3815
|
center.y - halfHeight
|
|
3472
3816
|
]);
|
|
@@ -3502,7 +3846,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3502
3846
|
var package_default = {
|
|
3503
3847
|
name: "circuit-to-svg",
|
|
3504
3848
|
type: "module",
|
|
3505
|
-
version: "0.0.
|
|
3849
|
+
version: "0.0.264",
|
|
3506
3850
|
description: "Convert Circuit JSON to SVG",
|
|
3507
3851
|
main: "dist/index.js",
|
|
3508
3852
|
files: [
|
|
@@ -3526,7 +3870,7 @@ var package_default = {
|
|
|
3526
3870
|
"bun-match-svg": "^0.0.12",
|
|
3527
3871
|
esbuild: "^0.20.2",
|
|
3528
3872
|
"performance-now": "^2.1.0",
|
|
3529
|
-
"circuit-json": "^0.0.
|
|
3873
|
+
"circuit-json": "^0.0.304",
|
|
3530
3874
|
react: "19.1.0",
|
|
3531
3875
|
"react-cosmos": "7.0.0",
|
|
3532
3876
|
"react-cosmos-plugin-vite": "7.0.0",
|
|
@@ -3839,7 +4183,9 @@ function convertCircuitJsonToPcbSvg(circuitJson, options) {
|
|
|
3839
4183
|
showPcbGroups: options?.showPcbGroups,
|
|
3840
4184
|
drawPaddingOutsideBoard,
|
|
3841
4185
|
colorMap: colorMap2,
|
|
3842
|
-
showSolderMask: options?.showSolderMask
|
|
4186
|
+
showSolderMask: options?.showSolderMask,
|
|
4187
|
+
showAnchorOffsets: options?.showAnchorOffsets,
|
|
4188
|
+
circuitJson
|
|
3843
4189
|
};
|
|
3844
4190
|
const unsortedSvgObjects = circuitJson.flatMap(
|
|
3845
4191
|
(elm) => createSvgObjects({ elm, circuitJson, ctx })
|
|
@@ -4124,8 +4470,8 @@ function createSvgObjects({
|
|
|
4124
4470
|
}
|
|
4125
4471
|
}
|
|
4126
4472
|
function createSvgObjectFromPcbBoundary(transform, minX, minY, maxX, maxY) {
|
|
4127
|
-
const [x1, y1] =
|
|
4128
|
-
const [x2, y2] =
|
|
4473
|
+
const [x1, y1] = applyToPoint32(transform, [minX, minY]);
|
|
4474
|
+
const [x2, y2] = applyToPoint32(transform, [maxX, maxY]);
|
|
4129
4475
|
const width = Math.abs(x2 - x1);
|
|
4130
4476
|
const height = Math.abs(y2 - y1);
|
|
4131
4477
|
const x = Math.min(x1, x2);
|
|
@@ -4155,14 +4501,14 @@ var circuitJsonToPcbSvg = convertCircuitJsonToPcbSvg;
|
|
|
4155
4501
|
import { stringify as stringify2 } from "svgson";
|
|
4156
4502
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
4157
4503
|
import {
|
|
4158
|
-
applyToPoint as
|
|
4504
|
+
applyToPoint as applyToPoint39,
|
|
4159
4505
|
compose as compose6,
|
|
4160
4506
|
scale as scale3,
|
|
4161
4507
|
translate as translate6
|
|
4162
4508
|
} from "transformation-matrix";
|
|
4163
4509
|
|
|
4164
4510
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-board.ts
|
|
4165
|
-
import { applyToPoint as
|
|
4511
|
+
import { applyToPoint as applyToPoint33 } from "transformation-matrix";
|
|
4166
4512
|
var DEFAULT_BOARD_STYLE = {
|
|
4167
4513
|
fill: "none",
|
|
4168
4514
|
stroke: "rgb(0,0,0)",
|
|
@@ -4174,25 +4520,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
4174
4520
|
let path;
|
|
4175
4521
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
4176
4522
|
path = outline.map((point, index) => {
|
|
4177
|
-
const [x, y] =
|
|
4523
|
+
const [x, y] = applyToPoint33(transform, [point.x, point.y]);
|
|
4178
4524
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
4179
4525
|
}).join(" ");
|
|
4180
4526
|
} else {
|
|
4181
4527
|
const halfWidth = width / 2;
|
|
4182
4528
|
const halfHeight = height / 2;
|
|
4183
|
-
const topLeft =
|
|
4529
|
+
const topLeft = applyToPoint33(transform, [
|
|
4184
4530
|
center.x - halfWidth,
|
|
4185
4531
|
center.y - halfHeight
|
|
4186
4532
|
]);
|
|
4187
|
-
const topRight =
|
|
4533
|
+
const topRight = applyToPoint33(transform, [
|
|
4188
4534
|
center.x + halfWidth,
|
|
4189
4535
|
center.y - halfHeight
|
|
4190
4536
|
]);
|
|
4191
|
-
const bottomRight =
|
|
4537
|
+
const bottomRight = applyToPoint33(transform, [
|
|
4192
4538
|
center.x + halfWidth,
|
|
4193
4539
|
center.y + halfHeight
|
|
4194
4540
|
]);
|
|
4195
|
-
const bottomLeft =
|
|
4541
|
+
const bottomLeft = applyToPoint33(transform, [
|
|
4196
4542
|
center.x - halfWidth,
|
|
4197
4543
|
center.y + halfHeight
|
|
4198
4544
|
]);
|
|
@@ -4218,7 +4564,7 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform, style = {}) {
|
|
|
4218
4564
|
}
|
|
4219
4565
|
|
|
4220
4566
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-component.ts
|
|
4221
|
-
import { applyToPoint as
|
|
4567
|
+
import { applyToPoint as applyToPoint35 } from "transformation-matrix";
|
|
4222
4568
|
|
|
4223
4569
|
// lib/utils/get-sch-font-size.ts
|
|
4224
4570
|
import "transformation-matrix";
|
|
@@ -4244,8 +4590,8 @@ function createSvgObjectsFromAssemblyComponent(params, ctx) {
|
|
|
4244
4590
|
const { center, width, height, rotation = 0, layer = "top" } = elm;
|
|
4245
4591
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
4246
4592
|
return null;
|
|
4247
|
-
const [x, y] =
|
|
4248
|
-
const [pinX, pinY] =
|
|
4593
|
+
const [x, y] = applyToPoint35(transform, [center.x, center.y]);
|
|
4594
|
+
const [pinX, pinY] = applyToPoint35(transform, [portPosition.x, portPosition.y]);
|
|
4249
4595
|
const scaledWidth = width * Math.abs(transform.a);
|
|
4250
4596
|
const scaledHeight = height * Math.abs(transform.d);
|
|
4251
4597
|
const isTopLayer = layer === "top";
|
|
@@ -4407,11 +4753,11 @@ function getRectPathData(w, h, rotation) {
|
|
|
4407
4753
|
}
|
|
4408
4754
|
|
|
4409
4755
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-hole.ts
|
|
4410
|
-
import { applyToPoint as
|
|
4756
|
+
import { applyToPoint as applyToPoint36 } from "transformation-matrix";
|
|
4411
4757
|
var HOLE_COLOR2 = "rgb(190, 190, 190)";
|
|
4412
4758
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
4413
4759
|
const { transform } = ctx;
|
|
4414
|
-
const [x, y] =
|
|
4760
|
+
const [x, y] = applyToPoint36(transform, [hole.x, hole.y]);
|
|
4415
4761
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
4416
4762
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
4417
4763
|
const radius = scaledDiameter / 2;
|
|
@@ -4475,12 +4821,12 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
4475
4821
|
}
|
|
4476
4822
|
|
|
4477
4823
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-plated-hole.ts
|
|
4478
|
-
import { applyToPoint as
|
|
4824
|
+
import { applyToPoint as applyToPoint37 } from "transformation-matrix";
|
|
4479
4825
|
var PAD_COLOR = "rgb(210, 210, 210)";
|
|
4480
4826
|
var HOLE_COLOR3 = "rgb(190, 190, 190)";
|
|
4481
4827
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
4482
4828
|
const { transform } = ctx;
|
|
4483
|
-
const [x, y] =
|
|
4829
|
+
const [x, y] = applyToPoint37(transform, [hole.x, hole.y]);
|
|
4484
4830
|
if (hole.shape === "pill") {
|
|
4485
4831
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
4486
4832
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -4575,7 +4921,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4575
4921
|
const scaledRectPadHeight = circularHole.rect_pad_height * Math.abs(transform.a);
|
|
4576
4922
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4577
4923
|
const holeRadius = scaledHoleDiameter / 2;
|
|
4578
|
-
const [holeCx, holeCy] =
|
|
4924
|
+
const [holeCx, holeCy] = applyToPoint37(transform, [
|
|
4579
4925
|
circularHole.x + circularHole.hole_offset_x,
|
|
4580
4926
|
circularHole.y + circularHole.hole_offset_y
|
|
4581
4927
|
]);
|
|
@@ -4633,7 +4979,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4633
4979
|
const pillHoleWithOffsets = pillHole;
|
|
4634
4980
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
4635
4981
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
4636
|
-
const [holeCenterX, holeCenterY] =
|
|
4982
|
+
const [holeCenterX, holeCenterY] = applyToPoint37(transform, [
|
|
4637
4983
|
pillHole.x + holeOffsetX,
|
|
4638
4984
|
pillHole.y + holeOffsetY
|
|
4639
4985
|
]);
|
|
@@ -4695,7 +5041,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4695
5041
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
4696
5042
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
4697
5043
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
4698
|
-
const [holeCenterX, holeCenterY] =
|
|
5044
|
+
const [holeCenterX, holeCenterY] = applyToPoint37(transform, [
|
|
4699
5045
|
rotatedHole.x + holeOffsetX,
|
|
4700
5046
|
rotatedHole.y + holeOffsetY
|
|
4701
5047
|
]);
|
|
@@ -4751,14 +5097,14 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
4751
5097
|
}
|
|
4752
5098
|
|
|
4753
5099
|
// lib/assembly/svg-object-fns/create-svg-objects-from-assembly-smt-pad.ts
|
|
4754
|
-
import { applyToPoint as
|
|
5100
|
+
import { applyToPoint as applyToPoint38 } from "transformation-matrix";
|
|
4755
5101
|
var PAD_COLOR2 = "rgb(210, 210, 210)";
|
|
4756
5102
|
function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
4757
5103
|
const { transform } = ctx;
|
|
4758
5104
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
4759
5105
|
const width = pad.width * Math.abs(transform.a);
|
|
4760
5106
|
const height = pad.height * Math.abs(transform.d);
|
|
4761
|
-
const [x, y] =
|
|
5107
|
+
const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
|
|
4762
5108
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
4763
5109
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
4764
5110
|
return [
|
|
@@ -4810,7 +5156,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4810
5156
|
const width = pad.width * Math.abs(transform.a);
|
|
4811
5157
|
const height = pad.height * Math.abs(transform.d);
|
|
4812
5158
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4813
|
-
const [x, y] =
|
|
5159
|
+
const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
|
|
4814
5160
|
return [
|
|
4815
5161
|
{
|
|
4816
5162
|
name: "rect",
|
|
@@ -4833,7 +5179,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4833
5179
|
}
|
|
4834
5180
|
if (pad.shape === "circle") {
|
|
4835
5181
|
const radius = pad.radius * Math.abs(transform.a);
|
|
4836
|
-
const [x, y] =
|
|
5182
|
+
const [x, y] = applyToPoint38(transform, [pad.x, pad.y]);
|
|
4837
5183
|
return [
|
|
4838
5184
|
{
|
|
4839
5185
|
name: "circle",
|
|
@@ -4853,7 +5199,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
4853
5199
|
}
|
|
4854
5200
|
if (pad.shape === "polygon") {
|
|
4855
5201
|
const points = (pad.points ?? []).map(
|
|
4856
|
-
(point) =>
|
|
5202
|
+
(point) => applyToPoint38(transform, [point.x, point.y])
|
|
4857
5203
|
);
|
|
4858
5204
|
return [
|
|
4859
5205
|
{
|
|
@@ -5037,8 +5383,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
5037
5383
|
}
|
|
5038
5384
|
}
|
|
5039
5385
|
function createSvgObjectFromAssemblyBoundary(transform, minX, minY, maxX, maxY) {
|
|
5040
|
-
const [x1, y1] =
|
|
5041
|
-
const [x2, y2] =
|
|
5386
|
+
const [x1, y1] = applyToPoint39(transform, [minX, minY]);
|
|
5387
|
+
const [x2, y2] = applyToPoint39(transform, [maxX, maxY]);
|
|
5042
5388
|
const width = Math.abs(x2 - x1);
|
|
5043
5389
|
const height = Math.abs(y2 - y1);
|
|
5044
5390
|
const x = Math.min(x1, x2);
|
|
@@ -5067,7 +5413,7 @@ import {
|
|
|
5067
5413
|
} from "transformation-matrix";
|
|
5068
5414
|
|
|
5069
5415
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-board.ts
|
|
5070
|
-
import { applyToPoint as
|
|
5416
|
+
import { applyToPoint as applyToPoint40 } from "transformation-matrix";
|
|
5071
5417
|
import { su as su4 } from "@tscircuit/circuit-json-util";
|
|
5072
5418
|
var BOARD_FILL_COLOR = "rgb(26, 115, 143)";
|
|
5073
5419
|
var BOARD_STROKE_COLOR = "rgba(0,0,0,0.9)";
|
|
@@ -5081,25 +5427,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
5081
5427
|
let path;
|
|
5082
5428
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
5083
5429
|
path = outline.map((point, index) => {
|
|
5084
|
-
const [x, y] =
|
|
5430
|
+
const [x, y] = applyToPoint40(transform, [point.x, point.y]);
|
|
5085
5431
|
return index === 0 ? `M ${x} ${y}` : `L ${x} ${y}`;
|
|
5086
5432
|
}).join(" ");
|
|
5087
5433
|
} else {
|
|
5088
5434
|
const halfWidth = width / 2;
|
|
5089
5435
|
const halfHeight = height / 2;
|
|
5090
|
-
const topLeft =
|
|
5436
|
+
const topLeft = applyToPoint40(transform, [
|
|
5091
5437
|
center.x - halfWidth,
|
|
5092
5438
|
center.y - halfHeight
|
|
5093
5439
|
]);
|
|
5094
|
-
const topRight =
|
|
5440
|
+
const topRight = applyToPoint40(transform, [
|
|
5095
5441
|
center.x + halfWidth,
|
|
5096
5442
|
center.y - halfHeight
|
|
5097
5443
|
]);
|
|
5098
|
-
const bottomRight =
|
|
5444
|
+
const bottomRight = applyToPoint40(transform, [
|
|
5099
5445
|
center.x + halfWidth,
|
|
5100
5446
|
center.y + halfHeight
|
|
5101
5447
|
]);
|
|
5102
|
-
const bottomLeft =
|
|
5448
|
+
const bottomLeft = applyToPoint40(transform, [
|
|
5103
5449
|
center.x - halfWidth,
|
|
5104
5450
|
center.y + halfHeight
|
|
5105
5451
|
]);
|
|
@@ -5117,10 +5463,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
5117
5463
|
const halfWidth = width2 / 2;
|
|
5118
5464
|
const halfHeight = height2 / 2;
|
|
5119
5465
|
const [tl, tr, br, bl] = [
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5466
|
+
applyToPoint40(transform, [x - halfWidth, y - halfHeight]),
|
|
5467
|
+
applyToPoint40(transform, [x + halfWidth, y - halfHeight]),
|
|
5468
|
+
applyToPoint40(transform, [x + halfWidth, y + halfHeight]),
|
|
5469
|
+
applyToPoint40(transform, [x - halfWidth, y + halfHeight])
|
|
5124
5470
|
];
|
|
5125
5471
|
path += ` M ${tl[0]} ${tl[1]} L ${tr[0]} ${tr[1]} L ${br[0]} ${br[1]} L ${bl[0]} ${bl[1]} Z`;
|
|
5126
5472
|
} else if (cutout.shape === "circle") {
|
|
@@ -5170,7 +5516,7 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
5170
5516
|
|
|
5171
5517
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-component.ts
|
|
5172
5518
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
5173
|
-
import { applyToPoint as
|
|
5519
|
+
import { applyToPoint as applyToPoint41 } from "transformation-matrix";
|
|
5174
5520
|
var COMPONENT_FILL_COLOR = "rgba(120, 120, 120, 0.6)";
|
|
5175
5521
|
var COMPONENT_LABEL_COLOR = "rgba(255, 255, 255, 0.9)";
|
|
5176
5522
|
function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
@@ -5180,7 +5526,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
5180
5526
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
5181
5527
|
return [];
|
|
5182
5528
|
}
|
|
5183
|
-
const [x, y] =
|
|
5529
|
+
const [x, y] = applyToPoint41(transform, [center.x, center.y]);
|
|
5184
5530
|
const scaledWidth = width * Math.abs(transform.a);
|
|
5185
5531
|
const scaledHeight = height * Math.abs(transform.d);
|
|
5186
5532
|
const transformStr = `translate(${x}, ${y})`;
|
|
@@ -5241,11 +5587,11 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
5241
5587
|
}
|
|
5242
5588
|
|
|
5243
5589
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-hole.ts
|
|
5244
|
-
import { applyToPoint as
|
|
5590
|
+
import { applyToPoint as applyToPoint42 } from "transformation-matrix";
|
|
5245
5591
|
var HOLE_COLOR4 = "rgb(50, 50, 50)";
|
|
5246
5592
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
5247
5593
|
const { transform } = ctx;
|
|
5248
|
-
const [x, y] =
|
|
5594
|
+
const [x, y] = applyToPoint42(transform, [hole.x, hole.y]);
|
|
5249
5595
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
5250
5596
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
5251
5597
|
const radius = scaledDiameter / 2;
|
|
@@ -5309,12 +5655,12 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
5309
5655
|
}
|
|
5310
5656
|
|
|
5311
5657
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-plated-hole.ts
|
|
5312
|
-
import { applyToPoint as
|
|
5658
|
+
import { applyToPoint as applyToPoint43 } from "transformation-matrix";
|
|
5313
5659
|
var PAD_COLOR3 = "rgb(218, 165, 32)";
|
|
5314
5660
|
var HOLE_COLOR5 = "rgb(40, 40, 40)";
|
|
5315
5661
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
5316
5662
|
const { transform } = ctx;
|
|
5317
|
-
const [x, y] =
|
|
5663
|
+
const [x, y] = applyToPoint43(transform, [hole.x, hole.y]);
|
|
5318
5664
|
if (hole.shape === "pill") {
|
|
5319
5665
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
5320
5666
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
@@ -5549,14 +5895,14 @@ function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
|
5549
5895
|
}
|
|
5550
5896
|
|
|
5551
5897
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-smt-pad.ts
|
|
5552
|
-
import { applyToPoint as
|
|
5898
|
+
import { applyToPoint as applyToPoint44 } from "transformation-matrix";
|
|
5553
5899
|
var PAD_COLOR4 = "rgb(218, 165, 32)";
|
|
5554
5900
|
function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
5555
5901
|
const { transform } = ctx;
|
|
5556
5902
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
5557
5903
|
const width = pad.width * Math.abs(transform.a);
|
|
5558
5904
|
const height = pad.height * Math.abs(transform.d);
|
|
5559
|
-
const [x, y] =
|
|
5905
|
+
const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
|
|
5560
5906
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
5561
5907
|
return [
|
|
5562
5908
|
{
|
|
@@ -5599,7 +5945,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5599
5945
|
const width = pad.width * Math.abs(transform.a);
|
|
5600
5946
|
const height = pad.height * Math.abs(transform.d);
|
|
5601
5947
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5602
|
-
const [x, y] =
|
|
5948
|
+
const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
|
|
5603
5949
|
return [
|
|
5604
5950
|
{
|
|
5605
5951
|
name: "rect",
|
|
@@ -5622,7 +5968,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5622
5968
|
}
|
|
5623
5969
|
if (pad.shape === "circle") {
|
|
5624
5970
|
const radius = pad.radius * Math.abs(transform.a);
|
|
5625
|
-
const [x, y] =
|
|
5971
|
+
const [x, y] = applyToPoint44(transform, [pad.x, pad.y]);
|
|
5626
5972
|
return [
|
|
5627
5973
|
{
|
|
5628
5974
|
name: "circle",
|
|
@@ -5642,7 +5988,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5642
5988
|
}
|
|
5643
5989
|
if (pad.shape === "polygon") {
|
|
5644
5990
|
const points = (pad.points ?? []).map(
|
|
5645
|
-
(point) =>
|
|
5991
|
+
(point) => applyToPoint44(transform, [point.x, point.y])
|
|
5646
5992
|
);
|
|
5647
5993
|
return [
|
|
5648
5994
|
{
|
|
@@ -5663,7 +6009,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
5663
6009
|
}
|
|
5664
6010
|
|
|
5665
6011
|
// lib/pinout/svg-object-fns/create-svg-objects-from-pinout-port.ts
|
|
5666
|
-
import { applyToPoint as
|
|
6012
|
+
import { applyToPoint as applyToPoint45 } from "transformation-matrix";
|
|
5667
6013
|
import { calculateElbow } from "calculate-elbow";
|
|
5668
6014
|
|
|
5669
6015
|
// lib/pinout/svg-object-fns/pinout-label-box.ts
|
|
@@ -5740,7 +6086,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5740
6086
|
const label_info = ctx.label_positions.get(pcb_port.pcb_port_id);
|
|
5741
6087
|
if (!label_info) return [];
|
|
5742
6088
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
5743
|
-
const [port_x, port_y] =
|
|
6089
|
+
const [port_x, port_y] = applyToPoint45(ctx.transform, [pcb_port.x, pcb_port.y]);
|
|
5744
6090
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
5745
6091
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
5746
6092
|
const elbow_path = calculateElbow(
|
|
@@ -5881,7 +6227,7 @@ function createSvgObjectsFromPinoutPort(pcb_port, ctx) {
|
|
|
5881
6227
|
}
|
|
5882
6228
|
|
|
5883
6229
|
// lib/pinout/calculate-label-positions.ts
|
|
5884
|
-
import { applyToPoint as
|
|
6230
|
+
import { applyToPoint as applyToPoint46 } from "transformation-matrix";
|
|
5885
6231
|
|
|
5886
6232
|
// lib/pinout/constants.ts
|
|
5887
6233
|
var LABEL_RECT_HEIGHT_BASE_MM = 1.6;
|
|
@@ -5919,7 +6265,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5919
6265
|
);
|
|
5920
6266
|
const mapToEdgePort = (pinout_label) => ({
|
|
5921
6267
|
pcb_port: pinout_label.pcb_port,
|
|
5922
|
-
y:
|
|
6268
|
+
y: applyToPoint46(transform, [
|
|
5923
6269
|
pinout_label.pcb_port.x,
|
|
5924
6270
|
pinout_label.pcb_port.y
|
|
5925
6271
|
])[1],
|
|
@@ -5934,7 +6280,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5934
6280
|
} else {
|
|
5935
6281
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
5936
6282
|
pcb_port: pinout_label.pcb_port,
|
|
5937
|
-
y:
|
|
6283
|
+
y: applyToPoint46(transform, [
|
|
5938
6284
|
pinout_label.pcb_port.x,
|
|
5939
6285
|
pinout_label.pcb_port.y
|
|
5940
6286
|
])[1],
|
|
@@ -5942,7 +6288,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
5942
6288
|
})).sort((a, b) => a.y - b.y);
|
|
5943
6289
|
}
|
|
5944
6290
|
if (edge_ports.length === 0) return;
|
|
5945
|
-
const board_edge_x =
|
|
6291
|
+
const board_edge_x = applyToPoint46(transform, [
|
|
5946
6292
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
5947
6293
|
0
|
|
5948
6294
|
])[0];
|
|
@@ -6364,14 +6710,14 @@ import {
|
|
|
6364
6710
|
} from "transformation-matrix";
|
|
6365
6711
|
|
|
6366
6712
|
// lib/sch/draw-schematic-grid.ts
|
|
6367
|
-
import { applyToPoint as
|
|
6713
|
+
import { applyToPoint as applyToPoint47 } from "transformation-matrix";
|
|
6368
6714
|
function drawSchematicGrid(params) {
|
|
6369
6715
|
const { minX, minY, maxX, maxY } = params.bounds;
|
|
6370
6716
|
const cellSize = params.cellSize ?? 1;
|
|
6371
6717
|
const labelCells = params.labelCells ?? false;
|
|
6372
6718
|
const gridLines = [];
|
|
6373
6719
|
const transformPoint = (x, y) => {
|
|
6374
|
-
const [transformedX, transformedY] =
|
|
6720
|
+
const [transformedX, transformedY] = applyToPoint47(params.transform, [x, y]);
|
|
6375
6721
|
return { x: transformedX, y: transformedY };
|
|
6376
6722
|
};
|
|
6377
6723
|
for (let x = Math.floor(minX); x <= Math.ceil(maxX); x += cellSize) {
|
|
@@ -6452,15 +6798,15 @@ function drawSchematicGrid(params) {
|
|
|
6452
6798
|
}
|
|
6453
6799
|
|
|
6454
6800
|
// lib/sch/draw-schematic-labeled-points.ts
|
|
6455
|
-
import { applyToPoint as
|
|
6801
|
+
import { applyToPoint as applyToPoint48 } from "transformation-matrix";
|
|
6456
6802
|
function drawSchematicLabeledPoints(params) {
|
|
6457
6803
|
const { points, transform } = params;
|
|
6458
6804
|
const labeledPointsGroup = [];
|
|
6459
6805
|
for (const point of points) {
|
|
6460
|
-
const [x1, y1] =
|
|
6461
|
-
const [x2, y2] =
|
|
6462
|
-
const [x3, y3] =
|
|
6463
|
-
const [x4, y4] =
|
|
6806
|
+
const [x1, y1] = applyToPoint48(transform, [point.x - 0.1, point.y - 0.1]);
|
|
6807
|
+
const [x2, y2] = applyToPoint48(transform, [point.x + 0.1, point.y + 0.1]);
|
|
6808
|
+
const [x3, y3] = applyToPoint48(transform, [point.x - 0.1, point.y + 0.1]);
|
|
6809
|
+
const [x4, y4] = applyToPoint48(transform, [point.x + 0.1, point.y - 0.1]);
|
|
6464
6810
|
labeledPointsGroup.push({
|
|
6465
6811
|
name: "path",
|
|
6466
6812
|
type: "element",
|
|
@@ -6471,7 +6817,7 @@ function drawSchematicLabeledPoints(params) {
|
|
|
6471
6817
|
"stroke-opacity": "0.7"
|
|
6472
6818
|
}
|
|
6473
6819
|
});
|
|
6474
|
-
const [labelX, labelY] =
|
|
6820
|
+
const [labelX, labelY] = applyToPoint48(transform, [
|
|
6475
6821
|
point.x + 0.15,
|
|
6476
6822
|
point.y - 0.15
|
|
6477
6823
|
]);
|
|
@@ -7565,7 +7911,7 @@ import { su as su7 } from "@tscircuit/circuit-json-util";
|
|
|
7565
7911
|
import { symbols } from "schematic-symbols";
|
|
7566
7912
|
import "svgson";
|
|
7567
7913
|
import {
|
|
7568
|
-
applyToPoint as
|
|
7914
|
+
applyToPoint as applyToPoint50,
|
|
7569
7915
|
compose as compose9
|
|
7570
7916
|
} from "transformation-matrix";
|
|
7571
7917
|
|
|
@@ -7649,13 +7995,13 @@ function pointPairsToMatrix(a1, a2, b1, b2) {
|
|
|
7649
7995
|
}
|
|
7650
7996
|
|
|
7651
7997
|
// lib/sch/svg-object-fns/create-svg-error-text.ts
|
|
7652
|
-
import { applyToPoint as
|
|
7998
|
+
import { applyToPoint as applyToPoint49 } from "transformation-matrix";
|
|
7653
7999
|
var createSvgSchErrorText = ({
|
|
7654
8000
|
text,
|
|
7655
8001
|
realCenter,
|
|
7656
8002
|
realToScreenTransform
|
|
7657
8003
|
}) => {
|
|
7658
|
-
const screenCenter =
|
|
8004
|
+
const screenCenter = applyToPoint49(realToScreenTransform, realCenter);
|
|
7659
8005
|
return {
|
|
7660
8006
|
type: "element",
|
|
7661
8007
|
name: "text",
|
|
@@ -7764,11 +8110,11 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7764
8110
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.y))),
|
|
7765
8111
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.y)))
|
|
7766
8112
|
};
|
|
7767
|
-
const [screenMinX, screenMinY] =
|
|
8113
|
+
const [screenMinX, screenMinY] = applyToPoint50(
|
|
7768
8114
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7769
8115
|
[bounds.minX, bounds.minY]
|
|
7770
8116
|
);
|
|
7771
|
-
const [screenMaxX, screenMaxY] =
|
|
8117
|
+
const [screenMaxX, screenMaxY] = applyToPoint50(
|
|
7772
8118
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7773
8119
|
[bounds.maxX, bounds.maxY]
|
|
7774
8120
|
);
|
|
@@ -7797,7 +8143,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7797
8143
|
name: "path",
|
|
7798
8144
|
attributes: {
|
|
7799
8145
|
d: points.map((p, i) => {
|
|
7800
|
-
const [x, y] =
|
|
8146
|
+
const [x, y] = applyToPoint50(
|
|
7801
8147
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7802
8148
|
[p.x, p.y]
|
|
7803
8149
|
);
|
|
@@ -7813,7 +8159,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7813
8159
|
});
|
|
7814
8160
|
}
|
|
7815
8161
|
for (const text of texts) {
|
|
7816
|
-
const screenTextPos =
|
|
8162
|
+
const screenTextPos = applyToPoint50(
|
|
7817
8163
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7818
8164
|
text
|
|
7819
8165
|
);
|
|
@@ -7865,7 +8211,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7865
8211
|
});
|
|
7866
8212
|
}
|
|
7867
8213
|
for (const box of boxes) {
|
|
7868
|
-
const screenBoxPos =
|
|
8214
|
+
const screenBoxPos = applyToPoint50(
|
|
7869
8215
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7870
8216
|
box
|
|
7871
8217
|
);
|
|
@@ -7889,7 +8235,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7889
8235
|
}
|
|
7890
8236
|
for (const port of symbol.ports) {
|
|
7891
8237
|
if (connectedSymbolPorts.has(port)) continue;
|
|
7892
|
-
const screenPortPos =
|
|
8238
|
+
const screenPortPos = applyToPoint50(
|
|
7893
8239
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7894
8240
|
port
|
|
7895
8241
|
);
|
|
@@ -7909,7 +8255,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7909
8255
|
});
|
|
7910
8256
|
}
|
|
7911
8257
|
for (const circle of circles) {
|
|
7912
|
-
const screenCirclePos =
|
|
8258
|
+
const screenCirclePos = applyToPoint50(
|
|
7913
8259
|
compose9(realToScreenTransform, transformFromSymbolToReal),
|
|
7914
8260
|
circle
|
|
7915
8261
|
);
|
|
@@ -7936,14 +8282,14 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
7936
8282
|
import { su as su10 } from "@tscircuit/circuit-json-util";
|
|
7937
8283
|
import "schematic-symbols";
|
|
7938
8284
|
import "svgson";
|
|
7939
|
-
import { applyToPoint as
|
|
8285
|
+
import { applyToPoint as applyToPoint56 } from "transformation-matrix";
|
|
7940
8286
|
|
|
7941
8287
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-port-on-box.ts
|
|
7942
8288
|
import "transformation-matrix";
|
|
7943
8289
|
import "@tscircuit/circuit-json-util";
|
|
7944
8290
|
|
|
7945
8291
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-box-line.ts
|
|
7946
|
-
import { applyToPoint as
|
|
8292
|
+
import { applyToPoint as applyToPoint51 } from "transformation-matrix";
|
|
7947
8293
|
import { su as su8 } from "@tscircuit/circuit-json-util";
|
|
7948
8294
|
var PIN_CIRCLE_RADIUS_MM = 0.02;
|
|
7949
8295
|
var createArrow = (tip, angle, size, color, strokeWidth) => {
|
|
@@ -7996,8 +8342,8 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
7996
8342
|
realEdgePos.y += realPinLineLength;
|
|
7997
8343
|
break;
|
|
7998
8344
|
}
|
|
7999
|
-
const screenSchPortPos =
|
|
8000
|
-
const screenRealEdgePos =
|
|
8345
|
+
const screenSchPortPos = applyToPoint51(transform, schPort.center);
|
|
8346
|
+
const screenRealEdgePos = applyToPoint51(transform, realEdgePos);
|
|
8001
8347
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
8002
8348
|
const realLineEnd = { ...schPort.center };
|
|
8003
8349
|
if (!isConnected) {
|
|
@@ -8016,7 +8362,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
8016
8362
|
break;
|
|
8017
8363
|
}
|
|
8018
8364
|
}
|
|
8019
|
-
const screenLineEnd =
|
|
8365
|
+
const screenLineEnd = applyToPoint51(transform, realLineEnd);
|
|
8020
8366
|
svgObjects.push({
|
|
8021
8367
|
name: "line",
|
|
8022
8368
|
type: "element",
|
|
@@ -8137,7 +8483,7 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
8137
8483
|
};
|
|
8138
8484
|
|
|
8139
8485
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-number-text.ts
|
|
8140
|
-
import { applyToPoint as
|
|
8486
|
+
import { applyToPoint as applyToPoint52 } from "transformation-matrix";
|
|
8141
8487
|
var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
8142
8488
|
const svgObjects = [];
|
|
8143
8489
|
const { schPort, schComponent, transform, circuitJson } = params;
|
|
@@ -8155,7 +8501,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
8155
8501
|
} else {
|
|
8156
8502
|
realPinNumberPos.y += 0.02;
|
|
8157
8503
|
}
|
|
8158
|
-
const screenPinNumberTextPos =
|
|
8504
|
+
const screenPinNumberTextPos = applyToPoint52(transform, realPinNumberPos);
|
|
8159
8505
|
svgObjects.push({
|
|
8160
8506
|
name: "text",
|
|
8161
8507
|
type: "element",
|
|
@@ -8185,7 +8531,7 @@ var createSvgObjectsForSchPortPinNumberText = (params) => {
|
|
|
8185
8531
|
};
|
|
8186
8532
|
|
|
8187
8533
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-pin-label.ts
|
|
8188
|
-
import { applyToPoint as
|
|
8534
|
+
import { applyToPoint as applyToPoint53 } from "transformation-matrix";
|
|
8189
8535
|
var LABEL_DIST_FROM_EDGE_MM = 0.1;
|
|
8190
8536
|
var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
8191
8537
|
const svgObjects = [];
|
|
@@ -8199,7 +8545,7 @@ var createSvgObjectsForSchPortPinLabel = (params) => {
|
|
|
8199
8545
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
8200
8546
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
8201
8547
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
8202
|
-
const screenPinNumberTextPos =
|
|
8548
|
+
const screenPinNumberTextPos = applyToPoint53(transform, realPinNumberPos);
|
|
8203
8549
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
8204
8550
|
if (!label) return [];
|
|
8205
8551
|
const isNegated = label.startsWith("N_");
|
|
@@ -8247,13 +8593,13 @@ var createSvgObjectsFromSchPortOnBox = (params) => {
|
|
|
8247
8593
|
};
|
|
8248
8594
|
|
|
8249
8595
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-text.ts
|
|
8250
|
-
import { applyToPoint as
|
|
8596
|
+
import { applyToPoint as applyToPoint55 } from "transformation-matrix";
|
|
8251
8597
|
var createSvgSchText = ({
|
|
8252
8598
|
elm,
|
|
8253
8599
|
transform,
|
|
8254
8600
|
colorMap: colorMap2
|
|
8255
8601
|
}) => {
|
|
8256
|
-
const center =
|
|
8602
|
+
const center = applyToPoint55(transform, elm.position);
|
|
8257
8603
|
const textAnchorMap = {
|
|
8258
8604
|
center: "middle",
|
|
8259
8605
|
center_right: "end",
|
|
@@ -8337,11 +8683,11 @@ var createSvgObjectsFromSchematicComponentWithBox = ({
|
|
|
8337
8683
|
colorMap: colorMap2
|
|
8338
8684
|
}) => {
|
|
8339
8685
|
const svgObjects = [];
|
|
8340
|
-
const componentScreenTopLeft =
|
|
8686
|
+
const componentScreenTopLeft = applyToPoint56(transform, {
|
|
8341
8687
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
8342
8688
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
8343
8689
|
});
|
|
8344
|
-
const componentScreenBottomRight =
|
|
8690
|
+
const componentScreenBottomRight = applyToPoint56(transform, {
|
|
8345
8691
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
8346
8692
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
8347
8693
|
});
|
|
@@ -8427,13 +8773,13 @@ function createSvgObjectsFromSchematicComponent(params) {
|
|
|
8427
8773
|
}
|
|
8428
8774
|
|
|
8429
8775
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-voltage-probe.ts
|
|
8430
|
-
import { applyToPoint as
|
|
8776
|
+
import { applyToPoint as applyToPoint57 } from "transformation-matrix";
|
|
8431
8777
|
function createSvgObjectsFromSchVoltageProbe({
|
|
8432
8778
|
probe,
|
|
8433
8779
|
transform,
|
|
8434
8780
|
colorMap: colorMap2
|
|
8435
8781
|
}) {
|
|
8436
|
-
const [screenX, screenY] =
|
|
8782
|
+
const [screenX, screenY] = applyToPoint57(transform, [
|
|
8437
8783
|
probe.position.x,
|
|
8438
8784
|
probe.position.y
|
|
8439
8785
|
]);
|
|
@@ -8493,17 +8839,17 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
8493
8839
|
}
|
|
8494
8840
|
|
|
8495
8841
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-debug-object.ts
|
|
8496
|
-
import { applyToPoint as
|
|
8842
|
+
import { applyToPoint as applyToPoint58 } from "transformation-matrix";
|
|
8497
8843
|
function createSvgObjectsFromSchDebugObject({
|
|
8498
8844
|
debugObject,
|
|
8499
8845
|
transform
|
|
8500
8846
|
}) {
|
|
8501
8847
|
if (debugObject.shape === "rect") {
|
|
8502
|
-
let [screenLeft, screenTop] =
|
|
8848
|
+
let [screenLeft, screenTop] = applyToPoint58(transform, [
|
|
8503
8849
|
debugObject.center.x - debugObject.size.width / 2,
|
|
8504
8850
|
debugObject.center.y - debugObject.size.height / 2
|
|
8505
8851
|
]);
|
|
8506
|
-
let [screenRight, screenBottom] =
|
|
8852
|
+
let [screenRight, screenBottom] = applyToPoint58(transform, [
|
|
8507
8853
|
debugObject.center.x + debugObject.size.width / 2,
|
|
8508
8854
|
debugObject.center.y + debugObject.size.height / 2
|
|
8509
8855
|
]);
|
|
@@ -8513,7 +8859,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8513
8859
|
];
|
|
8514
8860
|
const width = Math.abs(screenRight - screenLeft);
|
|
8515
8861
|
const height = Math.abs(screenBottom - screenTop);
|
|
8516
|
-
const [screenCenterX, screenCenterY] =
|
|
8862
|
+
const [screenCenterX, screenCenterY] = applyToPoint58(transform, [
|
|
8517
8863
|
debugObject.center.x,
|
|
8518
8864
|
debugObject.center.y
|
|
8519
8865
|
]);
|
|
@@ -8559,11 +8905,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8559
8905
|
];
|
|
8560
8906
|
}
|
|
8561
8907
|
if (debugObject.shape === "line") {
|
|
8562
|
-
const [screenStartX, screenStartY] =
|
|
8908
|
+
const [screenStartX, screenStartY] = applyToPoint58(transform, [
|
|
8563
8909
|
debugObject.start.x,
|
|
8564
8910
|
debugObject.start.y
|
|
8565
8911
|
]);
|
|
8566
|
-
const [screenEndX, screenEndY] =
|
|
8912
|
+
const [screenEndX, screenEndY] = applyToPoint58(transform, [
|
|
8567
8913
|
debugObject.end.x,
|
|
8568
8914
|
debugObject.end.y
|
|
8569
8915
|
]);
|
|
@@ -8613,7 +8959,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
8613
8959
|
}
|
|
8614
8960
|
|
|
8615
8961
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-trace.ts
|
|
8616
|
-
import { applyToPoint as
|
|
8962
|
+
import { applyToPoint as applyToPoint59 } from "transformation-matrix";
|
|
8617
8963
|
function createSchematicTrace({
|
|
8618
8964
|
trace,
|
|
8619
8965
|
transform,
|
|
@@ -8627,11 +8973,11 @@ function createSchematicTrace({
|
|
|
8627
8973
|
for (let edgeIndex = 0; edgeIndex < edges.length; edgeIndex++) {
|
|
8628
8974
|
const edge = edges[edgeIndex];
|
|
8629
8975
|
if (edge.is_crossing) continue;
|
|
8630
|
-
const [screenFromX, screenFromY] =
|
|
8976
|
+
const [screenFromX, screenFromY] = applyToPoint59(transform, [
|
|
8631
8977
|
edge.from.x,
|
|
8632
8978
|
edge.from.y
|
|
8633
8979
|
]);
|
|
8634
|
-
const [screenToX, screenToY] =
|
|
8980
|
+
const [screenToX, screenToY] = applyToPoint59(transform, [
|
|
8635
8981
|
edge.to.x,
|
|
8636
8982
|
edge.to.y
|
|
8637
8983
|
]);
|
|
@@ -8675,11 +9021,11 @@ function createSchematicTrace({
|
|
|
8675
9021
|
}
|
|
8676
9022
|
for (const edge of edges) {
|
|
8677
9023
|
if (!edge.is_crossing) continue;
|
|
8678
|
-
const [screenFromX, screenFromY] =
|
|
9024
|
+
const [screenFromX, screenFromY] = applyToPoint59(transform, [
|
|
8679
9025
|
edge.from.x,
|
|
8680
9026
|
edge.from.y
|
|
8681
9027
|
]);
|
|
8682
|
-
const [screenToX, screenToY] =
|
|
9028
|
+
const [screenToX, screenToY] = applyToPoint59(transform, [
|
|
8683
9029
|
edge.to.x,
|
|
8684
9030
|
edge.to.y
|
|
8685
9031
|
]);
|
|
@@ -8723,7 +9069,7 @@ function createSchematicTrace({
|
|
|
8723
9069
|
}
|
|
8724
9070
|
if (trace.junctions) {
|
|
8725
9071
|
for (const junction of trace.junctions) {
|
|
8726
|
-
const [screenX, screenY] =
|
|
9072
|
+
const [screenX, screenY] = applyToPoint59(transform, [
|
|
8727
9073
|
junction.x,
|
|
8728
9074
|
junction.y
|
|
8729
9075
|
]);
|
|
@@ -8778,7 +9124,7 @@ function createSchematicTrace({
|
|
|
8778
9124
|
|
|
8779
9125
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label.ts
|
|
8780
9126
|
import {
|
|
8781
|
-
applyToPoint as
|
|
9127
|
+
applyToPoint as applyToPoint61,
|
|
8782
9128
|
compose as compose11,
|
|
8783
9129
|
rotate as rotate6,
|
|
8784
9130
|
scale as scale6,
|
|
@@ -8787,7 +9133,7 @@ import {
|
|
|
8787
9133
|
|
|
8788
9134
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-net-label-with-symbol.ts
|
|
8789
9135
|
import {
|
|
8790
|
-
applyToPoint as
|
|
9136
|
+
applyToPoint as applyToPoint60,
|
|
8791
9137
|
compose as compose10,
|
|
8792
9138
|
rotate as rotate5,
|
|
8793
9139
|
scale as scale5,
|
|
@@ -8862,7 +9208,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8862
9208
|
x: symbolBounds.minX,
|
|
8863
9209
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
8864
9210
|
};
|
|
8865
|
-
const rotatedSymbolEnd =
|
|
9211
|
+
const rotatedSymbolEnd = applyToPoint60(rotationMatrix, symbolEndPoint);
|
|
8866
9212
|
const symbolToRealTransform = compose10(
|
|
8867
9213
|
translate10(
|
|
8868
9214
|
realAnchorPosition.x - rotatedSymbolEnd.x,
|
|
@@ -8872,11 +9218,11 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8872
9218
|
scale5(1)
|
|
8873
9219
|
// Use full symbol size
|
|
8874
9220
|
);
|
|
8875
|
-
const [screenMinX, screenMinY] =
|
|
9221
|
+
const [screenMinX, screenMinY] = applyToPoint60(
|
|
8876
9222
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8877
9223
|
[bounds.minX, bounds.minY]
|
|
8878
9224
|
);
|
|
8879
|
-
const [screenMaxX, screenMaxY] =
|
|
9225
|
+
const [screenMaxX, screenMaxY] = applyToPoint60(
|
|
8880
9226
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8881
9227
|
[bounds.maxX, bounds.maxY]
|
|
8882
9228
|
);
|
|
@@ -8900,7 +9246,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8900
9246
|
});
|
|
8901
9247
|
for (const path of symbolPaths) {
|
|
8902
9248
|
const symbolPath = path.points.map((p, i) => {
|
|
8903
|
-
const [x, y] =
|
|
9249
|
+
const [x, y] = applyToPoint60(
|
|
8904
9250
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8905
9251
|
[p.x, p.y]
|
|
8906
9252
|
);
|
|
@@ -8921,7 +9267,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8921
9267
|
});
|
|
8922
9268
|
}
|
|
8923
9269
|
for (const text of symbolTexts) {
|
|
8924
|
-
const screenTextPos =
|
|
9270
|
+
const screenTextPos = applyToPoint60(
|
|
8925
9271
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8926
9272
|
text
|
|
8927
9273
|
);
|
|
@@ -8963,7 +9309,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8963
9309
|
});
|
|
8964
9310
|
}
|
|
8965
9311
|
for (const box of symbolBoxes) {
|
|
8966
|
-
const screenBoxPos =
|
|
9312
|
+
const screenBoxPos = applyToPoint60(
|
|
8967
9313
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8968
9314
|
box
|
|
8969
9315
|
);
|
|
@@ -8986,7 +9332,7 @@ var createSvgObjectsForSchNetLabelWithSymbol = ({
|
|
|
8986
9332
|
});
|
|
8987
9333
|
}
|
|
8988
9334
|
for (const circle of symbolCircles) {
|
|
8989
|
-
const screenCirclePos =
|
|
9335
|
+
const screenCirclePos = applyToPoint60(
|
|
8990
9336
|
compose10(realToScreenTransform, symbolToRealTransform),
|
|
8991
9337
|
circle
|
|
8992
9338
|
);
|
|
@@ -9031,14 +9377,14 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
9031
9377
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
9032
9378
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
9033
9379
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
9034
|
-
const screenCenter =
|
|
9380
|
+
const screenCenter = applyToPoint61(realToScreenTransform, schNetLabel.center);
|
|
9035
9381
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(
|
|
9036
9382
|
schNetLabel.anchor_side
|
|
9037
9383
|
);
|
|
9038
9384
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
9039
9385
|
screenTextGrowthVec.y *= -1;
|
|
9040
9386
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
9041
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
9387
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint61(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
9042
9388
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
9043
9389
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
9044
9390
|
};
|
|
@@ -9079,7 +9425,7 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
9079
9425
|
y: -0.6
|
|
9080
9426
|
}
|
|
9081
9427
|
].map(
|
|
9082
|
-
(fontRelativePoint) =>
|
|
9428
|
+
(fontRelativePoint) => applyToPoint61(
|
|
9083
9429
|
compose11(
|
|
9084
9430
|
realToScreenTransform,
|
|
9085
9431
|
translate11(realAnchorPosition.x, realAnchorPosition.y),
|
|
@@ -9156,17 +9502,17 @@ var createSvgObjectsForSchNetLabel = ({
|
|
|
9156
9502
|
};
|
|
9157
9503
|
|
|
9158
9504
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-box.ts
|
|
9159
|
-
import { applyToPoint as
|
|
9505
|
+
import { applyToPoint as applyToPoint62 } from "transformation-matrix";
|
|
9160
9506
|
var createSvgObjectsFromSchematicBox = ({
|
|
9161
9507
|
schematicBox,
|
|
9162
9508
|
transform,
|
|
9163
9509
|
colorMap: colorMap2
|
|
9164
9510
|
}) => {
|
|
9165
|
-
const topLeft =
|
|
9511
|
+
const topLeft = applyToPoint62(transform, {
|
|
9166
9512
|
x: schematicBox.x,
|
|
9167
9513
|
y: schematicBox.y
|
|
9168
9514
|
});
|
|
9169
|
-
const bottomRight =
|
|
9515
|
+
const bottomRight = applyToPoint62(transform, {
|
|
9170
9516
|
x: schematicBox.x + schematicBox.width,
|
|
9171
9517
|
y: schematicBox.y + schematicBox.height
|
|
9172
9518
|
});
|
|
@@ -9202,7 +9548,7 @@ var createSvgObjectsFromSchematicBox = ({
|
|
|
9202
9548
|
};
|
|
9203
9549
|
|
|
9204
9550
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-table.ts
|
|
9205
|
-
import { applyToPoint as
|
|
9551
|
+
import { applyToPoint as applyToPoint63 } from "transformation-matrix";
|
|
9206
9552
|
var createSvgObjectsFromSchematicTable = ({
|
|
9207
9553
|
schematicTable,
|
|
9208
9554
|
transform,
|
|
@@ -9235,11 +9581,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
9235
9581
|
const svgObjects = [];
|
|
9236
9582
|
const borderStrokeWidth = border_width * Math.abs(transform.a);
|
|
9237
9583
|
const gridStrokeWidth = getSchStrokeSize(transform);
|
|
9238
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
9584
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint63(transform, [
|
|
9239
9585
|
topLeftX,
|
|
9240
9586
|
topLeftY
|
|
9241
9587
|
]);
|
|
9242
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
9588
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint63(transform, [
|
|
9243
9589
|
topLeftX + totalWidth,
|
|
9244
9590
|
topLeftY - totalHeight
|
|
9245
9591
|
]);
|
|
@@ -9271,8 +9617,8 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
9271
9617
|
(cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j && cell.end_row_index >= j
|
|
9272
9618
|
);
|
|
9273
9619
|
if (!isMerged) {
|
|
9274
|
-
const start =
|
|
9275
|
-
const end =
|
|
9620
|
+
const start = applyToPoint63(transform, { x: currentX, y: segmentStartY });
|
|
9621
|
+
const end = applyToPoint63(transform, { x: currentX, y: segmentEndY });
|
|
9276
9622
|
svgObjects.push({
|
|
9277
9623
|
name: "line",
|
|
9278
9624
|
type: "element",
|
|
@@ -9301,11 +9647,11 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
9301
9647
|
(cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j && cell.end_column_index >= j
|
|
9302
9648
|
);
|
|
9303
9649
|
if (!isMerged) {
|
|
9304
|
-
const start =
|
|
9650
|
+
const start = applyToPoint63(transform, {
|
|
9305
9651
|
x: segmentStartX,
|
|
9306
9652
|
y: currentY
|
|
9307
9653
|
});
|
|
9308
|
-
const end =
|
|
9654
|
+
const end = applyToPoint63(transform, { x: segmentEndX, y: currentY });
|
|
9309
9655
|
svgObjects.push({
|
|
9310
9656
|
name: "line",
|
|
9311
9657
|
type: "element",
|
|
@@ -9347,7 +9693,7 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
9347
9693
|
} else if (vertical_align === "bottom") {
|
|
9348
9694
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
9349
9695
|
}
|
|
9350
|
-
const screenTextAnchorPos =
|
|
9696
|
+
const screenTextAnchorPos = applyToPoint63(transform, realTextAnchorPos);
|
|
9351
9697
|
const fontSize = getSchScreenFontSize(
|
|
9352
9698
|
transform,
|
|
9353
9699
|
"reference_designator",
|
|
@@ -9403,13 +9749,13 @@ var createSvgObjectsFromSchematicTable = ({
|
|
|
9403
9749
|
|
|
9404
9750
|
// lib/sch/svg-object-fns/create-svg-objects-for-sch-port-hover.ts
|
|
9405
9751
|
import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
9406
|
-
import { applyToPoint as
|
|
9752
|
+
import { applyToPoint as applyToPoint64 } from "transformation-matrix";
|
|
9407
9753
|
var PIN_CIRCLE_RADIUS_MM2 = 0.02;
|
|
9408
9754
|
var createSvgObjectsForSchPortHover = ({
|
|
9409
9755
|
schPort,
|
|
9410
9756
|
transform
|
|
9411
9757
|
}) => {
|
|
9412
|
-
const screenSchPortPos =
|
|
9758
|
+
const screenSchPortPos = applyToPoint64(transform, schPort.center);
|
|
9413
9759
|
const pinRadiusPx = Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
9414
9760
|
return [
|
|
9415
9761
|
{
|
|
@@ -9454,14 +9800,14 @@ var createSvgObjectsForSchComponentPortHovers = ({
|
|
|
9454
9800
|
};
|
|
9455
9801
|
|
|
9456
9802
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-line.ts
|
|
9457
|
-
import { applyToPoint as
|
|
9803
|
+
import { applyToPoint as applyToPoint65 } from "transformation-matrix";
|
|
9458
9804
|
function createSvgObjectsFromSchematicLine({
|
|
9459
9805
|
schLine,
|
|
9460
9806
|
transform,
|
|
9461
9807
|
colorMap: colorMap2
|
|
9462
9808
|
}) {
|
|
9463
|
-
const p1 =
|
|
9464
|
-
const p2 =
|
|
9809
|
+
const p1 = applyToPoint65(transform, { x: schLine.x1, y: schLine.y1 });
|
|
9810
|
+
const p2 = applyToPoint65(transform, { x: schLine.x2, y: schLine.y2 });
|
|
9465
9811
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
9466
9812
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
9467
9813
|
return [
|
|
@@ -9490,13 +9836,13 @@ function createSvgObjectsFromSchematicLine({
|
|
|
9490
9836
|
}
|
|
9491
9837
|
|
|
9492
9838
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-circle.ts
|
|
9493
|
-
import { applyToPoint as
|
|
9839
|
+
import { applyToPoint as applyToPoint66 } from "transformation-matrix";
|
|
9494
9840
|
function createSvgObjectsFromSchematicCircle({
|
|
9495
9841
|
schCircle,
|
|
9496
9842
|
transform,
|
|
9497
9843
|
colorMap: colorMap2
|
|
9498
9844
|
}) {
|
|
9499
|
-
const center =
|
|
9845
|
+
const center = applyToPoint66(transform, schCircle.center);
|
|
9500
9846
|
const transformedRadius = Math.abs(transform.a) * schCircle.radius;
|
|
9501
9847
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
9502
9848
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -9526,13 +9872,13 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
9526
9872
|
}
|
|
9527
9873
|
|
|
9528
9874
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-rect.ts
|
|
9529
|
-
import { applyToPoint as
|
|
9875
|
+
import { applyToPoint as applyToPoint67 } from "transformation-matrix";
|
|
9530
9876
|
function createSvgObjectsFromSchematicRect({
|
|
9531
9877
|
schRect,
|
|
9532
9878
|
transform,
|
|
9533
9879
|
colorMap: colorMap2
|
|
9534
9880
|
}) {
|
|
9535
|
-
const center =
|
|
9881
|
+
const center = applyToPoint67(transform, schRect.center);
|
|
9536
9882
|
const transformedWidth = Math.abs(transform.a) * schRect.width;
|
|
9537
9883
|
const transformedHeight = Math.abs(transform.d) * schRect.height;
|
|
9538
9884
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -9568,13 +9914,13 @@ function createSvgObjectsFromSchematicRect({
|
|
|
9568
9914
|
}
|
|
9569
9915
|
|
|
9570
9916
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-arc.ts
|
|
9571
|
-
import { applyToPoint as
|
|
9917
|
+
import { applyToPoint as applyToPoint68 } from "transformation-matrix";
|
|
9572
9918
|
function createSvgObjectsFromSchematicArc({
|
|
9573
9919
|
schArc,
|
|
9574
9920
|
transform,
|
|
9575
9921
|
colorMap: colorMap2
|
|
9576
9922
|
}) {
|
|
9577
|
-
const center =
|
|
9923
|
+
const center = applyToPoint68(transform, schArc.center);
|
|
9578
9924
|
const transformedRadius = Math.abs(transform.a) * schArc.radius;
|
|
9579
9925
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
9580
9926
|
const transformedStrokeWidth = Math.abs(transform.a) * strokeWidth;
|
|
@@ -10659,18 +11005,18 @@ function formatNumber2(value) {
|
|
|
10659
11005
|
import { distance as distance2 } from "circuit-json";
|
|
10660
11006
|
import { stringify as stringify7 } from "svgson";
|
|
10661
11007
|
import {
|
|
10662
|
-
applyToPoint as
|
|
11008
|
+
applyToPoint as applyToPoint71,
|
|
10663
11009
|
compose as compose14,
|
|
10664
11010
|
scale as scale8,
|
|
10665
11011
|
translate as translate14
|
|
10666
11012
|
} from "transformation-matrix";
|
|
10667
11013
|
|
|
10668
11014
|
// lib/pcb/svg-object-fns/convert-circuit-json-to-solder-paste-mask.ts
|
|
10669
|
-
import { applyToPoint as
|
|
11015
|
+
import { applyToPoint as applyToPoint70 } from "transformation-matrix";
|
|
10670
11016
|
function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
10671
11017
|
const { transform, layer: layerFilter } = ctx;
|
|
10672
11018
|
if (layerFilter && solderPaste.layer !== layerFilter) return [];
|
|
10673
|
-
const [x, y] =
|
|
11019
|
+
const [x, y] = applyToPoint70(transform, [solderPaste.x, solderPaste.y]);
|
|
10674
11020
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
10675
11021
|
const width = solderPaste.width * Math.abs(transform.a);
|
|
10676
11022
|
const height = solderPaste.height * Math.abs(transform.d);
|
|
@@ -10895,8 +11241,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
10895
11241
|
}
|
|
10896
11242
|
}
|
|
10897
11243
|
function createSvgObjectFromPcbBoundary2(transform, minX, minY, maxX, maxY) {
|
|
10898
|
-
const [x1, y1] =
|
|
10899
|
-
const [x2, y2] =
|
|
11244
|
+
const [x1, y1] = applyToPoint71(transform, [minX, minY]);
|
|
11245
|
+
const [x2, y2] = applyToPoint71(transform, [maxX, maxY]);
|
|
10900
11246
|
const width = Math.abs(x2 - x1);
|
|
10901
11247
|
const height = Math.abs(y2 - y1);
|
|
10902
11248
|
const x = Math.min(x1, x2);
|