@tscircuit/pcb-viewer 1.11.434 → 1.11.435
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 +172 -137
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10132,7 +10132,7 @@ var useMeasure_default = isBrowser && typeof window.ResizeObserver !== "undefine
|
|
|
10132
10132
|
};
|
|
10133
10133
|
|
|
10134
10134
|
// src/PCBViewer.tsx
|
|
10135
|
-
import { compose as
|
|
10135
|
+
import { compose as compose11, scale as scale6, translate as translate15 } from "transformation-matrix";
|
|
10136
10136
|
|
|
10137
10137
|
// node_modules/use-mouse-matrix-transform/dist/chunk-TGYMZPTI.js
|
|
10138
10138
|
import { compose as compose3, translate as translate7, scale } from "transformation-matrix";
|
|
@@ -10641,6 +10641,14 @@ var getFullConnectivityMapFromCircuitJson = (circuitJson) => {
|
|
|
10641
10641
|
return new ConnectivityMap(netMap);
|
|
10642
10642
|
};
|
|
10643
10643
|
|
|
10644
|
+
// src/lib/convert-element-to-primitive.ts
|
|
10645
|
+
import {
|
|
10646
|
+
applyToPoint as applyToPoint3,
|
|
10647
|
+
compose as compose5,
|
|
10648
|
+
rotateDEG as rotateDEG2,
|
|
10649
|
+
translate as translate9
|
|
10650
|
+
} from "transformation-matrix";
|
|
10651
|
+
|
|
10644
10652
|
// src/lib/util/expand-stroke.ts
|
|
10645
10653
|
function getExpandedStroke(strokeInput, defaultWidth) {
|
|
10646
10654
|
if (strokeInput.length < 2) {
|
|
@@ -11335,6 +11343,7 @@ var convertElementToPrimitives = (element, allElements, metadataIndex) => {
|
|
|
11335
11343
|
const {
|
|
11336
11344
|
x,
|
|
11337
11345
|
y,
|
|
11346
|
+
ccw_rotation,
|
|
11338
11347
|
pad_outline,
|
|
11339
11348
|
hole_shape,
|
|
11340
11349
|
hole_diameter,
|
|
@@ -11346,17 +11355,20 @@ var convertElementToPrimitives = (element, allElements, metadataIndex) => {
|
|
|
11346
11355
|
} = element;
|
|
11347
11356
|
const parsed_hole_offset_x = distance.parse(hole_offset_x ?? 0);
|
|
11348
11357
|
const parsed_hole_offset_y = distance.parse(hole_offset_y ?? 0);
|
|
11349
|
-
const
|
|
11358
|
+
const transformPadLocalToBoard = compose5(
|
|
11359
|
+
translate9(x, y),
|
|
11360
|
+
rotateDEG2(ccw_rotation ?? 0)
|
|
11361
|
+
);
|
|
11350
11362
|
const padPrimitives = [];
|
|
11351
|
-
if (
|
|
11352
|
-
const
|
|
11353
|
-
(p) => (
|
|
11363
|
+
if (Array.isArray(pad_outline)) {
|
|
11364
|
+
const points = normalizePolygonPoints(pad_outline).map(
|
|
11365
|
+
(p) => applyToPoint3(transformPadLocalToBoard, p)
|
|
11354
11366
|
);
|
|
11355
11367
|
for (const layer of layers || ["top", "bottom"]) {
|
|
11356
11368
|
padPrimitives.push({
|
|
11357
11369
|
_pcb_drawing_object_id: `polygon_${globalPcbDrawingObjectCount++}`,
|
|
11358
11370
|
pcb_drawing_type: "polygon",
|
|
11359
|
-
points
|
|
11371
|
+
points,
|
|
11360
11372
|
layer,
|
|
11361
11373
|
_element: element,
|
|
11362
11374
|
_parent_pcb_component,
|
|
@@ -11365,10 +11377,10 @@ var convertElementToPrimitives = (element, allElements, metadataIndex) => {
|
|
|
11365
11377
|
});
|
|
11366
11378
|
}
|
|
11367
11379
|
}
|
|
11368
|
-
const holeCenter = {
|
|
11369
|
-
x:
|
|
11370
|
-
y:
|
|
11371
|
-
};
|
|
11380
|
+
const holeCenter = applyToPoint3(transformPadLocalToBoard, {
|
|
11381
|
+
x: parsed_hole_offset_x,
|
|
11382
|
+
y: parsed_hole_offset_y
|
|
11383
|
+
});
|
|
11372
11384
|
const holePrimitives = [];
|
|
11373
11385
|
if (hole_shape === "circle") {
|
|
11374
11386
|
holePrimitives.push({
|
|
@@ -11390,6 +11402,7 @@ var convertElementToPrimitives = (element, allElements, metadataIndex) => {
|
|
|
11390
11402
|
y: holeCenter.y,
|
|
11391
11403
|
rX: (hole_width ?? 0) / 2,
|
|
11392
11404
|
rY: (hole_height ?? 0) / 2,
|
|
11405
|
+
ccw_rotation,
|
|
11393
11406
|
layer: "drill",
|
|
11394
11407
|
_element: element,
|
|
11395
11408
|
_parent_pcb_component,
|
|
@@ -11407,7 +11420,7 @@ var convertElementToPrimitives = (element, allElements, metadataIndex) => {
|
|
|
11407
11420
|
_element: element,
|
|
11408
11421
|
_parent_pcb_component,
|
|
11409
11422
|
_parent_source_component,
|
|
11410
|
-
ccw_rotation
|
|
11423
|
+
ccw_rotation
|
|
11411
11424
|
});
|
|
11412
11425
|
}
|
|
11413
11426
|
return [...padPrimitives, ...holePrimitives];
|
|
@@ -11560,11 +11573,16 @@ var getPrimitiveBoundingBox = (primitive) => {
|
|
|
11560
11573
|
};
|
|
11561
11574
|
}
|
|
11562
11575
|
case "oval": {
|
|
11576
|
+
const ccwRotationRadians = (primitive.ccw_rotation ?? 0) * Math.PI / 180;
|
|
11577
|
+
const cos = Math.cos(ccwRotationRadians);
|
|
11578
|
+
const sin = Math.sin(ccwRotationRadians);
|
|
11579
|
+
const halfWidth = Math.hypot(primitive.rX * cos, primitive.rY * sin);
|
|
11580
|
+
const halfHeight = Math.hypot(primitive.rX * sin, primitive.rY * cos);
|
|
11563
11581
|
return {
|
|
11564
|
-
minX: primitive.x -
|
|
11565
|
-
maxX: primitive.x +
|
|
11566
|
-
minY: primitive.y -
|
|
11567
|
-
maxY: primitive.y +
|
|
11582
|
+
minX: primitive.x - halfWidth,
|
|
11583
|
+
maxX: primitive.x + halfWidth,
|
|
11584
|
+
minY: primitive.y - halfHeight,
|
|
11585
|
+
maxY: primitive.y + halfHeight
|
|
11568
11586
|
};
|
|
11569
11587
|
}
|
|
11570
11588
|
case "pill": {
|
|
@@ -11758,7 +11776,7 @@ function addInteractionMetadataToPrimitives({
|
|
|
11758
11776
|
import {
|
|
11759
11777
|
getBoundsFromPoints as getBoundsFromPoints2
|
|
11760
11778
|
} from "@tscircuit/math-utils";
|
|
11761
|
-
import { compose as
|
|
11779
|
+
import { compose as compose6, scale as scale3, translate as translate10 } from "transformation-matrix";
|
|
11762
11780
|
var buildErrorPreviewElementIndexes = (elements) => {
|
|
11763
11781
|
const tracesById = /* @__PURE__ */ new Map();
|
|
11764
11782
|
const portsById = /* @__PURE__ */ new Map();
|
|
@@ -12049,10 +12067,10 @@ var createTransformForBounds = ({
|
|
|
12049
12067
|
const targetWidth = Math.max(bounds.maxX - bounds.minX, 0.8) + 1.4;
|
|
12050
12068
|
const targetHeight = Math.max(bounds.maxY - bounds.minY, 0.8) + 1.4;
|
|
12051
12069
|
const scaleFactor = Math.min(width / targetWidth, height / targetHeight, 240) * 0.92;
|
|
12052
|
-
return
|
|
12053
|
-
|
|
12070
|
+
return compose6(
|
|
12071
|
+
translate10(width / 2, height / 2),
|
|
12054
12072
|
scale3(scaleFactor, -scaleFactor, 0, 0),
|
|
12055
|
-
|
|
12073
|
+
translate10(-center.x, -center.y)
|
|
12056
12074
|
);
|
|
12057
12075
|
};
|
|
12058
12076
|
var getRelatedIdsForError = (error) => {
|
|
@@ -12287,7 +12305,7 @@ function getXRayGroups(netId, elements, connectivityMap) {
|
|
|
12287
12305
|
|
|
12288
12306
|
// src/components/CanvasElementsRenderer.tsx
|
|
12289
12307
|
import { useCallback as useCallback11, useEffect as useEffect20, useMemo as useMemo15, useRef as useRef16, useState as useState13 } from "react";
|
|
12290
|
-
import { applyToPoint as
|
|
12308
|
+
import { applyToPoint as applyToPoint22, inverse as inverse6 } from "transformation-matrix";
|
|
12291
12309
|
|
|
12292
12310
|
// src/lib/get-pad-component.ts
|
|
12293
12311
|
var getPadComponent = (pad, elements) => {
|
|
@@ -12314,11 +12332,11 @@ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer17 } from "circuit-to-can
|
|
|
12314
12332
|
// src/lib/Drawer.ts
|
|
12315
12333
|
import colorParser from "color";
|
|
12316
12334
|
import {
|
|
12317
|
-
applyToPoint as
|
|
12318
|
-
compose as
|
|
12335
|
+
applyToPoint as applyToPoint4,
|
|
12336
|
+
compose as compose7,
|
|
12319
12337
|
identity as identity3,
|
|
12320
12338
|
inverse,
|
|
12321
|
-
translate as
|
|
12339
|
+
translate as translate11
|
|
12322
12340
|
} from "transformation-matrix";
|
|
12323
12341
|
|
|
12324
12342
|
// src/lib/colors.ts
|
|
@@ -12640,7 +12658,7 @@ var Drawer = class {
|
|
|
12640
12658
|
);
|
|
12641
12659
|
this.transform = identity3();
|
|
12642
12660
|
this.transform.d *= -1;
|
|
12643
|
-
this.transform =
|
|
12661
|
+
this.transform = compose7(this.transform, translate11(0, -500));
|
|
12644
12662
|
this.lastPoint = { x: 0, y: 0 };
|
|
12645
12663
|
this.equip({});
|
|
12646
12664
|
}
|
|
@@ -12663,8 +12681,8 @@ var Drawer = class {
|
|
|
12663
12681
|
}
|
|
12664
12682
|
drawMeshPattern(x, y, width, height, spacing, angle = 45) {
|
|
12665
12683
|
const ctx = this.getLayerCtx();
|
|
12666
|
-
const [x1, y1] =
|
|
12667
|
-
const [x2, y2] =
|
|
12684
|
+
const [x1, y1] = applyToPoint4(this.transform, [x, y]);
|
|
12685
|
+
const [x2, y2] = applyToPoint4(this.transform, [x + width, y + height]);
|
|
12668
12686
|
const spacing$ = scaleOnly(this.transform, spacing);
|
|
12669
12687
|
ctx.lineWidth = 1;
|
|
12670
12688
|
ctx.strokeStyle = this.aperture.color;
|
|
@@ -12694,8 +12712,8 @@ var Drawer = class {
|
|
|
12694
12712
|
stroke_width,
|
|
12695
12713
|
roundness
|
|
12696
12714
|
}) {
|
|
12697
|
-
const [x1$, y1$] =
|
|
12698
|
-
const [x2$, y2$] =
|
|
12715
|
+
const [x1$, y1$] = applyToPoint4(this.transform, [x - w / 2, y - h / 2]);
|
|
12716
|
+
const [x2$, y2$] = applyToPoint4(this.transform, [x + w / 2, y + h / 2]);
|
|
12699
12717
|
this.applyAperture();
|
|
12700
12718
|
const ctx = this.getLayerCtx();
|
|
12701
12719
|
const radius$ = roundness ? scaleOnly(this.transform, roundness) : 0;
|
|
@@ -12765,11 +12783,11 @@ var Drawer = class {
|
|
|
12765
12783
|
rotatedRect(x, y, w, h, ccw_rotation, roundness, mesh_fill) {
|
|
12766
12784
|
const ctx = this.getLayerCtx();
|
|
12767
12785
|
this.applyAperture();
|
|
12768
|
-
const [x1$, y1$] =
|
|
12769
|
-
const [x2$, y2$] =
|
|
12786
|
+
const [x1$, y1$] = applyToPoint4(this.transform, [x - w / 2, y - h / 2]);
|
|
12787
|
+
const [x2$, y2$] = applyToPoint4(this.transform, [x + w / 2, y + h / 2]);
|
|
12770
12788
|
const radius$ = roundness ? scaleOnly(this.transform, roundness) : 0;
|
|
12771
12789
|
ctx.save();
|
|
12772
|
-
const [centerX, centerY] =
|
|
12790
|
+
const [centerX, centerY] = applyToPoint4(this.transform, [x, y]);
|
|
12773
12791
|
ctx.translate(centerX, centerY);
|
|
12774
12792
|
const cw_rotation = 360 - ccw_rotation;
|
|
12775
12793
|
if (ccw_rotation) ctx.rotate(cw_rotation * Math.PI / 180);
|
|
@@ -12805,7 +12823,7 @@ var Drawer = class {
|
|
|
12805
12823
|
const ctx = this.getLayerCtx();
|
|
12806
12824
|
this.applyAperture();
|
|
12807
12825
|
ctx.save();
|
|
12808
|
-
const [centerX, centerY] =
|
|
12826
|
+
const [centerX, centerY] = applyToPoint4(this.transform, [x, y]);
|
|
12809
12827
|
ctx.translate(centerX, centerY);
|
|
12810
12828
|
const cw_rotation = 360 - ccw_rotation;
|
|
12811
12829
|
if (ccw_rotation) ctx.rotate(cw_rotation * Math.PI / 180);
|
|
@@ -12815,7 +12833,7 @@ var Drawer = class {
|
|
|
12815
12833
|
}
|
|
12816
12834
|
circle(x, y, r, mesh_fill, is_filled = true) {
|
|
12817
12835
|
const r$ = scaleOnly(this.transform, r);
|
|
12818
|
-
const [x$, y$] =
|
|
12836
|
+
const [x$, y$] = applyToPoint4(this.transform, [x, y]);
|
|
12819
12837
|
this.applyAperture();
|
|
12820
12838
|
const ctx = this.getLayerCtx();
|
|
12821
12839
|
if (mesh_fill) {
|
|
@@ -12834,19 +12852,26 @@ var Drawer = class {
|
|
|
12834
12852
|
ctx.fill();
|
|
12835
12853
|
}
|
|
12836
12854
|
}
|
|
12837
|
-
oval(
|
|
12855
|
+
oval({
|
|
12856
|
+
x,
|
|
12857
|
+
y,
|
|
12858
|
+
rx,
|
|
12859
|
+
ry,
|
|
12860
|
+
ccwRotationDegrees = 0
|
|
12861
|
+
}) {
|
|
12838
12862
|
const rx$ = scaleOnly(this.transform, rx);
|
|
12839
12863
|
const ry$ = scaleOnly(this.transform, ry);
|
|
12840
|
-
const [x$, y$] =
|
|
12864
|
+
const [x$, y$] = applyToPoint4(this.transform, [x, y]);
|
|
12841
12865
|
this.applyAperture();
|
|
12842
12866
|
const ctx = this.getLayerCtx();
|
|
12843
12867
|
ctx.beginPath();
|
|
12844
|
-
|
|
12868
|
+
const cwRotationRadians = -ccwRotationDegrees * Math.PI / 180;
|
|
12869
|
+
ctx.ellipse(x$, y$, rx$, ry$, cwRotationRadians, 0, 2 * Math.PI);
|
|
12845
12870
|
ctx.fill();
|
|
12846
12871
|
ctx.closePath();
|
|
12847
12872
|
}
|
|
12848
12873
|
pill(x, y, w, h) {
|
|
12849
|
-
const [x$, y$] =
|
|
12874
|
+
const [x$, y$] = applyToPoint4(this.transform, [x - w / 2, y + h / 2]);
|
|
12850
12875
|
const width$ = scaleOnly(this.transform, w);
|
|
12851
12876
|
const height$ = scaleOnly(this.transform, h);
|
|
12852
12877
|
const radius = Math.min(width$, height$) / 2;
|
|
@@ -12873,7 +12898,7 @@ var Drawer = class {
|
|
|
12873
12898
|
this.applyAperture();
|
|
12874
12899
|
const ctx = this.getLayerCtx();
|
|
12875
12900
|
const transformedPoints = points.map(
|
|
12876
|
-
(point2) =>
|
|
12901
|
+
(point2) => applyToPoint4(this.transform, [point2.x, point2.y])
|
|
12877
12902
|
);
|
|
12878
12903
|
ctx.beginPath();
|
|
12879
12904
|
ctx.moveTo(transformedPoints[0][0], transformedPoints[0][1]);
|
|
@@ -12890,7 +12915,7 @@ var Drawer = class {
|
|
|
12890
12915
|
}
|
|
12891
12916
|
/* NOTE: This is not gerber compatible */
|
|
12892
12917
|
debugText(text, x, y) {
|
|
12893
|
-
const [x$, y$] =
|
|
12918
|
+
const [x$, y$] = applyToPoint4(this.transform, [x, y]);
|
|
12894
12919
|
this.applyAperture();
|
|
12895
12920
|
const ctx = this.getLayerCtx();
|
|
12896
12921
|
ctx.font = "10px sans-serif";
|
|
@@ -12999,11 +13024,11 @@ var Drawer = class {
|
|
|
12999
13024
|
this.lastPoint = { x, y };
|
|
13000
13025
|
}
|
|
13001
13026
|
lineTo(x, y) {
|
|
13002
|
-
const [x$, y$] =
|
|
13027
|
+
const [x$, y$] = applyToPoint4(this.transform, [x, y]);
|
|
13003
13028
|
const { size, shape, mode } = this.aperture;
|
|
13004
13029
|
const size$ = scaleOnly(this.transform, size);
|
|
13005
13030
|
const { lastPoint } = this;
|
|
13006
|
-
const lastPoint$ =
|
|
13031
|
+
const lastPoint$ = applyToPoint4(this.transform, lastPoint);
|
|
13007
13032
|
this.applyAperture();
|
|
13008
13033
|
const ctx = this.getLayerCtx();
|
|
13009
13034
|
if (shape === "square")
|
|
@@ -13027,7 +13052,7 @@ var Drawer = class {
|
|
|
13027
13052
|
const processRing = (ring) => {
|
|
13028
13053
|
if (ring.vertices.length === 0) return;
|
|
13029
13054
|
const startPoint = ring.vertices[0];
|
|
13030
|
-
const t_start_point =
|
|
13055
|
+
const t_start_point = applyToPoint4(this.transform, [
|
|
13031
13056
|
startPoint.x,
|
|
13032
13057
|
startPoint.y
|
|
13033
13058
|
]);
|
|
@@ -13041,7 +13066,7 @@ var Drawer = class {
|
|
|
13041
13066
|
const dy = p2.y - p1.y;
|
|
13042
13067
|
const chord = Math.sqrt(dx * dx + dy * dy);
|
|
13043
13068
|
if (chord < 1e-9) {
|
|
13044
|
-
const t_p2 =
|
|
13069
|
+
const t_p2 = applyToPoint4(this.transform, [p2.x, p2.y]);
|
|
13045
13070
|
ctx.lineTo(t_p2[0], t_p2[1]);
|
|
13046
13071
|
continue;
|
|
13047
13072
|
}
|
|
@@ -13065,7 +13090,7 @@ var Drawer = class {
|
|
|
13065
13090
|
} else if (bulge < 0 && endAngle > startAngle) {
|
|
13066
13091
|
endAngle -= 2 * Math.PI;
|
|
13067
13092
|
}
|
|
13068
|
-
const t_center =
|
|
13093
|
+
const t_center = applyToPoint4(this.transform, [cx, cy]);
|
|
13069
13094
|
const t_radius = scaleOnly(this.transform, radius);
|
|
13070
13095
|
ctx.arc(
|
|
13071
13096
|
t_center[0],
|
|
@@ -13076,7 +13101,7 @@ var Drawer = class {
|
|
|
13076
13101
|
bulge > 0
|
|
13077
13102
|
);
|
|
13078
13103
|
} else {
|
|
13079
|
-
const t_p2 =
|
|
13104
|
+
const t_p2 = applyToPoint4(this.transform, [p2.x, p2.y]);
|
|
13080
13105
|
ctx.lineTo(t_p2[0], t_p2[1]);
|
|
13081
13106
|
}
|
|
13082
13107
|
}
|
|
@@ -13607,24 +13632,24 @@ function drawPlatedHolePads({
|
|
|
13607
13632
|
}
|
|
13608
13633
|
|
|
13609
13634
|
// src/lib/util/rotate-text.ts
|
|
13610
|
-
import { compose as
|
|
13635
|
+
import { compose as compose8, translate as translate12, rotate as rotate2, applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
13611
13636
|
function rotateText(rotateTextParams) {
|
|
13612
13637
|
const { lines, anchorPoint, ccwRotation } = rotateTextParams;
|
|
13613
13638
|
if (!ccwRotation) return lines;
|
|
13614
13639
|
const rad = ccwRotation * Math.PI / 180;
|
|
13615
13640
|
const rotationMatrix = rotate2(rad);
|
|
13616
|
-
const transform =
|
|
13617
|
-
|
|
13641
|
+
const transform = compose8(
|
|
13642
|
+
translate12(anchorPoint.x, anchorPoint.y),
|
|
13618
13643
|
rotationMatrix,
|
|
13619
|
-
|
|
13644
|
+
translate12(-anchorPoint.x, -anchorPoint.y)
|
|
13620
13645
|
);
|
|
13621
|
-
|
|
13646
|
+
applyToPoint5(transform, anchorPoint);
|
|
13622
13647
|
return lines.map((line2) => ({
|
|
13623
13648
|
...line2,
|
|
13624
|
-
x1:
|
|
13625
|
-
y1:
|
|
13626
|
-
x2:
|
|
13627
|
-
y2:
|
|
13649
|
+
x1: applyToPoint5(transform, { x: line2.x1, y: line2.y1 }).x,
|
|
13650
|
+
y1: applyToPoint5(transform, { x: line2.x1, y: line2.y1 }).y,
|
|
13651
|
+
x2: applyToPoint5(transform, { x: line2.x2, y: line2.y2 }).x,
|
|
13652
|
+
y2: applyToPoint5(transform, { x: line2.x2, y: line2.y2 }).y
|
|
13628
13653
|
}));
|
|
13629
13654
|
}
|
|
13630
13655
|
|
|
@@ -13940,7 +13965,13 @@ var drawOval = (drawer, oval) => {
|
|
|
13940
13965
|
color: getColor(oval),
|
|
13941
13966
|
layer: oval.layer
|
|
13942
13967
|
});
|
|
13943
|
-
drawer.oval(
|
|
13968
|
+
drawer.oval({
|
|
13969
|
+
x: oval.x,
|
|
13970
|
+
y: oval.y,
|
|
13971
|
+
rx: oval.rX,
|
|
13972
|
+
ry: oval.rY,
|
|
13973
|
+
ccwRotationDegrees: oval.ccw_rotation
|
|
13974
|
+
});
|
|
13944
13975
|
};
|
|
13945
13976
|
var drawPill = (drawer, pill) => {
|
|
13946
13977
|
drawer.equip({
|
|
@@ -14696,7 +14727,7 @@ var pngSignature = Uint8Array.of(137, 80, 78, 71, 13, 10, 26, 10);
|
|
|
14696
14727
|
var latin1Decoder = new TextDecoder("latin1");
|
|
14697
14728
|
|
|
14698
14729
|
// node_modules/graphics-debug/dist/chunk-FLFF6QXL.js
|
|
14699
|
-
import { applyToPoint as
|
|
14730
|
+
import { applyToPoint as applyToPoint6, inverse as inverse2 } from "transformation-matrix";
|
|
14700
14731
|
var EPSILON = 1e-9;
|
|
14701
14732
|
var isWithin = (value, min, max) => {
|
|
14702
14733
|
return value >= min - EPSILON && value <= max + EPSILON;
|
|
@@ -14766,10 +14797,10 @@ function clipInfiniteLineToBounds(infiniteLine, bounds) {
|
|
|
14766
14797
|
function getViewportBoundsFromMatrix(matrix2, width, height) {
|
|
14767
14798
|
const screenToReal = inverse2(matrix2);
|
|
14768
14799
|
const corners = [
|
|
14769
|
-
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14800
|
+
applyToPoint6(screenToReal, { x: 0, y: 0 }),
|
|
14801
|
+
applyToPoint6(screenToReal, { x: width, y: 0 }),
|
|
14802
|
+
applyToPoint6(screenToReal, { x: 0, y: height }),
|
|
14803
|
+
applyToPoint6(screenToReal, { x: width, y: height })
|
|
14773
14804
|
];
|
|
14774
14805
|
return {
|
|
14775
14806
|
minX: Math.min(...corners.map((p) => p.x)),
|
|
@@ -14784,7 +14815,7 @@ var FONT_SIZE_WIDTH_RATIO = 0.6;
|
|
|
14784
14815
|
var FONT_SIZE_HEIGHT_RATIO = 1;
|
|
14785
14816
|
|
|
14786
14817
|
// node_modules/graphics-debug/dist/chunk-MLQPMI4V.js
|
|
14787
|
-
import { applyToPoint as
|
|
14818
|
+
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
14788
14819
|
var getDistanceBetweenPoints = (a, b) => {
|
|
14789
14820
|
return Math.hypot(a.x - b.x, a.y - b.y);
|
|
14790
14821
|
};
|
|
@@ -14833,9 +14864,9 @@ var getRectCornersWithAngle = (rect, angleRadians) => {
|
|
|
14833
14864
|
};
|
|
14834
14865
|
var getProjectedRectGeometry = (rect, matrix2) => {
|
|
14835
14866
|
const corners = getRectCornersForMatrix(rect, matrix2).map(
|
|
14836
|
-
(point2) =>
|
|
14867
|
+
(point2) => applyToPoint7(matrix2, point2)
|
|
14837
14868
|
);
|
|
14838
|
-
const center =
|
|
14869
|
+
const center = applyToPoint7(matrix2, rect.center);
|
|
14839
14870
|
const width = getDistanceBetweenPoints(corners[0], corners[1]);
|
|
14840
14871
|
const height = getDistanceBetweenPoints(corners[1], corners[2]);
|
|
14841
14872
|
const angleRadians = corners.length >= 2 ? Math.atan2(corners[1].y - corners[0].y, corners[1].x - corners[0].x) : 0;
|
|
@@ -15013,10 +15044,10 @@ function getInlineLabelLayout(shaftStart, shaftEnd, {
|
|
|
15013
15044
|
|
|
15014
15045
|
// node_modules/graphics-debug/dist/chunk-TKCBDTT7.js
|
|
15015
15046
|
import {
|
|
15016
|
-
applyToPoint as
|
|
15017
|
-
compose as
|
|
15047
|
+
applyToPoint as applyToPoint8,
|
|
15048
|
+
compose as compose9,
|
|
15018
15049
|
scale as scale4,
|
|
15019
|
-
translate as
|
|
15050
|
+
translate as translate13
|
|
15020
15051
|
} from "transformation-matrix";
|
|
15021
15052
|
var defaultColors = [
|
|
15022
15053
|
"rgba(239, 68, 68, 0.8)",
|
|
@@ -15078,10 +15109,10 @@ function computeTransformFromViewbox(viewbox, canvasWidth, canvasHeight, options
|
|
|
15078
15109
|
(canvasWidth - 2 * padding) / width,
|
|
15079
15110
|
(canvasHeight - 2 * padding) / height
|
|
15080
15111
|
);
|
|
15081
|
-
return
|
|
15082
|
-
|
|
15112
|
+
return compose9(
|
|
15113
|
+
translate13(canvasWidth / 2, canvasHeight / 2),
|
|
15083
15114
|
scale4(scale_factor, yFlip ? -scale_factor : scale_factor),
|
|
15084
|
-
|
|
15115
|
+
translate13(-(bounds.minX + width / 2), -(bounds.minY + height / 2))
|
|
15085
15116
|
);
|
|
15086
15117
|
}
|
|
15087
15118
|
function getBounds(graphics) {
|
|
@@ -15207,7 +15238,7 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15207
15238
|
}
|
|
15208
15239
|
if (graphics.circles && graphics.circles.length > 0) {
|
|
15209
15240
|
graphics.circles.forEach((circle2) => {
|
|
15210
|
-
const projected =
|
|
15241
|
+
const projected = applyToPoint8(matrix2, circle2.center);
|
|
15211
15242
|
const scaledRadius = circle2.radius * Math.abs(matrix2.a);
|
|
15212
15243
|
ctx.beginPath();
|
|
15213
15244
|
ctx.arc(projected.x, projected.y, scaledRadius, 0, 2 * Math.PI);
|
|
@@ -15225,7 +15256,7 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15225
15256
|
graphics.polygons.forEach((polygon2) => {
|
|
15226
15257
|
if (polygon2.points.length === 0) return;
|
|
15227
15258
|
const projectedPoints = polygon2.points.map(
|
|
15228
|
-
(point2) =>
|
|
15259
|
+
(point2) => applyToPoint8(matrix2, point2)
|
|
15229
15260
|
);
|
|
15230
15261
|
ctx.beginPath();
|
|
15231
15262
|
ctx.moveTo(projectedPoints[0].x, projectedPoints[0].y);
|
|
@@ -15249,8 +15280,8 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15249
15280
|
if (graphics.arrows && graphics.arrows.length > 0) {
|
|
15250
15281
|
graphics.arrows.forEach((arrow, arrowIndex) => {
|
|
15251
15282
|
const geometry = getArrowGeometry(arrow);
|
|
15252
|
-
const shaftStart =
|
|
15253
|
-
const shaftEnd =
|
|
15283
|
+
const shaftStart = applyToPoint8(matrix2, geometry.shaftStart);
|
|
15284
|
+
const shaftEnd = applyToPoint8(matrix2, geometry.shaftEnd);
|
|
15254
15285
|
const color9 = arrow.color || defaultColors[arrowIndex % defaultColors.length];
|
|
15255
15286
|
const scaleFactor = Math.hypot(matrix2.a, matrix2.b);
|
|
15256
15287
|
ctx.strokeStyle = color9;
|
|
@@ -15263,9 +15294,9 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15263
15294
|
ctx.lineTo(shaftEnd.x, shaftEnd.y);
|
|
15264
15295
|
ctx.stroke();
|
|
15265
15296
|
geometry.heads.forEach((head) => {
|
|
15266
|
-
const tip =
|
|
15267
|
-
const leftWing =
|
|
15268
|
-
const rightWing =
|
|
15297
|
+
const tip = applyToPoint8(matrix2, head.tip);
|
|
15298
|
+
const leftWing = applyToPoint8(matrix2, head.leftWing);
|
|
15299
|
+
const rightWing = applyToPoint8(matrix2, head.rightWing);
|
|
15269
15300
|
ctx.beginPath();
|
|
15270
15301
|
ctx.moveTo(tip.x, tip.y);
|
|
15271
15302
|
ctx.lineTo(leftWing.x, leftWing.y);
|
|
@@ -15316,10 +15347,10 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15316
15347
|
).forEach(({ line: line2, originalIndex: lineIndex }) => {
|
|
15317
15348
|
if (line2.points.length === 0) return;
|
|
15318
15349
|
ctx.beginPath();
|
|
15319
|
-
const firstPoint =
|
|
15350
|
+
const firstPoint = applyToPoint8(matrix2, line2.points[0]);
|
|
15320
15351
|
ctx.moveTo(firstPoint.x, firstPoint.y);
|
|
15321
15352
|
for (let i = 1; i < line2.points.length; i++) {
|
|
15322
|
-
const projected =
|
|
15353
|
+
const projected = applyToPoint8(matrix2, line2.points[i]);
|
|
15323
15354
|
ctx.lineTo(projected.x, projected.y);
|
|
15324
15355
|
}
|
|
15325
15356
|
ctx.strokeStyle = line2.strokeColor || defaultColors[lineIndex % defaultColors.length];
|
|
@@ -15358,8 +15389,8 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15358
15389
|
const segment2 = clipInfiniteLineToBounds(line2, viewportBounds);
|
|
15359
15390
|
if (!segment2) return;
|
|
15360
15391
|
const [start, end] = segment2;
|
|
15361
|
-
const projectedStart =
|
|
15362
|
-
const projectedEnd =
|
|
15392
|
+
const projectedStart = applyToPoint8(matrix2, start);
|
|
15393
|
+
const projectedEnd = applyToPoint8(matrix2, end);
|
|
15363
15394
|
ctx.beginPath();
|
|
15364
15395
|
ctx.moveTo(projectedStart.x, projectedStart.y);
|
|
15365
15396
|
ctx.lineTo(projectedEnd.x, projectedEnd.y);
|
|
@@ -15387,7 +15418,7 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15387
15418
|
}
|
|
15388
15419
|
if (graphics.texts && graphics.texts.length > 0) {
|
|
15389
15420
|
graphics.texts.forEach((text) => {
|
|
15390
|
-
const projected =
|
|
15421
|
+
const projected = applyToPoint8(matrix2, { x: text.x, y: text.y });
|
|
15391
15422
|
ctx.fillStyle = text.color || "black";
|
|
15392
15423
|
ctx.font = `${(text.fontSize ?? 12) * Math.abs(matrix2.a)}px sans-serif`;
|
|
15393
15424
|
const anchor = text.anchorSide ?? "center";
|
|
@@ -15420,7 +15451,7 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15420
15451
|
}
|
|
15421
15452
|
if (graphics.points && graphics.points.length > 0) {
|
|
15422
15453
|
graphics.points.forEach((point2, pointIndex) => {
|
|
15423
|
-
const projected =
|
|
15454
|
+
const projected = applyToPoint8(matrix2, point2);
|
|
15424
15455
|
ctx.beginPath();
|
|
15425
15456
|
ctx.arc(projected.x, projected.y, 3, 0, 2 * Math.PI);
|
|
15426
15457
|
ctx.fillStyle = point2.color || defaultColors[pointIndex % defaultColors.length];
|
|
@@ -15436,15 +15467,15 @@ function drawGraphicsToCanvas(graphics, target, options = {}) {
|
|
|
15436
15467
|
}
|
|
15437
15468
|
|
|
15438
15469
|
// node_modules/graphics-debug/dist/chunk-5XG5QE5Z.js
|
|
15439
|
-
import { applyToPoint as
|
|
15470
|
+
import { applyToPoint as applyToPoint9 } from "transformation-matrix";
|
|
15440
15471
|
|
|
15441
15472
|
// node_modules/graphics-debug/dist/chunk-WDTSQY35.js
|
|
15442
15473
|
var import_svgson = __toESM(require_svgson_umd(), 1);
|
|
15443
15474
|
import {
|
|
15444
|
-
applyToPoint as
|
|
15445
|
-
compose as
|
|
15475
|
+
applyToPoint as applyToPoint10,
|
|
15476
|
+
compose as compose10,
|
|
15446
15477
|
scale as scale5,
|
|
15447
|
-
translate as
|
|
15478
|
+
translate as translate14
|
|
15448
15479
|
} from "transformation-matrix";
|
|
15449
15480
|
|
|
15450
15481
|
// src/components/DebugGraphicsOverlay.tsx
|
|
@@ -15500,7 +15531,7 @@ var DebugGraphicsOverlay = ({
|
|
|
15500
15531
|
|
|
15501
15532
|
// src/components/DimensionOverlay.tsx
|
|
15502
15533
|
import { useCallback as useCallback6, useEffect as useEffect7, useMemo as useMemo5, useRef as useRef5, useState as useState4 } from "react";
|
|
15503
|
-
import { applyToPoint as
|
|
15534
|
+
import { applyToPoint as applyToPoint12, identity as identity4, inverse as inverse3 } from "transformation-matrix";
|
|
15504
15535
|
|
|
15505
15536
|
// src/hooks/useDiagonalLabel.ts
|
|
15506
15537
|
import { useMemo as useMemo3 } from "react";
|
|
@@ -15694,7 +15725,10 @@ var getPrimitiveSnapPoints = (primitive) => {
|
|
|
15694
15725
|
anchor: "oval_bottom",
|
|
15695
15726
|
point: { x: primitive.x, y: primitive.y + primitive.rY }
|
|
15696
15727
|
}
|
|
15697
|
-
]
|
|
15728
|
+
].map(({ anchor, point: point2 }) => ({
|
|
15729
|
+
anchor,
|
|
15730
|
+
point: rotatePoint3(point2, primitive, primitive.ccw_rotation ?? 0)
|
|
15731
|
+
}));
|
|
15698
15732
|
}
|
|
15699
15733
|
case "line": {
|
|
15700
15734
|
const midPoint = {
|
|
@@ -15725,7 +15759,7 @@ var getPrimitiveSnapPoints = (primitive) => {
|
|
|
15725
15759
|
};
|
|
15726
15760
|
|
|
15727
15761
|
// src/lib/get-screen-snapping-points.ts
|
|
15728
|
-
import { applyToPoint as
|
|
15762
|
+
import { applyToPoint as applyToPoint11 } from "transformation-matrix";
|
|
15729
15763
|
var EMPTY_SCREEN_SNAPPING_POINTS = [];
|
|
15730
15764
|
function getScreenSnappingPoints({
|
|
15731
15765
|
snappingPoints,
|
|
@@ -15736,7 +15770,7 @@ function getScreenSnappingPoints({
|
|
|
15736
15770
|
return snappingPoints.map((snap, index) => ({
|
|
15737
15771
|
...snap,
|
|
15738
15772
|
id: `${index}-${snap.anchor}`,
|
|
15739
|
-
screenPoint:
|
|
15773
|
+
screenPoint: applyToPoint11(realToScreenTransform, snap.point)
|
|
15740
15774
|
}));
|
|
15741
15775
|
}
|
|
15742
15776
|
|
|
@@ -15936,7 +15970,7 @@ var DimensionOverlay = ({
|
|
|
15936
15970
|
if (screenSnappingPoints.length === 0) {
|
|
15937
15971
|
return { point: rwPoint, id: null };
|
|
15938
15972
|
}
|
|
15939
|
-
const screenPoint =
|
|
15973
|
+
const screenPoint = applyToPoint12(transform, rwPoint);
|
|
15940
15974
|
let bestMatch = null;
|
|
15941
15975
|
for (const snap of screenSnappingPoints) {
|
|
15942
15976
|
const dx = snap.screenPoint.x - screenPoint.x;
|
|
@@ -16023,10 +16057,10 @@ var DimensionOverlay = ({
|
|
|
16023
16057
|
disarmBounds,
|
|
16024
16058
|
findSnap
|
|
16025
16059
|
]);
|
|
16026
|
-
const screenDStart =
|
|
16027
|
-
const screenDEnd =
|
|
16028
|
-
const screenBoundsStart =
|
|
16029
|
-
const screenBoundsEnd =
|
|
16060
|
+
const screenDStart = applyToPoint12(transform, dStart);
|
|
16061
|
+
const screenDEnd = applyToPoint12(transform, dEnd);
|
|
16062
|
+
const screenBoundsStart = applyToPoint12(transform, boundsStart);
|
|
16063
|
+
const screenBoundsEnd = applyToPoint12(transform, boundsEnd);
|
|
16030
16064
|
const selectedBounds = {
|
|
16031
16065
|
minX: Math.min(boundsStart.x, boundsEnd.x),
|
|
16032
16066
|
minY: Math.min(boundsStart.y, boundsEnd.y),
|
|
@@ -16117,7 +16151,7 @@ var DimensionOverlay = ({
|
|
|
16117
16151
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
16118
16152
|
const x = e.clientX - rect.left;
|
|
16119
16153
|
const y = e.clientY - rect.top;
|
|
16120
|
-
const rwPoint =
|
|
16154
|
+
const rwPoint = applyToPoint12(inverse3(transform), { x, y });
|
|
16121
16155
|
mousePosRef.current.x = rwPoint.x;
|
|
16122
16156
|
mousePosRef.current.y = rwPoint.y;
|
|
16123
16157
|
if (dimensionToolStretching) {
|
|
@@ -16135,7 +16169,7 @@ var DimensionOverlay = ({
|
|
|
16135
16169
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
16136
16170
|
const x = e.clientX - rect.left;
|
|
16137
16171
|
const y = e.clientY - rect.top;
|
|
16138
|
-
const rwPoint =
|
|
16172
|
+
const rwPoint = applyToPoint12(inverse3(transform), { x, y });
|
|
16139
16173
|
if (boundsToolArmed) {
|
|
16140
16174
|
e.preventDefault();
|
|
16141
16175
|
e.stopPropagation();
|
|
@@ -16166,7 +16200,7 @@ var DimensionOverlay = ({
|
|
|
16166
16200
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
16167
16201
|
const x = e.clientX - rect.left;
|
|
16168
16202
|
const y = e.clientY - rect.top;
|
|
16169
|
-
const rwPoint =
|
|
16203
|
+
const rwPoint = applyToPoint12(inverse3(transform), { x, y });
|
|
16170
16204
|
const end = { x: rwPoint.x, y: rwPoint.y };
|
|
16171
16205
|
e.preventDefault();
|
|
16172
16206
|
e.stopPropagation();
|
|
@@ -16423,7 +16457,7 @@ var DimensionOverlay = ({
|
|
|
16423
16457
|
|
|
16424
16458
|
// src/components/EditPlacementOverlay.tsx
|
|
16425
16459
|
import { useRef as useRef6, useState as useState5 } from "react";
|
|
16426
|
-
import { applyToPoint as
|
|
16460
|
+
import { applyToPoint as applyToPoint13, identity as identity5, inverse as inverse4 } from "transformation-matrix";
|
|
16427
16461
|
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
16428
16462
|
var isInsideOf = (pcb_component, point2, padding = 0) => {
|
|
16429
16463
|
const halfWidth = pcb_component.width / 2;
|
|
@@ -16468,7 +16502,7 @@ var EditPlacementOverlay = ({
|
|
|
16468
16502
|
const x = e.clientX - rect.left;
|
|
16469
16503
|
const y = e.clientY - rect.top;
|
|
16470
16504
|
if (Number.isNaN(x) || Number.isNaN(y)) return;
|
|
16471
|
-
const rwMousePoint =
|
|
16505
|
+
const rwMousePoint = applyToPoint13(inverse4(transform), { x, y });
|
|
16472
16506
|
let foundActiveComponent = false;
|
|
16473
16507
|
for (const e2 of soup) {
|
|
16474
16508
|
if (e2.type === "pcb_component" && isInsideOf(e2, rwMousePoint, 10 / transform.a)) {
|
|
@@ -16510,7 +16544,7 @@ var EditPlacementOverlay = ({
|
|
|
16510
16544
|
const x = e.clientX - rect.left;
|
|
16511
16545
|
const y = e.clientY - rect.top;
|
|
16512
16546
|
if (Number.isNaN(x) || Number.isNaN(y)) return;
|
|
16513
|
-
const rwMousePoint =
|
|
16547
|
+
const rwMousePoint = applyToPoint13(inverse4(transform), { x, y });
|
|
16514
16548
|
setDragState({
|
|
16515
16549
|
...dragState,
|
|
16516
16550
|
dragEnd: rwMousePoint
|
|
@@ -16539,7 +16573,7 @@ var EditPlacementOverlay = ({
|
|
|
16539
16573
|
children,
|
|
16540
16574
|
!disabled && soup.filter((e) => e.type === "pcb_component").map((e) => {
|
|
16541
16575
|
if (!e?.center) return null;
|
|
16542
|
-
const projectedCenter =
|
|
16576
|
+
const projectedCenter = applyToPoint13(transform, e.center);
|
|
16543
16577
|
return /* @__PURE__ */ jsx7(
|
|
16544
16578
|
"div",
|
|
16545
16579
|
{
|
|
@@ -16602,7 +16636,7 @@ var getPopupPosition = (errorCenter, containerRef) => {
|
|
|
16602
16636
|
|
|
16603
16637
|
// src/components/ErrorOverlay.tsx
|
|
16604
16638
|
import { Fragment as Fragment2, useMemo as useMemo6, useRef as useRef7 } from "react";
|
|
16605
|
-
import { applyToPoint as
|
|
16639
|
+
import { applyToPoint as applyToPoint14, identity as identity6 } from "transformation-matrix";
|
|
16606
16640
|
|
|
16607
16641
|
// src/components/FocusMarkerSVG.tsx
|
|
16608
16642
|
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
@@ -16807,7 +16841,7 @@ var ErrorOverlay = ({
|
|
|
16807
16841
|
if (!focusCenter || typeof focusCenter.x !== "number" || typeof focusCenter.y !== "number") {
|
|
16808
16842
|
return null;
|
|
16809
16843
|
}
|
|
16810
|
-
const screenCenter =
|
|
16844
|
+
const screenCenter = applyToPoint14(transform, focusCenter);
|
|
16811
16845
|
if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y)) {
|
|
16812
16846
|
return null;
|
|
16813
16847
|
}
|
|
@@ -17005,7 +17039,7 @@ var ErrorOverlay = ({
|
|
|
17005
17039
|
if (pcbComp && pcbComp.type === "pcb_component")
|
|
17006
17040
|
center = pcbComp.center || { x: 0, y: 0 };
|
|
17007
17041
|
}
|
|
17008
|
-
const screenCenter =
|
|
17042
|
+
const screenCenter = applyToPoint14(transform, center);
|
|
17009
17043
|
if (Number.isNaN(screenCenter.x) || Number.isNaN(screenCenter.y))
|
|
17010
17044
|
return null;
|
|
17011
17045
|
const scale7 = Math.abs(transform.a);
|
|
@@ -17132,7 +17166,7 @@ var ErrorOverlay = ({
|
|
|
17132
17166
|
|
|
17133
17167
|
// src/components/FocusedPcbComponentOverlay.tsx
|
|
17134
17168
|
import { useEffect as useEffect9 } from "react";
|
|
17135
|
-
import { applyToPoint as
|
|
17169
|
+
import { applyToPoint as applyToPoint15 } from "transformation-matrix";
|
|
17136
17170
|
|
|
17137
17171
|
// src/lib/get-pcb-component-focus.ts
|
|
17138
17172
|
var getPcbComponentFocus = (elements, pcbComponentId, width, height) => {
|
|
@@ -17166,8 +17200,8 @@ var FocusedPcbComponentOverlay = ({
|
|
|
17166
17200
|
}, [focusRequest, layer, selectLayer]);
|
|
17167
17201
|
if (!focus || !transform) return null;
|
|
17168
17202
|
const { bounds } = focus;
|
|
17169
|
-
const a =
|
|
17170
|
-
const b =
|
|
17203
|
+
const a = applyToPoint15(transform, { x: bounds.minX, y: bounds.minY });
|
|
17204
|
+
const b = applyToPoint15(transform, { x: bounds.maxX, y: bounds.maxY });
|
|
17171
17205
|
return /* @__PURE__ */ jsx10(
|
|
17172
17206
|
"div",
|
|
17173
17207
|
{
|
|
@@ -17200,10 +17234,10 @@ function ifSetsMatchExactly(set1, set2) {
|
|
|
17200
17234
|
|
|
17201
17235
|
// src/components/MouseElementTracker.tsx
|
|
17202
17236
|
import { useEffect as useEffect11, useMemo as useMemo8, useState as useState7 } from "react";
|
|
17203
|
-
import { applyToPoint as
|
|
17237
|
+
import { applyToPoint as applyToPoint18, inverse as inverse5 } from "transformation-matrix";
|
|
17204
17238
|
|
|
17205
17239
|
// src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
|
|
17206
|
-
import { applyToPoint as
|
|
17240
|
+
import { applyToPoint as applyToPoint16 } from "transformation-matrix";
|
|
17207
17241
|
|
|
17208
17242
|
// src/components/AnchorOffsetOverlay/common/constants.ts
|
|
17209
17243
|
var VISUAL_CONFIG = {
|
|
@@ -17248,7 +17282,7 @@ var AnchorOffsetOverlay = ({
|
|
|
17248
17282
|
const anchorScreens = /* @__PURE__ */ new Map();
|
|
17249
17283
|
targets.forEach((target) => {
|
|
17250
17284
|
if (!anchorScreens.has(target.anchor_id)) {
|
|
17251
|
-
const screenPoint =
|
|
17285
|
+
const screenPoint = applyToPoint16(transform, target.anchor);
|
|
17252
17286
|
anchorScreens.set(target.anchor_id, screenPoint);
|
|
17253
17287
|
}
|
|
17254
17288
|
});
|
|
@@ -17282,7 +17316,7 @@ var AnchorOffsetOverlay = ({
|
|
|
17282
17316
|
const anchorKey = target.anchor_id;
|
|
17283
17317
|
const targetCenter = target.target;
|
|
17284
17318
|
const anchorMarkerScreen = anchorScreens.get(anchorKey);
|
|
17285
|
-
const targetScreen =
|
|
17319
|
+
const targetScreen = applyToPoint16(transform, targetCenter);
|
|
17286
17320
|
const offsetX = targetCenter.x - anchorPosition.x;
|
|
17287
17321
|
const offsetY = targetCenter.y - anchorPosition.y;
|
|
17288
17322
|
const xLineLength = Math.abs(targetScreen.x - anchorMarkerScreen.x);
|
|
@@ -17660,7 +17694,7 @@ var GroupAnchorOffsetOverlay = ({
|
|
|
17660
17694
|
};
|
|
17661
17695
|
|
|
17662
17696
|
// src/components/AnchorOffsetOverlay/ComponentBoundingBoxOverlay.tsx
|
|
17663
|
-
import { applyToPoint as
|
|
17697
|
+
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
17664
17698
|
import { jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
17665
17699
|
var calculateComponentBoundingBox = (component, elements) => {
|
|
17666
17700
|
const componentId = component.pcb_component_id;
|
|
@@ -17724,11 +17758,11 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
17724
17758
|
width: containerWidth,
|
|
17725
17759
|
height: containerHeight,
|
|
17726
17760
|
children: renderData.map(({ component, bbox, group }) => {
|
|
17727
|
-
const topLeft =
|
|
17761
|
+
const topLeft = applyToPoint17(transform, {
|
|
17728
17762
|
x: bbox.minX,
|
|
17729
17763
|
y: bbox.maxY
|
|
17730
17764
|
});
|
|
17731
|
-
const bottomRight =
|
|
17765
|
+
const bottomRight = applyToPoint17(transform, {
|
|
17732
17766
|
x: bbox.maxX,
|
|
17733
17767
|
y: bbox.minY
|
|
17734
17768
|
});
|
|
@@ -17742,7 +17776,7 @@ var ComponentBoundingBoxOverlay = ({
|
|
|
17742
17776
|
x: (bbox.minX + bbox.maxX) / 2,
|
|
17743
17777
|
y: (bbox.minY + bbox.maxY) / 2
|
|
17744
17778
|
};
|
|
17745
|
-
const componentCenterScreen =
|
|
17779
|
+
const componentCenterScreen = applyToPoint17(transform, componentCenter);
|
|
17746
17780
|
return /* @__PURE__ */ jsxs9("g", { children: [
|
|
17747
17781
|
/* @__PURE__ */ jsx14(
|
|
17748
17782
|
"rect",
|
|
@@ -18232,8 +18266,9 @@ var getPrimitivesUnderPoint = ({
|
|
|
18232
18266
|
w = primitive.r * 2;
|
|
18233
18267
|
h = primitive.r * 2;
|
|
18234
18268
|
} else if ("rX" in primitive && "rY" in primitive) {
|
|
18235
|
-
|
|
18236
|
-
|
|
18269
|
+
const bounds = getPrimitiveBoundingBox(primitive);
|
|
18270
|
+
w = bounds.maxX - bounds.minX;
|
|
18271
|
+
h = bounds.maxY - bounds.minY;
|
|
18237
18272
|
} else {
|
|
18238
18273
|
continue;
|
|
18239
18274
|
}
|
|
@@ -18301,7 +18336,7 @@ var MouseElementTracker = ({
|
|
|
18301
18336
|
h = "h" in primitive ? primitive.h : "r" in primitive ? primitive.r * 2 : "rX" in primitive && "rY" in primitive ? primitive.rY * 2 : 0;
|
|
18302
18337
|
}
|
|
18303
18338
|
if (!basePoint) continue;
|
|
18304
|
-
const screenPos =
|
|
18339
|
+
const screenPos = applyToPoint18(transform, basePoint);
|
|
18305
18340
|
const screenSize = {
|
|
18306
18341
|
w: w * transform.a,
|
|
18307
18342
|
h: h * transform.a
|
|
@@ -18330,7 +18365,7 @@ var MouseElementTracker = ({
|
|
|
18330
18365
|
}) => {
|
|
18331
18366
|
const { x, y } = screenPoint;
|
|
18332
18367
|
setMousePos({ x, y });
|
|
18333
|
-
const rwPoint =
|
|
18368
|
+
const rwPoint = applyToPoint18(inverse5(transform2), { x, y });
|
|
18334
18369
|
const nearbyPrimitives = getPrimitivesNearPoint({
|
|
18335
18370
|
point: rwPoint,
|
|
18336
18371
|
realToScreenScale: transform2.a,
|
|
@@ -18433,7 +18468,7 @@ var MouseElementTracker = ({
|
|
|
18433
18468
|
|
|
18434
18469
|
// src/components/PcbGroupOverlay.tsx
|
|
18435
18470
|
import { useEffect as useEffect12, useMemo as useMemo9, useRef as useRef8 } from "react";
|
|
18436
|
-
import { applyToPoint as
|
|
18471
|
+
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
18437
18472
|
import { identity as identity7 } from "transformation-matrix";
|
|
18438
18473
|
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
18439
18474
|
var GROUP_COLORS = [
|
|
@@ -18603,10 +18638,10 @@ var PcbGroupOverlay = ({
|
|
|
18603
18638
|
minY -= totalPadding;
|
|
18604
18639
|
maxY += totalPadding;
|
|
18605
18640
|
}
|
|
18606
|
-
const topLeft =
|
|
18607
|
-
const topRight =
|
|
18608
|
-
const bottomLeft =
|
|
18609
|
-
const bottomRight =
|
|
18641
|
+
const topLeft = applyToPoint19(transform, { x: minX, y: maxY });
|
|
18642
|
+
const topRight = applyToPoint19(transform, { x: maxX, y: maxY });
|
|
18643
|
+
const bottomLeft = applyToPoint19(transform, { x: minX, y: minY });
|
|
18644
|
+
const bottomRight = applyToPoint19(transform, { x: maxX, y: minY });
|
|
18610
18645
|
const groupColor = GROUP_COLORS[groupIndex % GROUP_COLORS.length];
|
|
18611
18646
|
ctx.strokeStyle = groupColor;
|
|
18612
18647
|
ctx.lineWidth = 2;
|
|
@@ -18656,7 +18691,7 @@ var PcbGroupOverlay = ({
|
|
|
18656
18691
|
x: group.anchor_position[0] ?? 0,
|
|
18657
18692
|
y: group.anchor_position[1] ?? 0
|
|
18658
18693
|
} : { x: group.anchor_position.x, y: group.anchor_position.y };
|
|
18659
|
-
const anchorScreenPos =
|
|
18694
|
+
const anchorScreenPos = applyToPoint19(transform, anchorPositionValue);
|
|
18660
18695
|
ctx.strokeStyle = "white";
|
|
18661
18696
|
ctx.lineWidth = 1.5;
|
|
18662
18697
|
ctx.setLineDash([]);
|
|
@@ -18710,7 +18745,7 @@ var PcbGroupOverlay = ({
|
|
|
18710
18745
|
};
|
|
18711
18746
|
|
|
18712
18747
|
// src/components/RatsNestOverlay.tsx
|
|
18713
|
-
import { applyToPoint as
|
|
18748
|
+
import { applyToPoint as applyToPoint20, identity as identity8 } from "transformation-matrix";
|
|
18714
18749
|
import { useMemo as useMemo10 } from "react";
|
|
18715
18750
|
import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
18716
18751
|
var RatsNestOverlay = ({
|
|
@@ -18793,8 +18828,8 @@ var RatsNestOverlay = ({
|
|
|
18793
18828
|
zIndex: zIndexMap.ratsNestOverlay
|
|
18794
18829
|
},
|
|
18795
18830
|
children: ratsNestLines.map(({ key, startPoint, endPoint, isInNet }) => {
|
|
18796
|
-
const transformedStart =
|
|
18797
|
-
const transformedEnd =
|
|
18831
|
+
const transformedStart = applyToPoint20(transform, startPoint);
|
|
18832
|
+
const transformedEnd = applyToPoint20(transform, endPoint);
|
|
18798
18833
|
return /* @__PURE__ */ jsx19(
|
|
18799
18834
|
"line",
|
|
18800
18835
|
{
|
|
@@ -20736,7 +20771,7 @@ var getPcbWarningHighlightLabel = (warning) => {
|
|
|
20736
20771
|
|
|
20737
20772
|
// src/components/WarningGraphicsOverlay.tsx
|
|
20738
20773
|
import { useEffect as useEffect18, useMemo as useMemo13, useRef as useRef14 } from "react";
|
|
20739
|
-
import { applyToPoint as
|
|
20774
|
+
import { applyToPoint as applyToPoint21, identity as identity9 } from "transformation-matrix";
|
|
20740
20775
|
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
20741
20776
|
var WarningGraphicsOverlay = ({
|
|
20742
20777
|
children,
|
|
@@ -20774,7 +20809,7 @@ var WarningGraphicsOverlay = ({
|
|
|
20774
20809
|
const component = pcbComponentById.get(warning.pcb_component_id);
|
|
20775
20810
|
if (!component) return;
|
|
20776
20811
|
const { width: width2, height: height2, center } = component;
|
|
20777
|
-
const transformedCenter =
|
|
20812
|
+
const transformedCenter = applyToPoint21(transform, center);
|
|
20778
20813
|
const scaledWidth = width2 * Math.abs(transform.a);
|
|
20779
20814
|
const scaledHeight = height2 * Math.abs(transform.d);
|
|
20780
20815
|
const boxPadding = 0.1 * Math.abs(transform.a);
|
|
@@ -21109,7 +21144,7 @@ function getHitTestCandidates({
|
|
|
21109
21144
|
transform
|
|
21110
21145
|
}) {
|
|
21111
21146
|
if (!transform) return null;
|
|
21112
|
-
const realWorldPoint =
|
|
21147
|
+
const realWorldPoint = applyToPoint22(inverse6(transform), screenPoint);
|
|
21113
21148
|
return {
|
|
21114
21149
|
primitives: getPrimitivesNearPoint({
|
|
21115
21150
|
point: realWorldPoint,
|
|
@@ -21213,7 +21248,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
21213
21248
|
if (isShowingCopperPours && copperPourOpacity > 0) {
|
|
21214
21249
|
for (const pour of getCopperPoursUnderPoint(
|
|
21215
21250
|
elementsToRender,
|
|
21216
|
-
|
|
21251
|
+
applyToPoint22(inverse6(transform), point2),
|
|
21217
21252
|
selectedLayer
|
|
21218
21253
|
).reverse()) {
|
|
21219
21254
|
const net = getElementNetId(pour, connectivityMap);
|
|
@@ -21503,7 +21538,7 @@ function useAnimationFrameTransformState(initialTransform) {
|
|
|
21503
21538
|
|
|
21504
21539
|
// src/PCBViewer.tsx
|
|
21505
21540
|
import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
21506
|
-
var defaultTransform =
|
|
21541
|
+
var defaultTransform = compose11(translate15(400, 300), scale6(40, -40));
|
|
21507
21542
|
var getPreferredRenderer = () => {
|
|
21508
21543
|
const stored = getStoredString(STORAGE_KEYS.RENDERING_ENGINE, "webgpu");
|
|
21509
21544
|
return stored === "canvas" || stored === "webgpu" ? stored : "webgpu";
|
|
@@ -21598,10 +21633,10 @@ var PCBViewer = ({
|
|
|
21598
21633
|
(elmBounds.height ?? 0) / height2,
|
|
21599
21634
|
100
|
|
21600
21635
|
) * 0.75;
|
|
21601
|
-
const targetTransform =
|
|
21602
|
-
|
|
21636
|
+
const targetTransform = compose11(
|
|
21637
|
+
translate15((elmBounds.width ?? 0) / 2, (elmBounds.height ?? 0) / 2),
|
|
21603
21638
|
scale6(scaleFactor, -scaleFactor, 0, 0),
|
|
21604
|
-
|
|
21639
|
+
translate15(-center.x, -center.y)
|
|
21605
21640
|
);
|
|
21606
21641
|
setTransform(targetTransform);
|
|
21607
21642
|
return;
|