@tscircuit/pcb-viewer 1.11.109 → 1.11.110
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 +375 -215
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(dist_exports, {
|
|
|
35
35
|
pcb_hole_circle_or_square_shape: () => pcb_hole_circle_or_square_shape,
|
|
36
36
|
pcb_hole_oval_shape: () => pcb_hole_oval_shape,
|
|
37
37
|
pcb_keepout: () => pcb_keepout,
|
|
38
|
-
|
|
38
|
+
pcb_manual_edit_conflict_warning: () => pcb_manual_edit_conflict_warning,
|
|
39
39
|
pcb_missing_footprint_error: () => pcb_missing_footprint_error,
|
|
40
40
|
pcb_placement_error: () => pcb_placement_error,
|
|
41
41
|
pcb_plated_hole: () => pcb_plated_hole,
|
|
@@ -79,6 +79,7 @@ __export(dist_exports, {
|
|
|
79
79
|
schematic_debug_rect: () => schematic_debug_rect,
|
|
80
80
|
schematic_error: () => schematic_error,
|
|
81
81
|
schematic_line: () => schematic_line,
|
|
82
|
+
schematic_manual_edit_conflict_warning: () => schematic_manual_edit_conflict_warning,
|
|
82
83
|
schematic_net_label: () => schematic_net_label,
|
|
83
84
|
schematic_path: () => schematic_path,
|
|
84
85
|
schematic_pin_styles: () => schematic_pin_styles,
|
|
@@ -92,6 +93,7 @@ __export(dist_exports, {
|
|
|
92
93
|
source_led: () => source_led,
|
|
93
94
|
source_net: () => source_net,
|
|
94
95
|
source_port: () => source_port,
|
|
96
|
+
source_project_metadata: () => source_project_metadata,
|
|
95
97
|
source_simple_battery: () => source_simple_battery,
|
|
96
98
|
source_simple_bug: () => source_simple_bug,
|
|
97
99
|
source_simple_capacitor: () => source_simple_capacitor,
|
|
@@ -4447,6 +4449,18 @@ expectTypesMatch("extra props b");
|
|
|
4447
4449
|
expectTypesMatch("missing props b");
|
|
4448
4450
|
expectTypesMatch(true);
|
|
4449
4451
|
expectTypesMatch("mismatched prop types: a");
|
|
4452
|
+
var expectStringUnionsMatch = (shouldBe) => {
|
|
4453
|
+
};
|
|
4454
|
+
expectStringUnionsMatch(true);
|
|
4455
|
+
expectStringUnionsMatch(
|
|
4456
|
+
'T1 has extra: "c", T2 has extra: "d"'
|
|
4457
|
+
);
|
|
4458
|
+
expectStringUnionsMatch('T1 has extra: "c"');
|
|
4459
|
+
expectStringUnionsMatch('T2 has extra: "c"');
|
|
4460
|
+
expectStringUnionsMatch(
|
|
4461
|
+
'T1 has extra: "d", T2 has extra: "c"'
|
|
4462
|
+
);
|
|
4463
|
+
expectStringUnionsMatch(true);
|
|
4450
4464
|
var source_component_base = z.object({
|
|
4451
4465
|
type: z.literal("source_component"),
|
|
4452
4466
|
ftype: z.string().optional(),
|
|
@@ -4546,6 +4560,13 @@ var source_simple_switch = source_component_base.extend({
|
|
|
4546
4560
|
ftype: z.literal("simple_switch")
|
|
4547
4561
|
});
|
|
4548
4562
|
expectTypesMatch(true);
|
|
4563
|
+
var source_project_metadata = z.object({
|
|
4564
|
+
type: z.literal("source_project_metadata"),
|
|
4565
|
+
name: z.string().optional(),
|
|
4566
|
+
software_used_string: z.string().optional(),
|
|
4567
|
+
created_at: z.string().datetime().optional()
|
|
4568
|
+
});
|
|
4569
|
+
expectTypesMatch(true);
|
|
4549
4570
|
var any_source_component = z.union([
|
|
4550
4571
|
source_simple_resistor,
|
|
4551
4572
|
source_simple_capacitor,
|
|
@@ -4564,7 +4585,8 @@ var any_source_component = z.union([
|
|
|
4564
4585
|
source_simple_resonator,
|
|
4565
4586
|
source_simple_switch,
|
|
4566
4587
|
source_simple_transistor,
|
|
4567
|
-
source_simple_mosfet
|
|
4588
|
+
source_simple_mosfet,
|
|
4589
|
+
source_project_metadata
|
|
4568
4590
|
]);
|
|
4569
4591
|
var source_port = z.object({
|
|
4570
4592
|
type: z.literal("source_port"),
|
|
@@ -4584,6 +4606,7 @@ var source_trace = z.object({
|
|
|
4584
4606
|
subcircuit_id: z.string().optional(),
|
|
4585
4607
|
subcircuit_connectivity_map_key: z.string().optional(),
|
|
4586
4608
|
max_length: z.number().optional(),
|
|
4609
|
+
min_trace_thickness: z.number().optional(),
|
|
4587
4610
|
display_name: z.string().optional()
|
|
4588
4611
|
});
|
|
4589
4612
|
expectTypesMatch(true);
|
|
@@ -4794,6 +4817,20 @@ var schematic_voltage_probe = z.object({
|
|
|
4794
4817
|
voltage: voltage.optional()
|
|
4795
4818
|
}).describe("Defines a voltage probe measurement point on a schematic trace");
|
|
4796
4819
|
expectTypesMatch(true);
|
|
4820
|
+
var schematic_manual_edit_conflict_warning = z.object({
|
|
4821
|
+
type: z.literal("schematic_manual_edit_conflict_warning"),
|
|
4822
|
+
schematic_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
|
|
4823
|
+
"schematic_manual_edit_conflict_warning"
|
|
4824
|
+
),
|
|
4825
|
+
message: z.string(),
|
|
4826
|
+
schematic_component_id: z.string(),
|
|
4827
|
+
schematic_group_id: z.string().optional(),
|
|
4828
|
+
subcircuit_id: z.string().optional(),
|
|
4829
|
+
source_component_id: z.string()
|
|
4830
|
+
}).describe(
|
|
4831
|
+
"Warning emitted when a component has both manual placement and explicit schX/schY coordinates"
|
|
4832
|
+
);
|
|
4833
|
+
expectTypesMatch(true);
|
|
4797
4834
|
var all_layers = [
|
|
4798
4835
|
"top",
|
|
4799
4836
|
"bottom",
|
|
@@ -4922,6 +4959,25 @@ var pcb_circular_hole_with_rect_pad = z.object({
|
|
|
4922
4959
|
pcb_port_id: z.string().optional(),
|
|
4923
4960
|
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
4924
4961
|
});
|
|
4962
|
+
var pcb_pill_hole_with_rect_pad = z.object({
|
|
4963
|
+
type: z.literal("pcb_plated_hole"),
|
|
4964
|
+
shape: z.literal("pill_hole_with_rect_pad"),
|
|
4965
|
+
pcb_group_id: z.string().optional(),
|
|
4966
|
+
subcircuit_id: z.string().optional(),
|
|
4967
|
+
hole_shape: z.literal("pill"),
|
|
4968
|
+
pad_shape: z.literal("rect"),
|
|
4969
|
+
hole_width: z.number(),
|
|
4970
|
+
hole_height: z.number(),
|
|
4971
|
+
rect_pad_width: z.number(),
|
|
4972
|
+
rect_pad_height: z.number(),
|
|
4973
|
+
x: distance,
|
|
4974
|
+
y: distance,
|
|
4975
|
+
layers: z.array(layer_ref),
|
|
4976
|
+
port_hints: z.array(z.string()).optional(),
|
|
4977
|
+
pcb_component_id: z.string().optional(),
|
|
4978
|
+
pcb_port_id: z.string().optional(),
|
|
4979
|
+
pcb_plated_hole_id: getZodPrefixedIdWithDefault("pcb_plated_hole")
|
|
4980
|
+
});
|
|
4925
4981
|
var pcb_plated_hole = z.union([
|
|
4926
4982
|
pcb_plated_hole_circle,
|
|
4927
4983
|
pcb_plated_hole_oval,
|
|
@@ -5160,7 +5216,8 @@ var pcb_board = z.object({
|
|
|
5160
5216
|
center: point,
|
|
5161
5217
|
thickness: length.optional().default(1.4),
|
|
5162
5218
|
num_layers: z.number().optional().default(4),
|
|
5163
|
-
outline: z.array(point).optional()
|
|
5219
|
+
outline: z.array(point).optional(),
|
|
5220
|
+
material: z.enum(["fr4", "fr1"]).default("fr4")
|
|
5164
5221
|
}).describe("Defines the board outline of the PCB");
|
|
5165
5222
|
expectTypesMatch(true);
|
|
5166
5223
|
var pcb_placement_error = z.object({
|
|
@@ -5209,7 +5266,6 @@ var pcb_silkscreen_text = z.object({
|
|
|
5209
5266
|
subcircuit_id: z.string().optional(),
|
|
5210
5267
|
font: z.literal("tscircuit2024").default("tscircuit2024"),
|
|
5211
5268
|
font_size: distance.default("0.2mm"),
|
|
5212
|
-
stroke_width: length.optional().default("1mm"),
|
|
5213
5269
|
pcb_component_id: z.string(),
|
|
5214
5270
|
text: z.string(),
|
|
5215
5271
|
ccw_rotation: z.number().optional(),
|
|
@@ -5334,18 +5390,6 @@ var pcb_missing_footprint_error = z.object({
|
|
|
5334
5390
|
expectTypesMatch(
|
|
5335
5391
|
true
|
|
5336
5392
|
);
|
|
5337
|
-
var pcb_manual_edit_conflict_error = z.object({
|
|
5338
|
-
type: z.literal("pcb_manual_edit_conflict_error"),
|
|
5339
|
-
pcb_error_id: getZodPrefixedIdWithDefault("pcb_manual_edit_conflict_error"),
|
|
5340
|
-
message: z.string(),
|
|
5341
|
-
pcb_component_id: z.string(),
|
|
5342
|
-
pcb_group_id: z.string().optional(),
|
|
5343
|
-
subcircuit_id: z.string().optional(),
|
|
5344
|
-
source_component_id: z.string()
|
|
5345
|
-
}).describe(
|
|
5346
|
-
"Error emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"
|
|
5347
|
-
);
|
|
5348
|
-
expectTypesMatch(true);
|
|
5349
5393
|
var pcb_group = z.object({
|
|
5350
5394
|
type: z.literal("pcb_group"),
|
|
5351
5395
|
pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
|
|
@@ -5366,6 +5410,20 @@ var pcb_autorouting_error = z.object({
|
|
|
5366
5410
|
message: z.string()
|
|
5367
5411
|
}).describe("The autorouting has failed to route a portion of the board");
|
|
5368
5412
|
expectTypesMatch(true);
|
|
5413
|
+
var pcb_manual_edit_conflict_warning = z.object({
|
|
5414
|
+
type: z.literal("pcb_manual_edit_conflict_warning"),
|
|
5415
|
+
pcb_manual_edit_conflict_warning_id: getZodPrefixedIdWithDefault(
|
|
5416
|
+
"pcb_manual_edit_conflict_warning"
|
|
5417
|
+
),
|
|
5418
|
+
message: z.string(),
|
|
5419
|
+
pcb_component_id: z.string(),
|
|
5420
|
+
pcb_group_id: z.string().optional(),
|
|
5421
|
+
subcircuit_id: z.string().optional(),
|
|
5422
|
+
source_component_id: z.string()
|
|
5423
|
+
}).describe(
|
|
5424
|
+
"Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"
|
|
5425
|
+
);
|
|
5426
|
+
expectTypesMatch(true);
|
|
5369
5427
|
var cad_component = z.object({
|
|
5370
5428
|
type: z.literal("cad_component"),
|
|
5371
5429
|
cad_component_id: z.string(),
|
|
@@ -5404,10 +5462,11 @@ var any_circuit_element = z.union([
|
|
|
5404
5462
|
source_simple_mosfet,
|
|
5405
5463
|
source_simple_potentiometer,
|
|
5406
5464
|
source_simple_push_button,
|
|
5465
|
+
source_project_metadata,
|
|
5407
5466
|
pcb_component,
|
|
5408
5467
|
pcb_hole,
|
|
5409
5468
|
pcb_missing_footprint_error,
|
|
5410
|
-
|
|
5469
|
+
pcb_manual_edit_conflict_warning,
|
|
5411
5470
|
pcb_plated_hole,
|
|
5412
5471
|
pcb_keepout,
|
|
5413
5472
|
pcb_port,
|
|
@@ -5442,9 +5501,12 @@ var any_circuit_element = z.union([
|
|
|
5442
5501
|
schematic_net_label,
|
|
5443
5502
|
schematic_debug_object,
|
|
5444
5503
|
schematic_voltage_probe,
|
|
5504
|
+
schematic_manual_edit_conflict_warning,
|
|
5445
5505
|
cad_component
|
|
5446
5506
|
]);
|
|
5447
5507
|
var any_soup_element = any_circuit_element;
|
|
5508
|
+
expectTypesMatch(true);
|
|
5509
|
+
expectStringUnionsMatch(true);
|
|
5448
5510
|
|
|
5449
5511
|
// node_modules/@tscircuit/soup-util/dist/index.js
|
|
5450
5512
|
import { applyToPoint, decomposeTSR } from "transformation-matrix";
|
|
@@ -5845,7 +5907,7 @@ var ToastContainer = () => {
|
|
|
5845
5907
|
};
|
|
5846
5908
|
|
|
5847
5909
|
// src/PCBViewer.tsx
|
|
5848
|
-
import { useEffect as
|
|
5910
|
+
import { useEffect as useEffect14, useMemo as useMemo6, useRef as useRef9, useState as useState10 } from "react";
|
|
5849
5911
|
|
|
5850
5912
|
// node_modules/react-use/esm/misc/util.js
|
|
5851
5913
|
var noop = function() {
|
|
@@ -7072,6 +7134,7 @@ var zIndexMap = {
|
|
|
7072
7134
|
errorOverlay: 30,
|
|
7073
7135
|
ratsNestOverlay: 20,
|
|
7074
7136
|
toolbarOverlay: 20,
|
|
7137
|
+
warnings: 20,
|
|
7075
7138
|
topLayer: 10
|
|
7076
7139
|
// each layer after this is 1 less than the previous
|
|
7077
7140
|
};
|
|
@@ -7789,25 +7852,113 @@ var DebugGraphicsOverlay = ({
|
|
|
7789
7852
|
);
|
|
7790
7853
|
};
|
|
7791
7854
|
|
|
7855
|
+
// src/components/WarningGraphicsOverlay.tsx
|
|
7856
|
+
import { useEffect as useEffect6, useRef as useRef4 } from "react";
|
|
7857
|
+
import { applyToPoint as applyToPoint5, identity as identity3 } from "transformation-matrix";
|
|
7858
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
7859
|
+
var WarningGraphicsOverlay = ({
|
|
7860
|
+
children,
|
|
7861
|
+
transform = identity3(),
|
|
7862
|
+
elements = []
|
|
7863
|
+
}) => {
|
|
7864
|
+
const [containerRef, { width, height }] = useMeasure_default();
|
|
7865
|
+
const canvasRef = useRef4(null);
|
|
7866
|
+
useEffect6(() => {
|
|
7867
|
+
const canvas = canvasRef.current;
|
|
7868
|
+
if (!canvas || !width || !height) return;
|
|
7869
|
+
canvas.width = width;
|
|
7870
|
+
canvas.height = height;
|
|
7871
|
+
const ctx = canvas.getContext("2d");
|
|
7872
|
+
if (!ctx) return;
|
|
7873
|
+
ctx.clearRect(0, 0, width, height);
|
|
7874
|
+
const pcbComponents = elements.filter(
|
|
7875
|
+
(el) => el.type === "pcb_component"
|
|
7876
|
+
);
|
|
7877
|
+
const warnings = elements.filter(
|
|
7878
|
+
(el) => el.type === "pcb_manual_edit_conflict_warning"
|
|
7879
|
+
);
|
|
7880
|
+
ctx.strokeStyle = colors_default.board.drc_warning;
|
|
7881
|
+
ctx.lineWidth = 2;
|
|
7882
|
+
warnings.forEach((warning) => {
|
|
7883
|
+
const component = pcbComponents.find(
|
|
7884
|
+
(comp) => comp.pcb_component_id === warning.pcb_component_id
|
|
7885
|
+
);
|
|
7886
|
+
if (!component) return;
|
|
7887
|
+
const { width: width2, height: height2, center } = component;
|
|
7888
|
+
const transformedCenter = applyToPoint5(transform, center);
|
|
7889
|
+
const scaledWidth = width2 * Math.abs(transform.a);
|
|
7890
|
+
const scaledHeight = height2 * Math.abs(transform.d);
|
|
7891
|
+
const boxPadding = 0.1 * Math.abs(transform.a);
|
|
7892
|
+
const boxWidth = scaledWidth + boxPadding * 2;
|
|
7893
|
+
const boxHeight = scaledHeight + boxPadding * 2;
|
|
7894
|
+
const x = transformedCenter.x - boxWidth / 2;
|
|
7895
|
+
const y = transformedCenter.y - boxHeight / 2;
|
|
7896
|
+
ctx.beginPath();
|
|
7897
|
+
ctx.rect(x, y, boxWidth, boxHeight);
|
|
7898
|
+
ctx.stroke();
|
|
7899
|
+
const labelText = "Manual Edit Conflict";
|
|
7900
|
+
const labelPadding = 4;
|
|
7901
|
+
const fontSize = Math.max(8, Math.min(12, 10 * Math.abs(transform.a)));
|
|
7902
|
+
ctx.font = `${fontSize}px sans-serif`;
|
|
7903
|
+
const labelMetrics = ctx.measureText(labelText);
|
|
7904
|
+
const labelWidth = labelMetrics.width + labelPadding * 2;
|
|
7905
|
+
const labelHeight = fontSize + labelPadding * 2;
|
|
7906
|
+
const labelX = x + (boxWidth - labelWidth) / 2;
|
|
7907
|
+
const labelY = y + boxHeight + 5;
|
|
7908
|
+
ctx.fillStyle = "rgba(0, 0, 0, 0.7)";
|
|
7909
|
+
ctx.beginPath();
|
|
7910
|
+
ctx.roundRect(labelX, labelY, labelWidth, labelHeight, 3);
|
|
7911
|
+
ctx.fill();
|
|
7912
|
+
ctx.fillStyle = colors_default.board.drc_warning;
|
|
7913
|
+
ctx.textAlign = "center";
|
|
7914
|
+
ctx.textBaseline = "middle";
|
|
7915
|
+
ctx.fillText(labelText, labelX + labelWidth / 2, labelY + labelHeight / 2);
|
|
7916
|
+
});
|
|
7917
|
+
}, [elements, transform, width, height]);
|
|
7918
|
+
return /* @__PURE__ */ jsxs3(
|
|
7919
|
+
"div",
|
|
7920
|
+
{
|
|
7921
|
+
ref: containerRef,
|
|
7922
|
+
style: { position: "relative", width: "100%", height: "100%" },
|
|
7923
|
+
children: [
|
|
7924
|
+
children,
|
|
7925
|
+
/* @__PURE__ */ jsx5(
|
|
7926
|
+
"canvas",
|
|
7927
|
+
{
|
|
7928
|
+
ref: canvasRef,
|
|
7929
|
+
style: {
|
|
7930
|
+
position: "absolute",
|
|
7931
|
+
top: 0,
|
|
7932
|
+
left: 0,
|
|
7933
|
+
pointerEvents: "none",
|
|
7934
|
+
zIndex: zIndexMap.warnings
|
|
7935
|
+
}
|
|
7936
|
+
}
|
|
7937
|
+
)
|
|
7938
|
+
]
|
|
7939
|
+
}
|
|
7940
|
+
);
|
|
7941
|
+
};
|
|
7942
|
+
|
|
7792
7943
|
// src/components/DimensionOverlay.tsx
|
|
7793
|
-
import { useEffect as
|
|
7794
|
-
import { applyToPoint as
|
|
7795
|
-
import { Fragment, jsx as
|
|
7944
|
+
import { useEffect as useEffect7, useRef as useRef5, useState as useState3 } from "react";
|
|
7945
|
+
import { applyToPoint as applyToPoint6, identity as identity4, inverse as inverse2 } from "transformation-matrix";
|
|
7946
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
7796
7947
|
var DimensionOverlay = ({
|
|
7797
7948
|
children,
|
|
7798
7949
|
transform,
|
|
7799
7950
|
focusOnHover = false
|
|
7800
7951
|
}) => {
|
|
7801
|
-
if (!transform) transform =
|
|
7952
|
+
if (!transform) transform = identity4();
|
|
7802
7953
|
const [dimensionToolVisible, setDimensionToolVisible] = useState3(false);
|
|
7803
7954
|
const [dimensionToolStretching, setDimensionToolStretching] = useState3(false);
|
|
7804
7955
|
const [dStart, setDStart] = useState3({ x: 0, y: 0 });
|
|
7805
7956
|
const [dEnd, setDEnd] = useState3({ x: 0, y: 0 });
|
|
7806
|
-
const mousePosRef =
|
|
7807
|
-
const containerRef =
|
|
7957
|
+
const mousePosRef = useRef5({ x: 0, y: 0 });
|
|
7958
|
+
const containerRef = useRef5(null);
|
|
7808
7959
|
const container = containerRef.current;
|
|
7809
7960
|
const containerBounds = container?.getBoundingClientRect();
|
|
7810
|
-
|
|
7961
|
+
useEffect7(() => {
|
|
7811
7962
|
const container2 = containerRef.current;
|
|
7812
7963
|
const down = (e) => {
|
|
7813
7964
|
if (e.key === "d") {
|
|
@@ -7846,8 +7997,8 @@ var DimensionOverlay = ({
|
|
|
7846
7997
|
}
|
|
7847
7998
|
};
|
|
7848
7999
|
}, [containerRef]);
|
|
7849
|
-
const screenDStart =
|
|
7850
|
-
const screenDEnd =
|
|
8000
|
+
const screenDStart = applyToPoint6(transform, dStart);
|
|
8001
|
+
const screenDEnd = applyToPoint6(transform, dEnd);
|
|
7851
8002
|
const arrowScreenBounds = {
|
|
7852
8003
|
left: Math.min(screenDStart.x, screenDEnd.x),
|
|
7853
8004
|
right: Math.max(screenDStart.x, screenDEnd.x),
|
|
@@ -7860,7 +8011,7 @@ var DimensionOverlay = ({
|
|
|
7860
8011
|
};
|
|
7861
8012
|
arrowScreenBounds.width = arrowScreenBounds.right - arrowScreenBounds.left;
|
|
7862
8013
|
arrowScreenBounds.height = arrowScreenBounds.bottom - arrowScreenBounds.top;
|
|
7863
|
-
return /* @__PURE__ */
|
|
8014
|
+
return /* @__PURE__ */ jsxs4(
|
|
7864
8015
|
"div",
|
|
7865
8016
|
{
|
|
7866
8017
|
ref: containerRef,
|
|
@@ -7880,7 +8031,7 @@ var DimensionOverlay = ({
|
|
|
7880
8031
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
7881
8032
|
const x = e.clientX - rect.left;
|
|
7882
8033
|
const y = e.clientY - rect.top;
|
|
7883
|
-
const rwPoint =
|
|
8034
|
+
const rwPoint = applyToPoint6(inverse2(transform), { x, y });
|
|
7884
8035
|
mousePosRef.current.x = rwPoint.x;
|
|
7885
8036
|
mousePosRef.current.y = rwPoint.y;
|
|
7886
8037
|
if (dimensionToolStretching) {
|
|
@@ -7896,8 +8047,8 @@ var DimensionOverlay = ({
|
|
|
7896
8047
|
},
|
|
7897
8048
|
children: [
|
|
7898
8049
|
children,
|
|
7899
|
-
dimensionToolVisible && /* @__PURE__ */
|
|
7900
|
-
/* @__PURE__ */
|
|
8050
|
+
dimensionToolVisible && /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
8051
|
+
/* @__PURE__ */ jsx6(
|
|
7901
8052
|
"div",
|
|
7902
8053
|
{
|
|
7903
8054
|
style: {
|
|
@@ -7917,7 +8068,7 @@ var DimensionOverlay = ({
|
|
|
7917
8068
|
children: Math.abs(dStart.x - dEnd.x).toFixed(2)
|
|
7918
8069
|
}
|
|
7919
8070
|
),
|
|
7920
|
-
/* @__PURE__ */
|
|
8071
|
+
/* @__PURE__ */ jsx6(
|
|
7921
8072
|
"div",
|
|
7922
8073
|
{
|
|
7923
8074
|
style: {
|
|
@@ -7935,7 +8086,7 @@ var DimensionOverlay = ({
|
|
|
7935
8086
|
fontFamily: "sans-serif",
|
|
7936
8087
|
zIndex: zIndexMap.dimensionOverlay
|
|
7937
8088
|
},
|
|
7938
|
-
children: /* @__PURE__ */
|
|
8089
|
+
children: /* @__PURE__ */ jsx6(
|
|
7939
8090
|
"div",
|
|
7940
8091
|
{
|
|
7941
8092
|
style: {
|
|
@@ -7947,7 +8098,7 @@ var DimensionOverlay = ({
|
|
|
7947
8098
|
)
|
|
7948
8099
|
}
|
|
7949
8100
|
),
|
|
7950
|
-
/* @__PURE__ */
|
|
8101
|
+
/* @__PURE__ */ jsxs4(
|
|
7951
8102
|
"svg",
|
|
7952
8103
|
{
|
|
7953
8104
|
style: {
|
|
@@ -7961,7 +8112,7 @@ var DimensionOverlay = ({
|
|
|
7961
8112
|
width: containerBounds.width,
|
|
7962
8113
|
height: containerBounds.height,
|
|
7963
8114
|
children: [
|
|
7964
|
-
/* @__PURE__ */
|
|
8115
|
+
/* @__PURE__ */ jsx6("defs", { children: /* @__PURE__ */ jsx6(
|
|
7965
8116
|
"marker",
|
|
7966
8117
|
{
|
|
7967
8118
|
id: "head",
|
|
@@ -7970,10 +8121,10 @@ var DimensionOverlay = ({
|
|
|
7970
8121
|
markerHeight: "4",
|
|
7971
8122
|
refX: "2",
|
|
7972
8123
|
refY: "2",
|
|
7973
|
-
children: /* @__PURE__ */
|
|
8124
|
+
children: /* @__PURE__ */ jsx6("path", { d: "M0,0 V4 L2,2 Z", fill: "red" })
|
|
7974
8125
|
}
|
|
7975
8126
|
) }),
|
|
7976
|
-
/* @__PURE__ */
|
|
8127
|
+
/* @__PURE__ */ jsx6(
|
|
7977
8128
|
"line",
|
|
7978
8129
|
{
|
|
7979
8130
|
x1: screenDStart.x,
|
|
@@ -7986,7 +8137,7 @@ var DimensionOverlay = ({
|
|
|
7986
8137
|
stroke: "red"
|
|
7987
8138
|
}
|
|
7988
8139
|
),
|
|
7989
|
-
/* @__PURE__ */
|
|
8140
|
+
/* @__PURE__ */ jsx6(
|
|
7990
8141
|
"line",
|
|
7991
8142
|
{
|
|
7992
8143
|
x1: screenDStart.x,
|
|
@@ -7999,7 +8150,7 @@ var DimensionOverlay = ({
|
|
|
7999
8150
|
stroke: "red"
|
|
8000
8151
|
}
|
|
8001
8152
|
),
|
|
8002
|
-
/* @__PURE__ */
|
|
8153
|
+
/* @__PURE__ */ jsx6(
|
|
8003
8154
|
"line",
|
|
8004
8155
|
{
|
|
8005
8156
|
x1: screenDEnd.x,
|
|
@@ -8015,7 +8166,7 @@ var DimensionOverlay = ({
|
|
|
8015
8166
|
]
|
|
8016
8167
|
}
|
|
8017
8168
|
),
|
|
8018
|
-
/* @__PURE__ */
|
|
8169
|
+
/* @__PURE__ */ jsxs4(
|
|
8019
8170
|
"div",
|
|
8020
8171
|
{
|
|
8021
8172
|
style: {
|
|
@@ -8033,13 +8184,13 @@ var DimensionOverlay = ({
|
|
|
8033
8184
|
",",
|
|
8034
8185
|
dStart.y.toFixed(2),
|
|
8035
8186
|
")",
|
|
8036
|
-
/* @__PURE__ */
|
|
8187
|
+
/* @__PURE__ */ jsx6("br", {}),
|
|
8037
8188
|
"(",
|
|
8038
8189
|
dEnd.x.toFixed(2),
|
|
8039
8190
|
",",
|
|
8040
8191
|
dEnd.y.toFixed(2),
|
|
8041
8192
|
")",
|
|
8042
|
-
/* @__PURE__ */
|
|
8193
|
+
/* @__PURE__ */ jsx6("br", {}),
|
|
8043
8194
|
"dist:",
|
|
8044
8195
|
" ",
|
|
8045
8196
|
Math.sqrt(
|
|
@@ -8055,9 +8206,9 @@ var DimensionOverlay = ({
|
|
|
8055
8206
|
};
|
|
8056
8207
|
|
|
8057
8208
|
// src/components/EditPlacementOverlay.tsx
|
|
8058
|
-
import { useRef as
|
|
8059
|
-
import { applyToPoint as
|
|
8060
|
-
import { jsx as
|
|
8209
|
+
import { useRef as useRef6, useState as useState4 } from "react";
|
|
8210
|
+
import { applyToPoint as applyToPoint7, identity as identity5, inverse as inverse3 } from "transformation-matrix";
|
|
8211
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
8061
8212
|
var isInsideOf = (pcb_component2, point2, padding = 0) => {
|
|
8062
8213
|
const halfWidth = pcb_component2.width / 2;
|
|
8063
8214
|
const halfHeight = pcb_component2.height / 2;
|
|
@@ -8076,8 +8227,8 @@ var EditPlacementOverlay = ({
|
|
|
8076
8227
|
onCreateEditEvent,
|
|
8077
8228
|
onModifyEditEvent
|
|
8078
8229
|
}) => {
|
|
8079
|
-
if (!transform) transform =
|
|
8080
|
-
const containerRef =
|
|
8230
|
+
if (!transform) transform = identity5();
|
|
8231
|
+
const containerRef = useRef6(null);
|
|
8081
8232
|
const [activePcbComponentId, setActivePcbComponent] = useState4(
|
|
8082
8233
|
null
|
|
8083
8234
|
);
|
|
@@ -8087,7 +8238,7 @@ var EditPlacementOverlay = ({
|
|
|
8087
8238
|
const in_move_footprint_mode = useGlobalStore((s) => s.in_move_footprint_mode);
|
|
8088
8239
|
const setIsMovingComponent = useGlobalStore((s) => s.setIsMovingComponent);
|
|
8089
8240
|
const disabled = disabledProp || !in_move_footprint_mode;
|
|
8090
|
-
return /* @__PURE__ */
|
|
8241
|
+
return /* @__PURE__ */ jsxs5(
|
|
8091
8242
|
"div",
|
|
8092
8243
|
{
|
|
8093
8244
|
ref: containerRef,
|
|
@@ -8101,7 +8252,7 @@ var EditPlacementOverlay = ({
|
|
|
8101
8252
|
const x = e.clientX - rect.left;
|
|
8102
8253
|
const y = e.clientY - rect.top;
|
|
8103
8254
|
if (Number.isNaN(x) || Number.isNaN(y)) return;
|
|
8104
|
-
const rwMousePoint =
|
|
8255
|
+
const rwMousePoint = applyToPoint7(inverse3(transform), { x, y });
|
|
8105
8256
|
let foundActiveComponent = false;
|
|
8106
8257
|
for (const e2 of soup) {
|
|
8107
8258
|
if (e2.type === "pcb_component" && isInsideOf(e2, rwMousePoint, 10 / transform.a)) {
|
|
@@ -8143,7 +8294,7 @@ var EditPlacementOverlay = ({
|
|
|
8143
8294
|
const x = e.clientX - rect.left;
|
|
8144
8295
|
const y = e.clientY - rect.top;
|
|
8145
8296
|
if (Number.isNaN(x) || Number.isNaN(y)) return;
|
|
8146
|
-
const rwMousePoint =
|
|
8297
|
+
const rwMousePoint = applyToPoint7(inverse3(transform), { x, y });
|
|
8147
8298
|
setDragState({
|
|
8148
8299
|
...dragState,
|
|
8149
8300
|
dragEnd: rwMousePoint
|
|
@@ -8172,8 +8323,8 @@ var EditPlacementOverlay = ({
|
|
|
8172
8323
|
children,
|
|
8173
8324
|
!disabled && soup.filter((e) => e.type === "pcb_component").map((e) => {
|
|
8174
8325
|
if (!e?.center) return null;
|
|
8175
|
-
const projectedCenter =
|
|
8176
|
-
return /* @__PURE__ */
|
|
8326
|
+
const projectedCenter = applyToPoint7(transform, e.center);
|
|
8327
|
+
return /* @__PURE__ */ jsx7(
|
|
8177
8328
|
"div",
|
|
8178
8329
|
{
|
|
8179
8330
|
style: {
|
|
@@ -8197,21 +8348,21 @@ var EditPlacementOverlay = ({
|
|
|
8197
8348
|
};
|
|
8198
8349
|
|
|
8199
8350
|
// src/components/EditTraceHintOverlay.tsx
|
|
8200
|
-
import { Fragment as Fragment2, useEffect as
|
|
8351
|
+
import { Fragment as Fragment2, useEffect as useEffect10, useRef as useRef7, useState as useState5 } from "react";
|
|
8201
8352
|
import {
|
|
8202
|
-
applyToPoint as
|
|
8203
|
-
identity as
|
|
8353
|
+
applyToPoint as applyToPoint8,
|
|
8354
|
+
identity as identity6,
|
|
8204
8355
|
inverse as inverse4
|
|
8205
8356
|
} from "transformation-matrix";
|
|
8206
8357
|
|
|
8207
8358
|
// src/components/HotkeyActionMenu.tsx
|
|
8208
8359
|
import { css } from "@emotion/css";
|
|
8209
|
-
import { useEffect as
|
|
8210
|
-
import { jsx as
|
|
8360
|
+
import { useEffect as useEffect9 } from "react";
|
|
8361
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
8211
8362
|
var HotkeyActionMenu = ({
|
|
8212
8363
|
hotkeys
|
|
8213
8364
|
}) => {
|
|
8214
|
-
|
|
8365
|
+
useEffect9(() => {
|
|
8215
8366
|
const handleKeyDown = (event) => {
|
|
8216
8367
|
hotkeys.forEach((hotkey) => {
|
|
8217
8368
|
if (event.key === hotkey.key) {
|
|
@@ -8224,7 +8375,7 @@ var HotkeyActionMenu = ({
|
|
|
8224
8375
|
window.removeEventListener("keydown", handleKeyDown);
|
|
8225
8376
|
};
|
|
8226
8377
|
}, [hotkeys]);
|
|
8227
|
-
return /* @__PURE__ */
|
|
8378
|
+
return /* @__PURE__ */ jsx8(
|
|
8228
8379
|
"div",
|
|
8229
8380
|
{
|
|
8230
8381
|
className: css`
|
|
@@ -8235,7 +8386,7 @@ var HotkeyActionMenu = ({
|
|
|
8235
8386
|
margin: 8px;
|
|
8236
8387
|
`,
|
|
8237
8388
|
children: hotkeys.map((hotkey) => {
|
|
8238
|
-
return /* @__PURE__ */
|
|
8389
|
+
return /* @__PURE__ */ jsxs6(
|
|
8239
8390
|
"div",
|
|
8240
8391
|
{
|
|
8241
8392
|
className: css`
|
|
@@ -8260,9 +8411,9 @@ var HotkeyActionMenu = ({
|
|
|
8260
8411
|
}
|
|
8261
8412
|
`,
|
|
8262
8413
|
children: [
|
|
8263
|
-
/* @__PURE__ */
|
|
8414
|
+
/* @__PURE__ */ jsx8("div", { className: "key", children: hotkey.key }),
|
|
8264
8415
|
" ",
|
|
8265
|
-
/* @__PURE__ */
|
|
8416
|
+
/* @__PURE__ */ jsx8("div", { className: "name", children: hotkey.name })
|
|
8266
8417
|
]
|
|
8267
8418
|
},
|
|
8268
8419
|
hotkey.name
|
|
@@ -8273,7 +8424,7 @@ var HotkeyActionMenu = ({
|
|
|
8273
8424
|
};
|
|
8274
8425
|
|
|
8275
8426
|
// src/components/EditTraceHintOverlay.tsx
|
|
8276
|
-
import { jsx as
|
|
8427
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
8277
8428
|
var isInsideOfSmtpad = (elm, point2, padding = 0) => {
|
|
8278
8429
|
if (elm.shape === "circle") {
|
|
8279
8430
|
return false;
|
|
@@ -8318,8 +8469,8 @@ var EditTraceHintOverlay = ({
|
|
|
8318
8469
|
onCreateEditEvent,
|
|
8319
8470
|
onModifyEditEvent
|
|
8320
8471
|
}) => {
|
|
8321
|
-
if (!transform) transform =
|
|
8322
|
-
const containerRef =
|
|
8472
|
+
if (!transform) transform = identity6();
|
|
8473
|
+
const containerRef = useRef7(null);
|
|
8323
8474
|
const containerBounds = containerRef.current?.getBoundingClientRect();
|
|
8324
8475
|
const [selectedElement, setSelectedElement] = useState5(null);
|
|
8325
8476
|
const toast = useToast();
|
|
@@ -8330,10 +8481,10 @@ var EditTraceHintOverlay = ({
|
|
|
8330
8481
|
const disabled = disabledProp || !in_edit_trace_mode;
|
|
8331
8482
|
let ogCenterScreen, dragEndScreen;
|
|
8332
8483
|
if (dragState?.originalCenter && dragState?.dragEnd) {
|
|
8333
|
-
ogCenterScreen =
|
|
8334
|
-
dragEndScreen =
|
|
8484
|
+
ogCenterScreen = applyToPoint8(transform, dragState?.originalCenter);
|
|
8485
|
+
dragEndScreen = applyToPoint8(transform, dragState?.dragEnd);
|
|
8335
8486
|
}
|
|
8336
|
-
|
|
8487
|
+
useEffect10(() => {
|
|
8337
8488
|
if (!isElementSelected) return;
|
|
8338
8489
|
function keyDown(e) {
|
|
8339
8490
|
if (e.key === "Escape") {
|
|
@@ -8344,7 +8495,7 @@ var EditTraceHintOverlay = ({
|
|
|
8344
8495
|
window.addEventListener("keydown", keyDown);
|
|
8345
8496
|
return () => window.removeEventListener("keydown", keyDown);
|
|
8346
8497
|
}, [isElementSelected]);
|
|
8347
|
-
return /* @__PURE__ */
|
|
8498
|
+
return /* @__PURE__ */ jsxs7(
|
|
8348
8499
|
"div",
|
|
8349
8500
|
{
|
|
8350
8501
|
ref: containerRef,
|
|
@@ -8358,7 +8509,7 @@ var EditTraceHintOverlay = ({
|
|
|
8358
8509
|
const x = e.clientX - rect.left;
|
|
8359
8510
|
const y = e.clientY - rect.top;
|
|
8360
8511
|
if (isNaN(x) || isNaN(y)) return;
|
|
8361
|
-
const rwMousePoint =
|
|
8512
|
+
const rwMousePoint = applyToPoint8(inverse4(transform), { x, y });
|
|
8362
8513
|
if (!isElementSelected) {
|
|
8363
8514
|
for (const e2 of soup) {
|
|
8364
8515
|
if (e2.type === "pcb_smtpad" && isInsideOfSmtpad(e2, rwMousePoint, 10 / transform.a) || e2.type === "pcb_plated_hole" && isInsideOfPlatedHole(e2, rwMousePoint, 10 / transform.a)) {
|
|
@@ -8401,7 +8552,7 @@ var EditTraceHintOverlay = ({
|
|
|
8401
8552
|
const x = e.clientX - rect.left;
|
|
8402
8553
|
const y = e.clientY - rect.top;
|
|
8403
8554
|
if (isNaN(x) || isNaN(y)) return;
|
|
8404
|
-
const rwMousePoint =
|
|
8555
|
+
const rwMousePoint = applyToPoint8(inverse4(transform), { x, y });
|
|
8405
8556
|
setDragState({
|
|
8406
8557
|
...dragState,
|
|
8407
8558
|
dragEnd: rwMousePoint
|
|
@@ -8420,10 +8571,10 @@ var EditTraceHintOverlay = ({
|
|
|
8420
8571
|
const x = e.clientX - rect.left;
|
|
8421
8572
|
const y = e.clientY - rect.top;
|
|
8422
8573
|
if (isNaN(x) || isNaN(y)) return;
|
|
8423
|
-
const rwMousePoint =
|
|
8574
|
+
const rwMousePoint = applyToPoint8(inverse4(transform), { x, y });
|
|
8424
8575
|
if (dragState) {
|
|
8425
8576
|
cancelPanDrag();
|
|
8426
|
-
const lastPointScreen =
|
|
8577
|
+
const lastPointScreen = applyToPoint8(
|
|
8427
8578
|
transform,
|
|
8428
8579
|
dragState.editEvent.route.slice(-1)[0] ?? dragState.originalCenter
|
|
8429
8580
|
);
|
|
@@ -8453,7 +8604,7 @@ var EditTraceHintOverlay = ({
|
|
|
8453
8604
|
},
|
|
8454
8605
|
children: [
|
|
8455
8606
|
children,
|
|
8456
|
-
in_edit_trace_mode && dragState?.editEvent && ogCenterScreen && dragEndScreen && /* @__PURE__ */
|
|
8607
|
+
in_edit_trace_mode && dragState?.editEvent && ogCenterScreen && dragEndScreen && /* @__PURE__ */ jsxs7(
|
|
8457
8608
|
"svg",
|
|
8458
8609
|
{
|
|
8459
8610
|
style: {
|
|
@@ -8467,21 +8618,21 @@ var EditTraceHintOverlay = ({
|
|
|
8467
8618
|
width: containerBounds?.width,
|
|
8468
8619
|
height: containerBounds?.height,
|
|
8469
8620
|
children: [
|
|
8470
|
-
/* @__PURE__ */
|
|
8621
|
+
/* @__PURE__ */ jsx9(
|
|
8471
8622
|
"path",
|
|
8472
8623
|
{
|
|
8473
8624
|
stroke: "red",
|
|
8474
|
-
d: `M ${ogCenterScreen.x} ${ogCenterScreen.y} ${dragState?.editEvent.route.map((p) =>
|
|
8625
|
+
d: `M ${ogCenterScreen.x} ${ogCenterScreen.y} ${dragState?.editEvent.route.map((p) => applyToPoint8(transform, p)).map((p) => `L ${p.x} ${p.y}`).join(" ")} L ${dragEndScreen.x} ${dragEndScreen.y}`
|
|
8475
8626
|
}
|
|
8476
8627
|
),
|
|
8477
8628
|
dragState?.editEvent.route.map((r, i) => {
|
|
8478
|
-
const rScreen =
|
|
8479
|
-
return /* @__PURE__ */
|
|
8480
|
-
r.via && /* @__PURE__ */
|
|
8481
|
-
/* @__PURE__ */
|
|
8629
|
+
const rScreen = applyToPoint8(transform, r);
|
|
8630
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
8631
|
+
r.via && /* @__PURE__ */ jsx9("circle", { cx: rScreen.x, cy: rScreen.y, r: 16, stroke: "red" }),
|
|
8632
|
+
/* @__PURE__ */ jsx9("circle", { cx: rScreen.x, cy: rScreen.y, r: 8, stroke: "red" })
|
|
8482
8633
|
] }, `r-${i}`);
|
|
8483
8634
|
}),
|
|
8484
|
-
shouldCreateAsVia && /* @__PURE__ */
|
|
8635
|
+
shouldCreateAsVia && /* @__PURE__ */ jsx9(
|
|
8485
8636
|
"circle",
|
|
8486
8637
|
{
|
|
8487
8638
|
cx: dragEndScreen.x,
|
|
@@ -8491,7 +8642,7 @@ var EditTraceHintOverlay = ({
|
|
|
8491
8642
|
},
|
|
8492
8643
|
"via-outer-circle"
|
|
8493
8644
|
),
|
|
8494
|
-
/* @__PURE__ */
|
|
8645
|
+
/* @__PURE__ */ jsx9(
|
|
8495
8646
|
"circle",
|
|
8496
8647
|
{
|
|
8497
8648
|
cx: dragEndScreen.x,
|
|
@@ -8503,7 +8654,7 @@ var EditTraceHintOverlay = ({
|
|
|
8503
8654
|
]
|
|
8504
8655
|
}
|
|
8505
8656
|
),
|
|
8506
|
-
!disabled && /* @__PURE__ */
|
|
8657
|
+
!disabled && /* @__PURE__ */ jsx9(
|
|
8507
8658
|
"svg",
|
|
8508
8659
|
{
|
|
8509
8660
|
style: {
|
|
@@ -8519,9 +8670,9 @@ var EditTraceHintOverlay = ({
|
|
|
8519
8670
|
children: soup.filter((e) => e.type === "pcb_trace_hint").map((e) => {
|
|
8520
8671
|
const { route } = e;
|
|
8521
8672
|
const pcb_port2 = su_default(soup).pcb_port.get(e.pcb_port_id);
|
|
8522
|
-
const pcb_port_screen =
|
|
8523
|
-
return /* @__PURE__ */
|
|
8524
|
-
/* @__PURE__ */
|
|
8673
|
+
const pcb_port_screen = applyToPoint8(transform, pcb_port2);
|
|
8674
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
8675
|
+
/* @__PURE__ */ jsx9(
|
|
8525
8676
|
"rect",
|
|
8526
8677
|
{
|
|
8527
8678
|
x: pcb_port_screen.x - 10,
|
|
@@ -8532,17 +8683,17 @@ var EditTraceHintOverlay = ({
|
|
|
8532
8683
|
},
|
|
8533
8684
|
`rect-${e.pcb_port_id}`
|
|
8534
8685
|
),
|
|
8535
|
-
/* @__PURE__ */
|
|
8686
|
+
/* @__PURE__ */ jsx9(
|
|
8536
8687
|
"path",
|
|
8537
8688
|
{
|
|
8538
8689
|
stroke: "red",
|
|
8539
|
-
d: `M ${pcb_port_screen.x} ${pcb_port_screen.y} ${route.map((r) =>
|
|
8690
|
+
d: `M ${pcb_port_screen.x} ${pcb_port_screen.y} ${route.map((r) => applyToPoint8(transform, r)).map((r) => `L ${r.x} ${r.y}`).join(" ")}`
|
|
8540
8691
|
},
|
|
8541
8692
|
`path-${e.pcb_port_id}`
|
|
8542
8693
|
),
|
|
8543
|
-
route.map((r) => ({ ...r, ...
|
|
8544
|
-
/* @__PURE__ */
|
|
8545
|
-
r.via && /* @__PURE__ */
|
|
8694
|
+
route.map((r) => ({ ...r, ...applyToPoint8(transform, r) })).map((r, i) => /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
8695
|
+
/* @__PURE__ */ jsx9("circle", { cx: r.x, cy: r.y, r: 8, stroke: "red" }),
|
|
8696
|
+
r.via && /* @__PURE__ */ jsx9(
|
|
8546
8697
|
"circle",
|
|
8547
8698
|
{
|
|
8548
8699
|
cx: r.x,
|
|
@@ -8558,7 +8709,7 @@ var EditTraceHintOverlay = ({
|
|
|
8558
8709
|
},
|
|
8559
8710
|
"pcb-trace-hints"
|
|
8560
8711
|
),
|
|
8561
|
-
/* @__PURE__ */
|
|
8712
|
+
/* @__PURE__ */ jsx9(
|
|
8562
8713
|
"div",
|
|
8563
8714
|
{
|
|
8564
8715
|
style: {
|
|
@@ -8566,7 +8717,7 @@ var EditTraceHintOverlay = ({
|
|
|
8566
8717
|
right: 0,
|
|
8567
8718
|
bottom: 0
|
|
8568
8719
|
},
|
|
8569
|
-
children: isElementSelected && /* @__PURE__ */
|
|
8720
|
+
children: isElementSelected && /* @__PURE__ */ jsx9(
|
|
8570
8721
|
HotkeyActionMenu,
|
|
8571
8722
|
{
|
|
8572
8723
|
hotkeys: [
|
|
@@ -8599,15 +8750,15 @@ var EditTraceHintOverlay = ({
|
|
|
8599
8750
|
|
|
8600
8751
|
// src/components/ErrorOverlay.tsx
|
|
8601
8752
|
import { css as css2 } from "@emotion/css";
|
|
8602
|
-
import { useRef as
|
|
8603
|
-
import { applyToPoint as
|
|
8604
|
-
import { Fragment as Fragment3, jsx as
|
|
8753
|
+
import { useRef as useRef8 } from "react";
|
|
8754
|
+
import { applyToPoint as applyToPoint9, identity as identity7 } from "transformation-matrix";
|
|
8755
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
8605
8756
|
var ErrorSVG = ({
|
|
8606
8757
|
screenPort1,
|
|
8607
8758
|
screenPort2,
|
|
8608
8759
|
errorCenter,
|
|
8609
8760
|
canLineBeDrawn
|
|
8610
|
-
}) => /* @__PURE__ */
|
|
8761
|
+
}) => /* @__PURE__ */ jsx10(
|
|
8611
8762
|
"svg",
|
|
8612
8763
|
{
|
|
8613
8764
|
style: {
|
|
@@ -8620,8 +8771,8 @@ var ErrorSVG = ({
|
|
|
8620
8771
|
},
|
|
8621
8772
|
width: "100%",
|
|
8622
8773
|
height: "100%",
|
|
8623
|
-
children: canLineBeDrawn && /* @__PURE__ */
|
|
8624
|
-
/* @__PURE__ */
|
|
8774
|
+
children: canLineBeDrawn && /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
8775
|
+
/* @__PURE__ */ jsx10(
|
|
8625
8776
|
"line",
|
|
8626
8777
|
{
|
|
8627
8778
|
x1: screenPort1.x,
|
|
@@ -8633,7 +8784,7 @@ var ErrorSVG = ({
|
|
|
8633
8784
|
stroke: "red"
|
|
8634
8785
|
}
|
|
8635
8786
|
),
|
|
8636
|
-
/* @__PURE__ */
|
|
8787
|
+
/* @__PURE__ */ jsx10(
|
|
8637
8788
|
"line",
|
|
8638
8789
|
{
|
|
8639
8790
|
x1: errorCenter.x,
|
|
@@ -8645,7 +8796,7 @@ var ErrorSVG = ({
|
|
|
8645
8796
|
stroke: "red"
|
|
8646
8797
|
}
|
|
8647
8798
|
),
|
|
8648
|
-
/* @__PURE__ */
|
|
8799
|
+
/* @__PURE__ */ jsx10(
|
|
8649
8800
|
"rect",
|
|
8650
8801
|
{
|
|
8651
8802
|
x: errorCenter.x - 5,
|
|
@@ -8660,9 +8811,9 @@ var ErrorSVG = ({
|
|
|
8660
8811
|
}
|
|
8661
8812
|
);
|
|
8662
8813
|
var ErrorOverlay = ({ children, transform, elements }) => {
|
|
8663
|
-
if (!transform) transform =
|
|
8664
|
-
const containerRef =
|
|
8665
|
-
return /* @__PURE__ */
|
|
8814
|
+
if (!transform) transform = identity7();
|
|
8815
|
+
const containerRef = useRef8(null);
|
|
8816
|
+
return /* @__PURE__ */ jsxs8("div", { style: { position: "relative" }, ref: containerRef, children: [
|
|
8666
8817
|
children,
|
|
8667
8818
|
elements?.filter((el) => el.type === "pcb_trace_error").map((el) => {
|
|
8668
8819
|
const { pcb_port_ids } = el;
|
|
@@ -8673,11 +8824,11 @@ var ErrorOverlay = ({ children, transform, elements }) => {
|
|
|
8673
8824
|
(el2) => el2.type === "pcb_port" && el2.pcb_port_id === pcb_port_ids?.[1]
|
|
8674
8825
|
);
|
|
8675
8826
|
if (!port1 || !port2) return null;
|
|
8676
|
-
const screenPort1 =
|
|
8827
|
+
const screenPort1 = applyToPoint9(transform, {
|
|
8677
8828
|
x: port1.x,
|
|
8678
8829
|
y: port1.y
|
|
8679
8830
|
});
|
|
8680
|
-
const screenPort2 =
|
|
8831
|
+
const screenPort2 = applyToPoint9(transform, {
|
|
8681
8832
|
x: port2.x,
|
|
8682
8833
|
y: port2.y
|
|
8683
8834
|
});
|
|
@@ -8689,8 +8840,8 @@ var ErrorOverlay = ({ children, transform, elements }) => {
|
|
|
8689
8840
|
if (isNaN(errorCenter.x) || isNaN(errorCenter.y)) {
|
|
8690
8841
|
return null;
|
|
8691
8842
|
}
|
|
8692
|
-
return /* @__PURE__ */
|
|
8693
|
-
/* @__PURE__ */
|
|
8843
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
8844
|
+
/* @__PURE__ */ jsx10(
|
|
8694
8845
|
ErrorSVG,
|
|
8695
8846
|
{
|
|
8696
8847
|
screenPort1,
|
|
@@ -8699,7 +8850,7 @@ var ErrorOverlay = ({ children, transform, elements }) => {
|
|
|
8699
8850
|
canLineBeDrawn
|
|
8700
8851
|
}
|
|
8701
8852
|
),
|
|
8702
|
-
/* @__PURE__ */
|
|
8853
|
+
/* @__PURE__ */ jsxs8(
|
|
8703
8854
|
"div",
|
|
8704
8855
|
{
|
|
8705
8856
|
className: css2`
|
|
@@ -8732,8 +8883,8 @@ var ErrorOverlay = ({ children, transform, elements }) => {
|
|
|
8732
8883
|
}
|
|
8733
8884
|
`,
|
|
8734
8885
|
children: [
|
|
8735
|
-
/* @__PURE__ */
|
|
8736
|
-
/* @__PURE__ */
|
|
8886
|
+
/* @__PURE__ */ jsx10("div", { className: "error-message", children: el.message }),
|
|
8887
|
+
/* @__PURE__ */ jsx10(
|
|
8737
8888
|
"div",
|
|
8738
8889
|
{
|
|
8739
8890
|
className: css2`
|
|
@@ -8754,10 +8905,10 @@ var ErrorOverlay = ({ children, transform, elements }) => {
|
|
|
8754
8905
|
|
|
8755
8906
|
// src/components/MouseElementTracker.tsx
|
|
8756
8907
|
import { useState as useState7, useMemo as useMemo3 } from "react";
|
|
8757
|
-
import { applyToPoint as
|
|
8908
|
+
import { applyToPoint as applyToPoint10, inverse as inverse5 } from "transformation-matrix";
|
|
8758
8909
|
|
|
8759
8910
|
// src/components/ElementOverlayBox.tsx
|
|
8760
|
-
import { useEffect as
|
|
8911
|
+
import { useEffect as useEffect11, useState as useState6 } from "react";
|
|
8761
8912
|
|
|
8762
8913
|
// src/lib/get-trace-overlay-text.ts
|
|
8763
8914
|
function getTraceOverlayInfo({
|
|
@@ -8812,7 +8963,7 @@ function filterTracesIfMultiple(filterTraces) {
|
|
|
8812
8963
|
}
|
|
8813
8964
|
|
|
8814
8965
|
// src/components/ElementOverlayBox.tsx
|
|
8815
|
-
import { jsx as
|
|
8966
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
8816
8967
|
var containerStyle = {
|
|
8817
8968
|
position: "absolute",
|
|
8818
8969
|
left: 0,
|
|
@@ -8869,7 +9020,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
8869
9020
|
}) => {
|
|
8870
9021
|
const [finalState, setFinalState] = useState6(false);
|
|
8871
9022
|
const primitiveElement = primitive._element;
|
|
8872
|
-
|
|
9023
|
+
useEffect11(() => {
|
|
8873
9024
|
setTimeout(() => {
|
|
8874
9025
|
setFinalState(true);
|
|
8875
9026
|
}, 100);
|
|
@@ -8892,7 +9043,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
8892
9043
|
const overlayInfo = getTraceOverlayInfo(traceTextContext);
|
|
8893
9044
|
if (!overlayInfo) return null;
|
|
8894
9045
|
const yOffset = mousePos.y - 35;
|
|
8895
|
-
return /* @__PURE__ */
|
|
9046
|
+
return /* @__PURE__ */ jsx11(
|
|
8896
9047
|
"div",
|
|
8897
9048
|
{
|
|
8898
9049
|
style: {
|
|
@@ -8904,7 +9055,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
8904
9055
|
pointerEvents: "none",
|
|
8905
9056
|
transform: "translateX(-50%)"
|
|
8906
9057
|
},
|
|
8907
|
-
children: /* @__PURE__ */
|
|
9058
|
+
children: /* @__PURE__ */ jsx11(
|
|
8908
9059
|
"div",
|
|
8909
9060
|
{
|
|
8910
9061
|
style: {
|
|
@@ -8926,7 +9077,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
8926
9077
|
}
|
|
8927
9078
|
);
|
|
8928
9079
|
}
|
|
8929
|
-
return /* @__PURE__ */
|
|
9080
|
+
return /* @__PURE__ */ jsx11(
|
|
8930
9081
|
"div",
|
|
8931
9082
|
{
|
|
8932
9083
|
style: {
|
|
@@ -8940,7 +9091,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
8940
9091
|
transform: `rotate(${-rotation2}deg)`,
|
|
8941
9092
|
transformOrigin: "center center"
|
|
8942
9093
|
},
|
|
8943
|
-
children: /* @__PURE__ */
|
|
9094
|
+
children: /* @__PURE__ */ jsx11(
|
|
8944
9095
|
"div",
|
|
8945
9096
|
{
|
|
8946
9097
|
style: {
|
|
@@ -8956,7 +9107,7 @@ var HighlightedPrimitiveBoxWithText = ({
|
|
|
8956
9107
|
opacity: finalState ? 1 : si === 0 ? 1 : 0,
|
|
8957
9108
|
transition: "width 0.2s, height 0.2s, margin-left 0.2s, margin-top 0.2s, opacity 0.2s"
|
|
8958
9109
|
},
|
|
8959
|
-
children: /* @__PURE__ */
|
|
9110
|
+
children: /* @__PURE__ */ jsx11(
|
|
8960
9111
|
"div",
|
|
8961
9112
|
{
|
|
8962
9113
|
style: {
|
|
@@ -9004,7 +9155,7 @@ var ElementOverlayBox = ({
|
|
|
9004
9155
|
is_showing_multiple_traces_length,
|
|
9005
9156
|
elements
|
|
9006
9157
|
});
|
|
9007
|
-
return /* @__PURE__ */
|
|
9158
|
+
return /* @__PURE__ */ jsx11("div", { style: containerStyle, children: !is_moving_component && primitives.map((primitive, i) => /* @__PURE__ */ jsx11(
|
|
9008
9159
|
HighlightedPrimitiveBoxWithText,
|
|
9009
9160
|
{
|
|
9010
9161
|
primitive,
|
|
@@ -9023,7 +9174,7 @@ function ifSetsMatchExactly(set1, set2) {
|
|
|
9023
9174
|
|
|
9024
9175
|
// src/components/MouseElementTracker.tsx
|
|
9025
9176
|
import { pointToSegmentDistance } from "@tscircuit/math-utils";
|
|
9026
|
-
import { jsx as
|
|
9177
|
+
import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
9027
9178
|
var getPrimitivesUnderPoint = (primitives, rwPoint, transform) => {
|
|
9028
9179
|
const newMousedPrimitives = [];
|
|
9029
9180
|
for (const primitive of primitives) {
|
|
@@ -9074,7 +9225,7 @@ var MouseElementTracker = ({
|
|
|
9074
9225
|
if (primitive._element?.type === "pcb_via") continue;
|
|
9075
9226
|
if (primitive._element?.type === "pcb_component") continue;
|
|
9076
9227
|
if (primitive?.layer === "drill") continue;
|
|
9077
|
-
const screenPos =
|
|
9228
|
+
const screenPos = applyToPoint10(
|
|
9078
9229
|
transform,
|
|
9079
9230
|
primitive
|
|
9080
9231
|
);
|
|
@@ -9100,7 +9251,7 @@ var MouseElementTracker = ({
|
|
|
9100
9251
|
}, [mousedPrimitives, transform]);
|
|
9101
9252
|
const handleInteraction = (x, y, transform2, primitives2) => {
|
|
9102
9253
|
setMousePos({ x, y });
|
|
9103
|
-
const rwPoint =
|
|
9254
|
+
const rwPoint = applyToPoint10(inverse5(transform2), { x, y });
|
|
9104
9255
|
const newMousedPrimitives = getPrimitivesUnderPoint(
|
|
9105
9256
|
primitives2,
|
|
9106
9257
|
rwPoint,
|
|
@@ -9115,7 +9266,7 @@ var MouseElementTracker = ({
|
|
|
9115
9266
|
setMousedPrimitives(newMousedPrimitives);
|
|
9116
9267
|
onMouseHoverOverPrimitives(newMousedPrimitives);
|
|
9117
9268
|
};
|
|
9118
|
-
return /* @__PURE__ */
|
|
9269
|
+
return /* @__PURE__ */ jsxs9(
|
|
9119
9270
|
"div",
|
|
9120
9271
|
{
|
|
9121
9272
|
style: { position: "relative" },
|
|
@@ -9138,7 +9289,7 @@ var MouseElementTracker = ({
|
|
|
9138
9289
|
},
|
|
9139
9290
|
children: [
|
|
9140
9291
|
children,
|
|
9141
|
-
/* @__PURE__ */
|
|
9292
|
+
/* @__PURE__ */ jsx12(
|
|
9142
9293
|
ElementOverlayBox,
|
|
9143
9294
|
{
|
|
9144
9295
|
elements,
|
|
@@ -9152,10 +9303,10 @@ var MouseElementTracker = ({
|
|
|
9152
9303
|
};
|
|
9153
9304
|
|
|
9154
9305
|
// src/components/RatsNestOverlay.tsx
|
|
9155
|
-
import { applyToPoint as
|
|
9306
|
+
import { applyToPoint as applyToPoint11, identity as identity8 } from "transformation-matrix";
|
|
9156
9307
|
import { getFullConnectivityMapFromCircuitJson } from "circuit-json-to-connectivity-map";
|
|
9157
9308
|
import { useMemo as useMemo4 } from "react";
|
|
9158
|
-
import { jsx as
|
|
9309
|
+
import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
9159
9310
|
var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
9160
9311
|
const isShowingRatsNest = useGlobalStore((s) => s.is_showing_rats_nest);
|
|
9161
9312
|
const { netMap, idToNetMap } = useMemo4(
|
|
@@ -9217,10 +9368,10 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
9217
9368
|
return lines;
|
|
9218
9369
|
}, [soup, netMap, idToNetMap, isShowingRatsNest]);
|
|
9219
9370
|
if (!soup || !isShowingRatsNest) return children;
|
|
9220
|
-
if (!transform) transform =
|
|
9221
|
-
return /* @__PURE__ */
|
|
9371
|
+
if (!transform) transform = identity8();
|
|
9372
|
+
return /* @__PURE__ */ jsxs10("div", { style: { position: "relative" }, children: [
|
|
9222
9373
|
children,
|
|
9223
|
-
/* @__PURE__ */
|
|
9374
|
+
/* @__PURE__ */ jsx13(
|
|
9224
9375
|
"svg",
|
|
9225
9376
|
{
|
|
9226
9377
|
style: {
|
|
@@ -9234,9 +9385,9 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
|
|
|
9234
9385
|
zIndex: zIndexMap.ratsNestOverlay
|
|
9235
9386
|
},
|
|
9236
9387
|
children: ratsNestLines.map(({ key, startPoint, endPoint, isInNet }) => {
|
|
9237
|
-
const transformedStart =
|
|
9238
|
-
const transformedEnd =
|
|
9239
|
-
return /* @__PURE__ */
|
|
9388
|
+
const transformedStart = applyToPoint11(transform, startPoint);
|
|
9389
|
+
const transformedEnd = applyToPoint11(transform, endPoint);
|
|
9390
|
+
return /* @__PURE__ */ jsx13(
|
|
9240
9391
|
"line",
|
|
9241
9392
|
{
|
|
9242
9393
|
x1: transformedStart.x,
|
|
@@ -9262,7 +9413,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
9262
9413
|
// package.json
|
|
9263
9414
|
var package_default = {
|
|
9264
9415
|
name: "@tscircuit/pcb-viewer",
|
|
9265
|
-
version: "1.11.
|
|
9416
|
+
version: "1.11.109",
|
|
9266
9417
|
main: "dist/index.js",
|
|
9267
9418
|
type: "module",
|
|
9268
9419
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -9288,14 +9439,13 @@ var package_default = {
|
|
|
9288
9439
|
"@storybook/nextjs": "^8.0.6",
|
|
9289
9440
|
"@storybook/react": "^8.0.6",
|
|
9290
9441
|
"@swc/core": "^1.4.12",
|
|
9291
|
-
"@tscircuit/core": "0.0.372",
|
|
9292
9442
|
"@tscircuit/eagle-xml-converter": "^1.0.0",
|
|
9293
9443
|
"@tscircuit/props": "^0.0.172",
|
|
9294
9444
|
"@tscircuit/soup-util": "^0.0.41",
|
|
9295
9445
|
"@types/color": "^3.0.6",
|
|
9296
9446
|
"@types/node": "18.7.23",
|
|
9297
9447
|
"@types/react": "^18.3.3",
|
|
9298
|
-
"circuit-json": "^0.0.
|
|
9448
|
+
"circuit-json": "^0.0.158",
|
|
9299
9449
|
next: "^14.1.4",
|
|
9300
9450
|
"pixi.js": "^8.6.6",
|
|
9301
9451
|
react: "^18.2.0",
|
|
@@ -9309,11 +9459,11 @@ var package_default = {
|
|
|
9309
9459
|
zod: "^3.23.5"
|
|
9310
9460
|
},
|
|
9311
9461
|
peerDependencies: {
|
|
9312
|
-
react: "*"
|
|
9313
|
-
"@tscircuit/core": "*"
|
|
9462
|
+
react: "*"
|
|
9314
9463
|
},
|
|
9315
9464
|
dependencies: {
|
|
9316
9465
|
"@emotion/css": "^11.11.2",
|
|
9466
|
+
"@tscircuit/core": "^0.0.380",
|
|
9317
9467
|
"@tscircuit/math-utils": "^0.0.16",
|
|
9318
9468
|
"circuit-json-to-connectivity-map": "^0.0.20",
|
|
9319
9469
|
"circuit-to-svg": "^0.0.36",
|
|
@@ -9327,12 +9477,12 @@ var package_default = {
|
|
|
9327
9477
|
};
|
|
9328
9478
|
|
|
9329
9479
|
// src/hooks/useHotKey.ts
|
|
9330
|
-
import { useEffect as
|
|
9480
|
+
import { useEffect as useEffect12 } from "react";
|
|
9331
9481
|
var useHotKey = (key, onUse) => {
|
|
9332
9482
|
const isMouseOverContainer = useGlobalStore(
|
|
9333
9483
|
(s) => s.is_mouse_over_container
|
|
9334
9484
|
);
|
|
9335
|
-
|
|
9485
|
+
useEffect12(() => {
|
|
9336
9486
|
if (!key || typeof onUse !== "function") return;
|
|
9337
9487
|
const handleKeyDown = (event) => {
|
|
9338
9488
|
const keyParts = key.split("+");
|
|
@@ -9354,13 +9504,13 @@ var useHotKey = (key, onUse) => {
|
|
|
9354
9504
|
};
|
|
9355
9505
|
|
|
9356
9506
|
// src/components/ToolbarOverlay.tsx
|
|
9357
|
-
import { jsx as
|
|
9507
|
+
import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
9358
9508
|
var LayerButton = ({
|
|
9359
9509
|
name,
|
|
9360
9510
|
selected,
|
|
9361
9511
|
onClick
|
|
9362
9512
|
}) => {
|
|
9363
|
-
return /* @__PURE__ */
|
|
9513
|
+
return /* @__PURE__ */ jsxs11(
|
|
9364
9514
|
"div",
|
|
9365
9515
|
{
|
|
9366
9516
|
className: css3`
|
|
@@ -9376,8 +9526,8 @@ var LayerButton = ({
|
|
|
9376
9526
|
`,
|
|
9377
9527
|
onClick,
|
|
9378
9528
|
children: [
|
|
9379
|
-
/* @__PURE__ */
|
|
9380
|
-
/* @__PURE__ */
|
|
9529
|
+
/* @__PURE__ */ jsx14("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
|
|
9530
|
+
/* @__PURE__ */ jsx14(
|
|
9381
9531
|
"span",
|
|
9382
9532
|
{
|
|
9383
9533
|
style: {
|
|
@@ -9392,7 +9542,7 @@ var LayerButton = ({
|
|
|
9392
9542
|
}
|
|
9393
9543
|
);
|
|
9394
9544
|
};
|
|
9395
|
-
var ToolbarButton = ({ children, ...props }) => /* @__PURE__ */
|
|
9545
|
+
var ToolbarButton = ({ children, ...props }) => /* @__PURE__ */ jsx14(
|
|
9396
9546
|
"div",
|
|
9397
9547
|
{
|
|
9398
9548
|
...props,
|
|
@@ -9417,7 +9567,7 @@ var CheckboxMenuItem = ({
|
|
|
9417
9567
|
checked,
|
|
9418
9568
|
onClick
|
|
9419
9569
|
}) => {
|
|
9420
|
-
return /* @__PURE__ */
|
|
9570
|
+
return /* @__PURE__ */ jsxs11(
|
|
9421
9571
|
"div",
|
|
9422
9572
|
{
|
|
9423
9573
|
className: css3`
|
|
@@ -9439,8 +9589,8 @@ var CheckboxMenuItem = ({
|
|
|
9439
9589
|
onClick();
|
|
9440
9590
|
},
|
|
9441
9591
|
children: [
|
|
9442
|
-
/* @__PURE__ */
|
|
9443
|
-
/* @__PURE__ */
|
|
9592
|
+
/* @__PURE__ */ jsx14("input", { type: "checkbox", checked }),
|
|
9593
|
+
/* @__PURE__ */ jsx14("span", { style: { color: "#eee" }, children: label })
|
|
9444
9594
|
]
|
|
9445
9595
|
}
|
|
9446
9596
|
);
|
|
@@ -9485,7 +9635,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9485
9635
|
useHotKey("7", () => selectLayer("inner5"));
|
|
9486
9636
|
useHotKey("8", () => selectLayer("inner6"));
|
|
9487
9637
|
const errorCount = elements?.filter((e) => e.type.includes("error")).length ?? 0;
|
|
9488
|
-
return /* @__PURE__ */
|
|
9638
|
+
return /* @__PURE__ */ jsxs11(
|
|
9489
9639
|
"div",
|
|
9490
9640
|
{
|
|
9491
9641
|
style: { position: "relative" },
|
|
@@ -9498,7 +9648,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9498
9648
|
},
|
|
9499
9649
|
children: [
|
|
9500
9650
|
children,
|
|
9501
|
-
/* @__PURE__ */
|
|
9651
|
+
/* @__PURE__ */ jsxs11(
|
|
9502
9652
|
"div",
|
|
9503
9653
|
{
|
|
9504
9654
|
style: {
|
|
@@ -9519,7 +9669,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9519
9669
|
]
|
|
9520
9670
|
}
|
|
9521
9671
|
),
|
|
9522
|
-
/* @__PURE__ */
|
|
9672
|
+
/* @__PURE__ */ jsxs11(
|
|
9523
9673
|
"div",
|
|
9524
9674
|
{
|
|
9525
9675
|
style: {
|
|
@@ -9536,7 +9686,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9536
9686
|
fontFamily: "sans-serif"
|
|
9537
9687
|
},
|
|
9538
9688
|
children: [
|
|
9539
|
-
/* @__PURE__ */
|
|
9689
|
+
/* @__PURE__ */ jsxs11(
|
|
9540
9690
|
ToolbarButton,
|
|
9541
9691
|
{
|
|
9542
9692
|
onClick: () => {
|
|
@@ -9548,10 +9698,10 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9548
9698
|
}
|
|
9549
9699
|
},
|
|
9550
9700
|
children: [
|
|
9551
|
-
/* @__PURE__ */
|
|
9701
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
9552
9702
|
"layer:",
|
|
9553
9703
|
" ",
|
|
9554
|
-
/* @__PURE__ */
|
|
9704
|
+
/* @__PURE__ */ jsx14(
|
|
9555
9705
|
"span",
|
|
9556
9706
|
{
|
|
9557
9707
|
style: {
|
|
@@ -9563,7 +9713,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9563
9713
|
}
|
|
9564
9714
|
)
|
|
9565
9715
|
] }),
|
|
9566
|
-
isLayerMenuOpen && /* @__PURE__ */
|
|
9716
|
+
isLayerMenuOpen && /* @__PURE__ */ jsx14("div", { style: { marginTop: 4, minWidth: 120 }, children: all_layers.map((l) => l.replace(/-/g, "")).map((layer) => /* @__PURE__ */ jsx14(
|
|
9567
9717
|
LayerButton,
|
|
9568
9718
|
{
|
|
9569
9719
|
name: layer,
|
|
@@ -9577,77 +9727,77 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9577
9727
|
]
|
|
9578
9728
|
}
|
|
9579
9729
|
),
|
|
9580
|
-
/* @__PURE__ */
|
|
9730
|
+
/* @__PURE__ */ jsxs11(
|
|
9581
9731
|
ToolbarButton,
|
|
9582
9732
|
{
|
|
9583
9733
|
style: errorCount > 0 ? { color: "red" } : {},
|
|
9584
9734
|
onClick: () => setErrorsOpen(!isErrorsOpen),
|
|
9585
9735
|
onMouseLeave: () => setErrorsOpen(false),
|
|
9586
9736
|
children: [
|
|
9587
|
-
/* @__PURE__ */
|
|
9737
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
9588
9738
|
errorCount,
|
|
9589
9739
|
" errors"
|
|
9590
9740
|
] }),
|
|
9591
|
-
isErrorsOpen && /* @__PURE__ */
|
|
9741
|
+
isErrorsOpen && /* @__PURE__ */ jsx14(
|
|
9592
9742
|
"div",
|
|
9593
9743
|
{
|
|
9594
9744
|
style: { display: "grid", gridTemplateColumns: "100px 300px" },
|
|
9595
|
-
children: elements?.filter((e) => e.type.includes("error")).map((e, i) => /* @__PURE__ */
|
|
9596
|
-
/* @__PURE__ */
|
|
9597
|
-
/* @__PURE__ */
|
|
9745
|
+
children: elements?.filter((e) => e.type.includes("error")).map((e, i) => /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
9746
|
+
/* @__PURE__ */ jsx14("div", { children: e.error_type }),
|
|
9747
|
+
/* @__PURE__ */ jsx14("div", { children: e.message })
|
|
9598
9748
|
] }, i))
|
|
9599
9749
|
}
|
|
9600
9750
|
)
|
|
9601
9751
|
]
|
|
9602
9752
|
}
|
|
9603
9753
|
),
|
|
9604
|
-
/* @__PURE__ */
|
|
9754
|
+
/* @__PURE__ */ jsx14(
|
|
9605
9755
|
ToolbarButton,
|
|
9606
9756
|
{
|
|
9607
9757
|
style: {},
|
|
9608
9758
|
onClick: () => {
|
|
9609
9759
|
setEditMode(in_draw_trace_mode ? "off" : "draw_trace");
|
|
9610
9760
|
},
|
|
9611
|
-
children: /* @__PURE__ */
|
|
9761
|
+
children: /* @__PURE__ */ jsxs11("div", { children: [
|
|
9612
9762
|
in_draw_trace_mode ? "\u2716 " : "",
|
|
9613
9763
|
"Edit Traces"
|
|
9614
9764
|
] })
|
|
9615
9765
|
}
|
|
9616
9766
|
),
|
|
9617
|
-
/* @__PURE__ */
|
|
9767
|
+
/* @__PURE__ */ jsx14(
|
|
9618
9768
|
ToolbarButton,
|
|
9619
9769
|
{
|
|
9620
9770
|
style: {},
|
|
9621
9771
|
onClick: () => {
|
|
9622
9772
|
setEditMode(in_move_footprint_mode ? "off" : "move_footprint");
|
|
9623
9773
|
},
|
|
9624
|
-
children: /* @__PURE__ */
|
|
9774
|
+
children: /* @__PURE__ */ jsxs11("div", { children: [
|
|
9625
9775
|
in_move_footprint_mode ? "\u2716 " : "",
|
|
9626
9776
|
"Move Components"
|
|
9627
9777
|
] })
|
|
9628
9778
|
}
|
|
9629
9779
|
),
|
|
9630
|
-
/* @__PURE__ */
|
|
9780
|
+
/* @__PURE__ */ jsx14(
|
|
9631
9781
|
ToolbarButton,
|
|
9632
9782
|
{
|
|
9633
9783
|
style: {},
|
|
9634
9784
|
onClick: () => {
|
|
9635
9785
|
setIsShowingRatsNest(!is_showing_rats_nest);
|
|
9636
9786
|
},
|
|
9637
|
-
children: /* @__PURE__ */
|
|
9787
|
+
children: /* @__PURE__ */ jsxs11("div", { children: [
|
|
9638
9788
|
is_showing_rats_nest ? "\u2716 " : "",
|
|
9639
9789
|
"Rats Nest"
|
|
9640
9790
|
] })
|
|
9641
9791
|
}
|
|
9642
9792
|
),
|
|
9643
|
-
/* @__PURE__ */
|
|
9793
|
+
/* @__PURE__ */ jsx14(
|
|
9644
9794
|
ToolbarButton,
|
|
9645
9795
|
{
|
|
9646
9796
|
onClick: () => {
|
|
9647
9797
|
setViewMenuOpen(!isViewMenuOpen);
|
|
9648
9798
|
},
|
|
9649
|
-
children: /* @__PURE__ */
|
|
9650
|
-
/* @__PURE__ */
|
|
9799
|
+
children: /* @__PURE__ */ jsxs11("div", { children: [
|
|
9800
|
+
/* @__PURE__ */ jsxs11(
|
|
9651
9801
|
"div",
|
|
9652
9802
|
{
|
|
9653
9803
|
style: {
|
|
@@ -9658,7 +9808,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9658
9808
|
children: [
|
|
9659
9809
|
"View",
|
|
9660
9810
|
" ",
|
|
9661
|
-
/* @__PURE__ */
|
|
9811
|
+
/* @__PURE__ */ jsx14(
|
|
9662
9812
|
"span",
|
|
9663
9813
|
{
|
|
9664
9814
|
style: {
|
|
@@ -9673,8 +9823,8 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9673
9823
|
]
|
|
9674
9824
|
}
|
|
9675
9825
|
),
|
|
9676
|
-
isViewMenuOpen && /* @__PURE__ */
|
|
9677
|
-
/* @__PURE__ */
|
|
9826
|
+
isViewMenuOpen && /* @__PURE__ */ jsxs11("div", { style: { marginTop: 4, minWidth: 120 }, children: [
|
|
9827
|
+
/* @__PURE__ */ jsx14(
|
|
9678
9828
|
CheckboxMenuItem,
|
|
9679
9829
|
{
|
|
9680
9830
|
label: "Show All Trace Lengths",
|
|
@@ -9686,7 +9836,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9686
9836
|
}
|
|
9687
9837
|
}
|
|
9688
9838
|
),
|
|
9689
|
-
/* @__PURE__ */
|
|
9839
|
+
/* @__PURE__ */ jsx14(
|
|
9690
9840
|
CheckboxMenuItem,
|
|
9691
9841
|
{
|
|
9692
9842
|
label: "Show Autorouting Animation",
|
|
@@ -9709,7 +9859,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
9709
9859
|
};
|
|
9710
9860
|
|
|
9711
9861
|
// src/components/CanvasElementsRenderer.tsx
|
|
9712
|
-
import { jsx as
|
|
9862
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
9713
9863
|
var CanvasElementsRenderer = (props) => {
|
|
9714
9864
|
const { transform, elements } = props;
|
|
9715
9865
|
const [primitivesWithoutInteractionMetadata, connectivityMap] = useMemo5(() => {
|
|
@@ -9732,34 +9882,37 @@ var CanvasElementsRenderer = (props) => {
|
|
|
9732
9882
|
primitiveIdsInMousedOverNet: hoverState.primitiveIdsInMousedOverNet
|
|
9733
9883
|
});
|
|
9734
9884
|
}, [primitivesWithoutInteractionMetadata, hoverState]);
|
|
9735
|
-
const onMouseOverPrimitives = useCallback2(
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9885
|
+
const onMouseOverPrimitives = useCallback2(
|
|
9886
|
+
(primitivesHoveredOver) => {
|
|
9887
|
+
const primitiveIdsInMousedOverNet = [];
|
|
9888
|
+
for (const primitive of primitivesHoveredOver) {
|
|
9889
|
+
if (primitive._element) {
|
|
9890
|
+
const connectedPrimitivesList = connectivityMap.getNetConnectedToId(
|
|
9891
|
+
"pcb_port_id" in primitive._element ? primitive._element?.pcb_port_id : "pcb_trace_id" in primitive._element ? primitive._element?.pcb_trace_id : ""
|
|
9892
|
+
);
|
|
9893
|
+
primitiveIdsInMousedOverNet.push(
|
|
9894
|
+
...connectivityMap.getIdsConnectedToNet(connectedPrimitivesList)
|
|
9895
|
+
);
|
|
9896
|
+
}
|
|
9745
9897
|
}
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
}
|
|
9754
|
-
|
|
9755
|
-
|
|
9898
|
+
const drawingObjectIdsWithMouseOver = new Set(
|
|
9899
|
+
primitivesHoveredOver.map((p) => p._pcb_drawing_object_id)
|
|
9900
|
+
);
|
|
9901
|
+
setHoverState({
|
|
9902
|
+
drawingObjectIdsWithMouseOver,
|
|
9903
|
+
primitiveIdsInMousedOverNet
|
|
9904
|
+
});
|
|
9905
|
+
},
|
|
9906
|
+
[connectivityMap]
|
|
9907
|
+
);
|
|
9908
|
+
return /* @__PURE__ */ jsx15(
|
|
9756
9909
|
MouseElementTracker,
|
|
9757
9910
|
{
|
|
9758
9911
|
elements,
|
|
9759
9912
|
transform,
|
|
9760
9913
|
primitives: primitivesWithoutInteractionMetadata,
|
|
9761
9914
|
onMouseHoverOverPrimitives: onMouseOverPrimitives,
|
|
9762
|
-
children: /* @__PURE__ */
|
|
9915
|
+
children: /* @__PURE__ */ jsx15(
|
|
9763
9916
|
EditPlacementOverlay,
|
|
9764
9917
|
{
|
|
9765
9918
|
disabled: !props.allowEditing,
|
|
@@ -9768,7 +9921,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
9768
9921
|
cancelPanDrag: props.cancelPanDrag,
|
|
9769
9922
|
onCreateEditEvent: props.onCreateEditEvent,
|
|
9770
9923
|
onModifyEditEvent: props.onModifyEditEvent,
|
|
9771
|
-
children: /* @__PURE__ */
|
|
9924
|
+
children: /* @__PURE__ */ jsx15(
|
|
9772
9925
|
EditTraceHintOverlay,
|
|
9773
9926
|
{
|
|
9774
9927
|
disabled: !props.allowEditing,
|
|
@@ -9777,24 +9930,31 @@ var CanvasElementsRenderer = (props) => {
|
|
|
9777
9930
|
cancelPanDrag: props.cancelPanDrag,
|
|
9778
9931
|
onCreateEditEvent: props.onCreateEditEvent,
|
|
9779
9932
|
onModifyEditEvent: props.onModifyEditEvent,
|
|
9780
|
-
children: /* @__PURE__ */
|
|
9933
|
+
children: /* @__PURE__ */ jsx15(
|
|
9781
9934
|
DimensionOverlay,
|
|
9782
9935
|
{
|
|
9783
9936
|
transform,
|
|
9784
9937
|
focusOnHover: props.focusOnHover,
|
|
9785
|
-
children: /* @__PURE__ */
|
|
9938
|
+
children: /* @__PURE__ */ jsx15(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx15(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx15(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx15(
|
|
9786
9939
|
DebugGraphicsOverlay,
|
|
9787
9940
|
{
|
|
9788
9941
|
transform,
|
|
9789
9942
|
debugGraphics: props.debugGraphics,
|
|
9790
|
-
children: /* @__PURE__ */
|
|
9791
|
-
|
|
9943
|
+
children: /* @__PURE__ */ jsx15(
|
|
9944
|
+
WarningGraphicsOverlay,
|
|
9792
9945
|
{
|
|
9793
9946
|
transform,
|
|
9794
|
-
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9947
|
+
elements,
|
|
9948
|
+
children: /* @__PURE__ */ jsx15(
|
|
9949
|
+
CanvasPrimitiveRenderer,
|
|
9950
|
+
{
|
|
9951
|
+
transform,
|
|
9952
|
+
primitives,
|
|
9953
|
+
width: props.width,
|
|
9954
|
+
height: props.height,
|
|
9955
|
+
grid: props.grid
|
|
9956
|
+
}
|
|
9957
|
+
)
|
|
9798
9958
|
}
|
|
9799
9959
|
)
|
|
9800
9960
|
}
|
|
@@ -9810,7 +9970,7 @@ var CanvasElementsRenderer = (props) => {
|
|
|
9810
9970
|
};
|
|
9811
9971
|
|
|
9812
9972
|
// src/PCBViewer.tsx
|
|
9813
|
-
import { jsx as
|
|
9973
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
9814
9974
|
var defaultTransform = compose5(translate5(400, 300), scale3(40, -40));
|
|
9815
9975
|
var PCBViewer = ({
|
|
9816
9976
|
circuitJson,
|
|
@@ -9839,7 +9999,7 @@ var PCBViewer = ({
|
|
|
9839
9999
|
});
|
|
9840
10000
|
let [editEvents, setEditEvents] = useState10([]);
|
|
9841
10001
|
editEvents = editEventsProp ?? editEvents;
|
|
9842
|
-
const initialRenderCompleted =
|
|
10002
|
+
const initialRenderCompleted = useRef9(false);
|
|
9843
10003
|
const circuitJsonKey = `${circuitJson?.length || 0}_${circuitJson?.editCount || 0}`;
|
|
9844
10004
|
const resetTransform = () => {
|
|
9845
10005
|
const elmBounds = refDimensions?.width > 0 ? refDimensions : { width: 500, height: 500 };
|
|
@@ -9861,7 +10021,7 @@ var PCBViewer = ({
|
|
|
9861
10021
|
setTransform(targetTransform);
|
|
9862
10022
|
return;
|
|
9863
10023
|
};
|
|
9864
|
-
|
|
10024
|
+
useEffect14(() => {
|
|
9865
10025
|
if (!refDimensions?.width) return;
|
|
9866
10026
|
if (!circuitJson) return;
|
|
9867
10027
|
if (circuitJson.length === 0) return;
|
|
@@ -9892,9 +10052,9 @@ var PCBViewer = ({
|
|
|
9892
10052
|
setEditEvents(newEditEvents);
|
|
9893
10053
|
onEditEventsChanged?.(newEditEvents);
|
|
9894
10054
|
};
|
|
9895
|
-
return /* @__PURE__ */
|
|
9896
|
-
/* @__PURE__ */
|
|
9897
|
-
/* @__PURE__ */
|
|
10055
|
+
return /* @__PURE__ */ jsxs12("div", { ref: transformRef, style: { position: "relative" }, children: [
|
|
10056
|
+
/* @__PURE__ */ jsx16("div", { ref, children: /* @__PURE__ */ jsxs12(ContextProviders, { initialState, children: [
|
|
10057
|
+
/* @__PURE__ */ jsx16(
|
|
9898
10058
|
CanvasElementsRenderer,
|
|
9899
10059
|
{
|
|
9900
10060
|
transform,
|
|
@@ -9919,9 +10079,9 @@ var PCBViewer = ({
|
|
|
9919
10079
|
},
|
|
9920
10080
|
refDimensions.width
|
|
9921
10081
|
),
|
|
9922
|
-
/* @__PURE__ */
|
|
10082
|
+
/* @__PURE__ */ jsx16(ToastContainer, {})
|
|
9923
10083
|
] }) }),
|
|
9924
|
-
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */
|
|
10084
|
+
clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx16(
|
|
9925
10085
|
"div",
|
|
9926
10086
|
{
|
|
9927
10087
|
onClick: () => {
|
|
@@ -9937,7 +10097,7 @@ var PCBViewer = ({
|
|
|
9937
10097
|
alignItems: "center",
|
|
9938
10098
|
justifyContent: "center"
|
|
9939
10099
|
},
|
|
9940
|
-
children: /* @__PURE__ */
|
|
10100
|
+
children: /* @__PURE__ */ jsx16(
|
|
9941
10101
|
"div",
|
|
9942
10102
|
{
|
|
9943
10103
|
style: {
|