@tscircuit/pcb-viewer 1.10.23 → 1.10.24
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 +178 -49
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -615,7 +615,7 @@ var require_dist = __commonJS({
|
|
|
615
615
|
}
|
|
616
616
|
});
|
|
617
617
|
module2.exports = __toCommonJS2(src_exports2);
|
|
618
|
-
var
|
|
618
|
+
var import_transformation_matrix12 = require("transformation-matrix");
|
|
619
619
|
var import_react21 = require("react");
|
|
620
620
|
var useMouseMatrixTransform2 = function() {
|
|
621
621
|
var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -624,7 +624,7 @@ var require_dist = __commonJS({
|
|
|
624
624
|
var _props_canvasElm;
|
|
625
625
|
var outerCanvasElm = (_props_canvasElm = props.canvasElm) !== null && _props_canvasElm !== void 0 ? _props_canvasElm : extRef.current;
|
|
626
626
|
var _props_initialTransform;
|
|
627
|
-
var _ref1 = _sliced_to_array((0, import_react21.useState)((_props_initialTransform = props.initialTransform) !== null && _props_initialTransform !== void 0 ? _props_initialTransform : (0,
|
|
627
|
+
var _ref1 = _sliced_to_array((0, import_react21.useState)((_props_initialTransform = props.initialTransform) !== null && _props_initialTransform !== void 0 ? _props_initialTransform : (0, import_transformation_matrix12.identity)()), 2), internalTransform = _ref1[0], setInternalTransform = _ref1[1];
|
|
628
628
|
var _ref2 = _sliced_to_array((0, import_react21.useState)(0), 2), waitCounter = _ref2[0], setWaitCounter = _ref2[1];
|
|
629
629
|
var _ref3 = _sliced_to_array((0, import_react21.useReducer)(function(s) {
|
|
630
630
|
return s + 1;
|
|
@@ -661,7 +661,7 @@ var require_dist = __commonJS({
|
|
|
661
661
|
var handleMouseUp = function handleMouseUp(e) {
|
|
662
662
|
if (!md) return;
|
|
663
663
|
m1 = getMousePos(e);
|
|
664
|
-
var new_tf = (0,
|
|
664
|
+
var new_tf = (0, import_transformation_matrix12.compose)((0, import_transformation_matrix12.translate)(m1.x - m0.x, m1.y - m0.y), init_tf);
|
|
665
665
|
setTransform(new_tf);
|
|
666
666
|
init_tf = new_tf;
|
|
667
667
|
md = false;
|
|
@@ -670,11 +670,11 @@ var require_dist = __commonJS({
|
|
|
670
670
|
mlastrel = getMousePos(e);
|
|
671
671
|
if (!md) return;
|
|
672
672
|
m1 = getMousePos(e);
|
|
673
|
-
setTransform((0,
|
|
673
|
+
setTransform((0, import_transformation_matrix12.compose)((0, import_transformation_matrix12.translate)(m1.x - m0.x, m1.y - m0.y), init_tf));
|
|
674
674
|
};
|
|
675
675
|
var handleMouseWheel = function handleMouseWheel(e) {
|
|
676
676
|
var center = getMousePos(e);
|
|
677
|
-
var new_tf = (0,
|
|
677
|
+
var new_tf = (0, import_transformation_matrix12.compose)((0, import_transformation_matrix12.translate)(center.x, center.y), (0, import_transformation_matrix12.scale)(1 - e.deltaY / 1e3, 1 - e.deltaY / 1e3), (0, import_transformation_matrix12.translate)(-center.x, -center.y), init_tf);
|
|
678
678
|
setTransform(new_tf);
|
|
679
679
|
init_tf = new_tf;
|
|
680
680
|
e.preventDefault();
|
|
@@ -689,7 +689,7 @@ var require_dist = __commonJS({
|
|
|
689
689
|
}
|
|
690
690
|
md = false;
|
|
691
691
|
m1 = getMousePos(e);
|
|
692
|
-
var new_tf = (0,
|
|
692
|
+
var new_tf = (0, import_transformation_matrix12.compose)((0, import_transformation_matrix12.translate)(m1.x - m0.x, m1.y - m0.y), init_tf);
|
|
693
693
|
setTransform(new_tf);
|
|
694
694
|
init_tf = new_tf;
|
|
695
695
|
};
|
|
@@ -744,7 +744,7 @@ var require_dist = __commonJS({
|
|
|
744
744
|
lastDragCancelTime
|
|
745
745
|
]);
|
|
746
746
|
var applyTransformToPoint = (0, import_react21.useCallback)(function(obj) {
|
|
747
|
-
return (0,
|
|
747
|
+
return (0, import_transformation_matrix12.applyToPoint)(transform, obj);
|
|
748
748
|
}, [
|
|
749
749
|
transform
|
|
750
750
|
]);
|
|
@@ -835,6 +835,9 @@ __export(dist_exports, {
|
|
|
835
835
|
pcb_fabrication_note_text: function() {
|
|
836
836
|
return pcb_fabrication_note_text;
|
|
837
837
|
},
|
|
838
|
+
pcb_group: function() {
|
|
839
|
+
return pcb_group;
|
|
840
|
+
},
|
|
838
841
|
pcb_hole: function() {
|
|
839
842
|
return pcb_hole;
|
|
840
843
|
},
|
|
@@ -847,6 +850,9 @@ __export(dist_exports, {
|
|
|
847
850
|
pcb_keepout: function() {
|
|
848
851
|
return pcb_keepout;
|
|
849
852
|
},
|
|
853
|
+
pcb_manual_edit_conflict_error: function() {
|
|
854
|
+
return pcb_manual_edit_conflict_error;
|
|
855
|
+
},
|
|
850
856
|
pcb_missing_footprint_error: function() {
|
|
851
857
|
return pcb_missing_footprint_error;
|
|
852
858
|
},
|
|
@@ -991,6 +997,9 @@ __export(dist_exports, {
|
|
|
991
997
|
schematic_trace: function() {
|
|
992
998
|
return schematic_trace;
|
|
993
999
|
},
|
|
1000
|
+
schematic_voltage_probe: function() {
|
|
1001
|
+
return schematic_voltage_probe;
|
|
1002
|
+
},
|
|
994
1003
|
size: function() {
|
|
995
1004
|
return size;
|
|
996
1005
|
},
|
|
@@ -1033,6 +1042,9 @@ __export(dist_exports, {
|
|
|
1033
1042
|
source_simple_inductor: function() {
|
|
1034
1043
|
return source_simple_inductor;
|
|
1035
1044
|
},
|
|
1045
|
+
source_simple_pin_header: function() {
|
|
1046
|
+
return source_simple_pin_header;
|
|
1047
|
+
},
|
|
1036
1048
|
source_simple_potentiometer: function() {
|
|
1037
1049
|
return source_simple_potentiometer;
|
|
1038
1050
|
},
|
|
@@ -1045,6 +1057,9 @@ __export(dist_exports, {
|
|
|
1045
1057
|
source_simple_resistor: function() {
|
|
1046
1058
|
return source_simple_resistor;
|
|
1047
1059
|
},
|
|
1060
|
+
source_simple_resonator: function() {
|
|
1061
|
+
return source_simple_resonator;
|
|
1062
|
+
},
|
|
1048
1063
|
source_trace: function() {
|
|
1049
1064
|
return source_trace;
|
|
1050
1065
|
},
|
|
@@ -7288,6 +7303,7 @@ var unitMappings = {
|
|
|
7288
7303
|
mΩ: 1e-3,
|
|
7289
7304
|
Ω: 1,
|
|
7290
7305
|
kΩ: 1e3,
|
|
7306
|
+
KΩ: 1e3,
|
|
7291
7307
|
MΩ: 1e6,
|
|
7292
7308
|
GΩ: 1e9,
|
|
7293
7309
|
TΩ: 1e12
|
|
@@ -7299,6 +7315,7 @@ var unitMappings = {
|
|
|
7299
7315
|
mV: 1e-3,
|
|
7300
7316
|
V: 1,
|
|
7301
7317
|
kV: 1e3,
|
|
7318
|
+
KV: 1e3,
|
|
7302
7319
|
MV: 1e6,
|
|
7303
7320
|
GV: 1e9,
|
|
7304
7321
|
TV: 1e12
|
|
@@ -7591,6 +7608,7 @@ var expectTypesMatch = function(shouldBe) {};
|
|
|
7591
7608
|
expectTypesMatch("extra props b");
|
|
7592
7609
|
expectTypesMatch("missing props b");
|
|
7593
7610
|
expectTypesMatch(true);
|
|
7611
|
+
expectTypesMatch("mismatched prop types: a");
|
|
7594
7612
|
var source_component_base = z.object({
|
|
7595
7613
|
type: z.literal("source_component"),
|
|
7596
7614
|
ftype: z.string().optional(),
|
|
@@ -7605,40 +7623,50 @@ var source_simple_capacitor = source_component_base.extend({
|
|
|
7605
7623
|
ftype: z.literal("simple_capacitor"),
|
|
7606
7624
|
capacitance: capacitance
|
|
7607
7625
|
});
|
|
7626
|
+
expectTypesMatch(true);
|
|
7608
7627
|
var source_simple_resistor = source_component_base.extend({
|
|
7609
7628
|
ftype: z.literal("simple_resistor"),
|
|
7610
7629
|
resistance: resistance
|
|
7611
7630
|
});
|
|
7631
|
+
expectTypesMatch(true);
|
|
7612
7632
|
var source_simple_diode = source_component_base.extend({
|
|
7613
7633
|
ftype: z.literal("simple_diode")
|
|
7614
7634
|
});
|
|
7635
|
+
expectTypesMatch(true);
|
|
7615
7636
|
var source_simple_ground = source_component_base.extend({
|
|
7616
7637
|
ftype: z.literal("simple_ground")
|
|
7617
7638
|
});
|
|
7639
|
+
expectTypesMatch(true);
|
|
7618
7640
|
var source_simple_bug = source_component_base.extend({
|
|
7619
7641
|
ftype: z.literal("simple_bug")
|
|
7620
7642
|
}).describe("@deprecated");
|
|
7621
7643
|
var source_simple_chip = source_component_base.extend({
|
|
7622
7644
|
ftype: z.literal("simple_chip")
|
|
7623
7645
|
});
|
|
7646
|
+
expectTypesMatch(true);
|
|
7624
7647
|
var source_led = source_simple_diode.extend({
|
|
7625
7648
|
ftype: z.literal("led")
|
|
7626
7649
|
});
|
|
7650
|
+
expectTypesMatch(true);
|
|
7627
7651
|
var source_simple_power_source = source_component_base.extend({
|
|
7628
7652
|
ftype: z.literal("simple_power_source"),
|
|
7629
7653
|
voltage: voltage
|
|
7630
7654
|
});
|
|
7655
|
+
expectTypesMatch(true);
|
|
7631
7656
|
var source_simple_battery = source_component_base.extend({
|
|
7632
7657
|
ftype: z.literal("simple_battery"),
|
|
7633
7658
|
capacity: battery_capacity
|
|
7634
7659
|
});
|
|
7660
|
+
expectTypesMatch(true);
|
|
7635
7661
|
var source_simple_inductor = source_component_base.extend({
|
|
7636
7662
|
ftype: z.literal("simple_inductor"),
|
|
7637
7663
|
inductance: inductance
|
|
7638
7664
|
});
|
|
7665
|
+
expectTypesMatch(true);
|
|
7639
7666
|
var source_simple_push_button = source_component_base.extend({
|
|
7640
7667
|
ftype: z.literal("simple_push_button")
|
|
7641
7668
|
});
|
|
7669
|
+
expectTypesMatch(true);
|
|
7642
7670
|
var source_simple_potentiometer = source_component_base.extend({
|
|
7643
7671
|
ftype: z.literal("simple_potentiometer"),
|
|
7644
7672
|
max_resistance: resistance
|
|
@@ -7648,6 +7676,22 @@ var source_simple_crystal = source_component_base.extend({
|
|
|
7648
7676
|
frequency: z.number().describe("Frequency in Hz"),
|
|
7649
7677
|
load_capacitance: z.number().optional().describe("Load capacitance in pF")
|
|
7650
7678
|
});
|
|
7679
|
+
expectTypesMatch(true);
|
|
7680
|
+
var source_simple_pin_header = source_component_base.extend({
|
|
7681
|
+
ftype: z.literal("simple_pin_header"),
|
|
7682
|
+
pin_count: z.number(),
|
|
7683
|
+
gender: z.enum([
|
|
7684
|
+
"male",
|
|
7685
|
+
"female"
|
|
7686
|
+
]).optional().default("male")
|
|
7687
|
+
});
|
|
7688
|
+
var source_simple_resonator = source_component_base.extend({
|
|
7689
|
+
ftype: z.literal("simple_resonator"),
|
|
7690
|
+
load_capacitance: capacitance,
|
|
7691
|
+
equivalent_series_resistance: resistance.optional(),
|
|
7692
|
+
frequency: frequency
|
|
7693
|
+
});
|
|
7694
|
+
expectTypesMatch(true);
|
|
7651
7695
|
var any_source_component = z.union([
|
|
7652
7696
|
source_simple_resistor,
|
|
7653
7697
|
source_simple_capacitor,
|
|
@@ -7661,7 +7705,9 @@ var any_source_component = z.union([
|
|
|
7661
7705
|
source_simple_inductor,
|
|
7662
7706
|
source_simple_push_button,
|
|
7663
7707
|
source_simple_potentiometer,
|
|
7664
|
-
source_simple_crystal
|
|
7708
|
+
source_simple_crystal,
|
|
7709
|
+
source_simple_pin_header,
|
|
7710
|
+
source_simple_resonator
|
|
7665
7711
|
]);
|
|
7666
7712
|
var source_port = z.object({
|
|
7667
7713
|
type: z.literal("source_port"),
|
|
@@ -7671,6 +7717,7 @@ var source_port = z.object({
|
|
|
7671
7717
|
source_port_id: z.string(),
|
|
7672
7718
|
source_component_id: z.string()
|
|
7673
7719
|
});
|
|
7720
|
+
expectTypesMatch(true);
|
|
7674
7721
|
var source_trace = z.object({
|
|
7675
7722
|
type: z.literal("source_trace"),
|
|
7676
7723
|
source_trace_id: z.string(),
|
|
@@ -7703,6 +7750,7 @@ var schematic_box = z.object({
|
|
|
7703
7750
|
x: distance,
|
|
7704
7751
|
y: distance
|
|
7705
7752
|
}).describe("Draws a box on the schematic");
|
|
7753
|
+
expectTypesMatch(true);
|
|
7706
7754
|
var schematic_path = z.object({
|
|
7707
7755
|
type: z.literal("schematic_path"),
|
|
7708
7756
|
schematic_component_id: z.string(),
|
|
@@ -7713,6 +7761,7 @@ var schematic_path = z.object({
|
|
|
7713
7761
|
is_filled: z.boolean().optional(),
|
|
7714
7762
|
points: z.array(point)
|
|
7715
7763
|
});
|
|
7764
|
+
expectTypesMatch(true);
|
|
7716
7765
|
var schematic_pin_styles = z.record(z.object({
|
|
7717
7766
|
left_margin: length.optional(),
|
|
7718
7767
|
right_margin: length.optional(),
|
|
@@ -7785,6 +7834,7 @@ var schematic_line = z.object({
|
|
|
7785
7834
|
y1: distance,
|
|
7786
7835
|
y2: distance
|
|
7787
7836
|
});
|
|
7837
|
+
expectTypesMatch(true);
|
|
7788
7838
|
var schematic_trace = z.object({
|
|
7789
7839
|
type: z.literal("schematic_trace"),
|
|
7790
7840
|
schematic_trace_id: z.string(),
|
|
@@ -7827,6 +7877,7 @@ var schematic_text = z.object({
|
|
|
7827
7877
|
]).default("center"),
|
|
7828
7878
|
color: z.string().default("#000000")
|
|
7829
7879
|
});
|
|
7880
|
+
expectTypesMatch(true);
|
|
7830
7881
|
var schematic_port = z.object({
|
|
7831
7882
|
type: z.literal("schematic_port"),
|
|
7832
7883
|
schematic_port_id: z.string(),
|
|
@@ -7866,12 +7917,13 @@ var schematic_net_label = z.object({
|
|
|
7866
7917
|
symbol_name: z.string().optional()
|
|
7867
7918
|
});
|
|
7868
7919
|
var schematic_error = z.object({
|
|
7869
|
-
schematic_error_id: z.string(),
|
|
7870
7920
|
type: z.literal("schematic_error"),
|
|
7921
|
+
schematic_error_id: z.string(),
|
|
7871
7922
|
// eventually each error type should be broken out into a dir of files
|
|
7872
7923
|
error_type: z.literal("schematic_port_not_found"),
|
|
7873
7924
|
message: z.string()
|
|
7874
7925
|
}).describe("Defines a schematic error on the schematic");
|
|
7926
|
+
expectTypesMatch(true);
|
|
7875
7927
|
var schematic_debug_object_base = z.object({
|
|
7876
7928
|
type: z.literal("schematic_debug_object"),
|
|
7877
7929
|
label: z.string().optional()
|
|
@@ -7896,6 +7948,14 @@ var schematic_debug_object = z.discriminatedUnion("shape", [
|
|
|
7896
7948
|
schematic_debug_point
|
|
7897
7949
|
]);
|
|
7898
7950
|
expectTypesMatch(true);
|
|
7951
|
+
var schematic_voltage_probe = z.object({
|
|
7952
|
+
type: z.literal("schematic_voltage_probe"),
|
|
7953
|
+
schematic_voltage_probe_id: z.string(),
|
|
7954
|
+
position: point,
|
|
7955
|
+
schematic_trace_id: z.string(),
|
|
7956
|
+
voltage: voltage.optional()
|
|
7957
|
+
}).describe("Defines a voltage probe measurement point on a schematic trace");
|
|
7958
|
+
expectTypesMatch(true);
|
|
7899
7959
|
var all_layers = [
|
|
7900
7960
|
"top",
|
|
7901
7961
|
"bottom",
|
|
@@ -8243,6 +8303,7 @@ var pcb_silkscreen_text = z.object({
|
|
|
8243
8303
|
font_size: distance.default("0.2mm"),
|
|
8244
8304
|
pcb_component_id: z.string(),
|
|
8245
8305
|
text: z.string(),
|
|
8306
|
+
ccw_rotation: z.number().optional(),
|
|
8246
8307
|
layer: layer_ref,
|
|
8247
8308
|
is_mirrored: z.boolean().default(false).optional(),
|
|
8248
8309
|
anchor_position: point.default({
|
|
@@ -8347,6 +8408,25 @@ var pcb_missing_footprint_error = z.object({
|
|
|
8347
8408
|
message: z.string()
|
|
8348
8409
|
}).describe("Defines a missing footprint error on the PCB");
|
|
8349
8410
|
expectTypesMatch(true);
|
|
8411
|
+
var pcb_manual_edit_conflict_error = z.object({
|
|
8412
|
+
type: z.literal("pcb_manual_edit_conflict_error"),
|
|
8413
|
+
pcb_error_id: getZodPrefixedIdWithDefault("pcb_manual_edit_conflict_error"),
|
|
8414
|
+
message: z.string(),
|
|
8415
|
+
pcb_component_id: z.string(),
|
|
8416
|
+
source_component_id: z.string()
|
|
8417
|
+
}).describe("Error emitted when a component has both manual placement and explicit pcbX/pcbY coordinates");
|
|
8418
|
+
expectTypesMatch(true);
|
|
8419
|
+
var pcb_group = z.object({
|
|
8420
|
+
type: z.literal("pcb_group"),
|
|
8421
|
+
pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
|
|
8422
|
+
width: length,
|
|
8423
|
+
height: length,
|
|
8424
|
+
center: point,
|
|
8425
|
+
pcb_component_ids: z.array(z.string()),
|
|
8426
|
+
name: z.string().optional(),
|
|
8427
|
+
description: z.string().optional()
|
|
8428
|
+
}).describe("Defines a group of components on the PCB");
|
|
8429
|
+
expectTypesMatch(true);
|
|
8350
8430
|
var cad_component = z.object({
|
|
8351
8431
|
type: z.literal("cad_component"),
|
|
8352
8432
|
cad_component_id: z.string(),
|
|
@@ -8378,11 +8458,14 @@ var any_circuit_element = z.union([
|
|
|
8378
8458
|
source_simple_power_source,
|
|
8379
8459
|
source_simple_battery,
|
|
8380
8460
|
source_simple_inductor,
|
|
8461
|
+
source_simple_pin_header,
|
|
8462
|
+
source_simple_resonator,
|
|
8381
8463
|
source_simple_potentiometer,
|
|
8382
8464
|
source_simple_push_button,
|
|
8383
8465
|
pcb_component,
|
|
8384
8466
|
pcb_hole,
|
|
8385
8467
|
pcb_missing_footprint_error,
|
|
8468
|
+
pcb_manual_edit_conflict_error,
|
|
8386
8469
|
pcb_plated_hole,
|
|
8387
8470
|
pcb_keepout,
|
|
8388
8471
|
pcb_port,
|
|
@@ -8392,6 +8475,7 @@ var any_circuit_element = z.union([
|
|
|
8392
8475
|
pcb_smtpad,
|
|
8393
8476
|
pcb_solder_paste,
|
|
8394
8477
|
pcb_board,
|
|
8478
|
+
pcb_group,
|
|
8395
8479
|
pcb_trace_hint,
|
|
8396
8480
|
pcb_silkscreen_line,
|
|
8397
8481
|
pcb_silkscreen_path,
|
|
@@ -8414,6 +8498,7 @@ var any_circuit_element = z.union([
|
|
|
8414
8498
|
schematic_error,
|
|
8415
8499
|
schematic_net_label,
|
|
8416
8500
|
schematic_debug_object,
|
|
8501
|
+
schematic_voltage_probe,
|
|
8417
8502
|
cad_component
|
|
8418
8503
|
]);
|
|
8419
8504
|
var any_soup_element = any_circuit_element;
|
|
@@ -9649,7 +9734,7 @@ var useMeasure_default = isBrowser && typeof window.ResizeObserver !== "undefine
|
|
|
9649
9734
|
];
|
|
9650
9735
|
};
|
|
9651
9736
|
// src/PCBViewer.tsx
|
|
9652
|
-
var
|
|
9737
|
+
var import_transformation_matrix11 = require("transformation-matrix");
|
|
9653
9738
|
var import_use_mouse_matrix_transform = __toESM(require_dist());
|
|
9654
9739
|
// src/components/CanvasElementsRenderer.tsx
|
|
9655
9740
|
var import_react18 = require("react");
|
|
@@ -10308,6 +10393,36 @@ var Drawer = /*#__PURE__*/ function() {
|
|
|
10308
10393
|
]);
|
|
10309
10394
|
return Drawer;
|
|
10310
10395
|
}();
|
|
10396
|
+
// src/lib/util/rotate-text.ts
|
|
10397
|
+
var import_transformation_matrix4 = require("transformation-matrix");
|
|
10398
|
+
function rotateText(rotateTextParams) {
|
|
10399
|
+
var lines = rotateTextParams.lines, anchorPoint = rotateTextParams.anchorPoint, ccwRotation = rotateTextParams.ccwRotation;
|
|
10400
|
+
if (!ccwRotation) return lines;
|
|
10401
|
+
var rad = ccwRotation * Math.PI / 180;
|
|
10402
|
+
var rotationMatrix = (0, import_transformation_matrix4.rotate)(rad);
|
|
10403
|
+
var transform = (0, import_transformation_matrix4.compose)((0, import_transformation_matrix4.translate)(anchorPoint.x, anchorPoint.y), rotationMatrix, (0, import_transformation_matrix4.translate)(-anchorPoint.x, -anchorPoint.y));
|
|
10404
|
+
(0, import_transformation_matrix4.applyToPoint)(transform, anchorPoint);
|
|
10405
|
+
return lines.map(function(line) {
|
|
10406
|
+
return _object_spread_props(_object_spread({}, line), {
|
|
10407
|
+
x1: (0, import_transformation_matrix4.applyToPoint)(transform, {
|
|
10408
|
+
x: line.x1,
|
|
10409
|
+
y: line.y1
|
|
10410
|
+
}).x,
|
|
10411
|
+
y1: (0, import_transformation_matrix4.applyToPoint)(transform, {
|
|
10412
|
+
x: line.x1,
|
|
10413
|
+
y: line.y1
|
|
10414
|
+
}).y,
|
|
10415
|
+
x2: (0, import_transformation_matrix4.applyToPoint)(transform, {
|
|
10416
|
+
x: line.x2,
|
|
10417
|
+
y: line.y2
|
|
10418
|
+
}).x,
|
|
10419
|
+
y2: (0, import_transformation_matrix4.applyToPoint)(transform, {
|
|
10420
|
+
x: line.x2,
|
|
10421
|
+
y: line.y2
|
|
10422
|
+
}).y
|
|
10423
|
+
});
|
|
10424
|
+
});
|
|
10425
|
+
}
|
|
10311
10426
|
// src/assets/alphabet.ts
|
|
10312
10427
|
var svgAlphabet = {
|
|
10313
10428
|
"0": "M0.4544564813877358 0L0.2723441540828736 0.03592830447352719L0.1086847233315459 0.14528754990019965L0.020630545837255005 0.3040632652221331L0 0.5395277421960205L0.049259221760993496 0.7369487828466779L0.18080513776237842 0.9005494166306564L0.37036887043974215 0.9872116270037247L0.5864663759301132 1L0.8148695622827444 0.9332890276148733L0.9326583645506394 0.8113052246023419L1 0.4031281830668562L0.833288960385582 0.09886798567812842L0.6801767918233781 0.02483708485091681L0.4544564813877358 0",
|
|
@@ -10454,10 +10569,22 @@ var drawText = function(drawer, text) {
|
|
|
10454
10569
|
(_text_x = text.x) !== null && _text_x !== void 0 ? _text_x : text.x = 0;
|
|
10455
10570
|
var _text_y;
|
|
10456
10571
|
(_text_y = text.y) !== null && _text_y !== void 0 ? _text_y : text.y = 0;
|
|
10572
|
+
var rotationAnchor = {
|
|
10573
|
+
x: text.x,
|
|
10574
|
+
y: text.y
|
|
10575
|
+
};
|
|
10457
10576
|
var text_lines = convertTextToLines(_object_spread_props(_object_spread({}, text), {
|
|
10458
10577
|
x: text.x + alignOffset.x,
|
|
10459
10578
|
y: text.y + alignOffset.y
|
|
10460
10579
|
}));
|
|
10580
|
+
if (text.ccw_rotation) {
|
|
10581
|
+
var rotateTextParams = {
|
|
10582
|
+
lines: text_lines,
|
|
10583
|
+
anchorPoint: rotationAnchor,
|
|
10584
|
+
ccwRotation: text.ccw_rotation
|
|
10585
|
+
};
|
|
10586
|
+
text_lines = rotateText(rotateTextParams);
|
|
10587
|
+
}
|
|
10461
10588
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
10462
10589
|
try {
|
|
10463
10590
|
for(var _iterator = text_lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -11210,7 +11337,9 @@ var convertElementToPrimitives = function(element, allElements) {
|
|
|
11210
11337
|
layer: element.layer === "bottom" ? "bottom_silkscreen" : "top_silkscreen",
|
|
11211
11338
|
align: (_element_anchor_alignment = element.anchor_alignment) !== null && _element_anchor_alignment !== void 0 ? _element_anchor_alignment : "center",
|
|
11212
11339
|
text: element.text,
|
|
11213
|
-
size: element.font_size
|
|
11340
|
+
size: element.font_size,
|
|
11341
|
+
// Add the required 'size' property
|
|
11342
|
+
ccw_rotation: element.ccw_rotation
|
|
11214
11343
|
}
|
|
11215
11344
|
];
|
|
11216
11345
|
}
|
|
@@ -11236,7 +11365,7 @@ var convertElementToPrimitives = function(element, allElements) {
|
|
|
11236
11365
|
// src/components/MouseElementTracker.tsx
|
|
11237
11366
|
var import_react9 = require("react");
|
|
11238
11367
|
var import_react10 = require("react");
|
|
11239
|
-
var
|
|
11368
|
+
var import_transformation_matrix5 = require("transformation-matrix");
|
|
11240
11369
|
// src/components/ElementOverlayBox.tsx
|
|
11241
11370
|
var import_react8 = require("react");
|
|
11242
11371
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -11390,7 +11519,7 @@ var MouseElementTracker = function(param) {
|
|
|
11390
11519
|
if (((_primitive__element = primitive._element) === null || _primitive__element === void 0 ? void 0 : _primitive__element.type) === "pcb_via") return "continue";
|
|
11391
11520
|
if (((_primitive__element1 = primitive._element) === null || _primitive__element1 === void 0 ? void 0 : _primitive__element1.type) === "pcb_component") return "continue";
|
|
11392
11521
|
if ((primitive === null || primitive === void 0 ? void 0 : primitive.layer) === "drill") return "continue";
|
|
11393
|
-
var screenPos = (0,
|
|
11522
|
+
var screenPos = (0, import_transformation_matrix5.applyToPoint)(transform, primitive);
|
|
11394
11523
|
var w = "w" in primitive ? primitive.w : "r" in primitive ? primitive.r * 2 : 0;
|
|
11395
11524
|
var h = "h" in primitive ? primitive.h : "r" in primitive ? primitive.r * 2 : 0;
|
|
11396
11525
|
var screenSize = {
|
|
@@ -11437,7 +11566,7 @@ var MouseElementTracker = function(param) {
|
|
|
11437
11566
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
11438
11567
|
var x = e.clientX - rect.left;
|
|
11439
11568
|
var y = e.clientY - rect.top;
|
|
11440
|
-
var rwPoint = (0,
|
|
11569
|
+
var rwPoint = (0, import_transformation_matrix5.applyToPoint)((0, import_transformation_matrix5.inverse)(transform), {
|
|
11441
11570
|
x: x,
|
|
11442
11571
|
y: y
|
|
11443
11572
|
});
|
|
@@ -11489,11 +11618,11 @@ var MouseElementTracker = function(param) {
|
|
|
11489
11618
|
};
|
|
11490
11619
|
// src/components/DimensionOverlay.tsx
|
|
11491
11620
|
var import_react11 = require("react");
|
|
11492
|
-
var
|
|
11621
|
+
var import_transformation_matrix6 = require("transformation-matrix");
|
|
11493
11622
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
11494
11623
|
var DimensionOverlay = function(param) {
|
|
11495
11624
|
var children = param.children, transform = param.transform;
|
|
11496
|
-
if (!transform) transform = (0,
|
|
11625
|
+
if (!transform) transform = (0, import_transformation_matrix6.identity)();
|
|
11497
11626
|
var _ref = _sliced_to_array((0, import_react11.useState)(false), 2), dimensionToolVisible = _ref[0], setDimensionToolVisible = _ref[1];
|
|
11498
11627
|
var _ref1 = _sliced_to_array((0, import_react11.useState)(false), 2), dimensionToolStretching = _ref1[0], setDimensionToolStretching = _ref1[1];
|
|
11499
11628
|
var _ref2 = _sliced_to_array((0, import_react11.useState)({
|
|
@@ -11561,8 +11690,8 @@ var DimensionOverlay = function(param) {
|
|
|
11561
11690
|
}, [
|
|
11562
11691
|
containerRef
|
|
11563
11692
|
]);
|
|
11564
|
-
var screenDStart = (0,
|
|
11565
|
-
var screenDEnd = (0,
|
|
11693
|
+
var screenDStart = (0, import_transformation_matrix6.applyToPoint)(transform, dStart);
|
|
11694
|
+
var screenDEnd = (0, import_transformation_matrix6.applyToPoint)(transform, dEnd);
|
|
11566
11695
|
var arrowScreenBounds = {
|
|
11567
11696
|
left: Math.min(screenDStart.x, screenDEnd.x),
|
|
11568
11697
|
right: Math.max(screenDStart.x, screenDEnd.x),
|
|
@@ -11595,7 +11724,7 @@ var DimensionOverlay = function(param) {
|
|
|
11595
11724
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
11596
11725
|
var x = e.clientX - rect.left;
|
|
11597
11726
|
var y = e.clientY - rect.top;
|
|
11598
|
-
var rwPoint = (0,
|
|
11727
|
+
var rwPoint = (0, import_transformation_matrix6.applyToPoint)((0, import_transformation_matrix6.inverse)(transform), {
|
|
11599
11728
|
x: x,
|
|
11600
11729
|
y: y
|
|
11601
11730
|
});
|
|
@@ -11757,7 +11886,7 @@ var import_css = require("@emotion/css");
|
|
|
11757
11886
|
// package.json
|
|
11758
11887
|
var package_default = {
|
|
11759
11888
|
name: "@tscircuit/pcb-viewer",
|
|
11760
|
-
version: "1.10.
|
|
11889
|
+
version: "1.10.23",
|
|
11761
11890
|
main: "dist/index.js",
|
|
11762
11891
|
repository: "tscircuit/pcb-viewer",
|
|
11763
11892
|
license: "MIT",
|
|
@@ -11782,14 +11911,14 @@ var package_default = {
|
|
|
11782
11911
|
"@storybook/nextjs": "^8.0.6",
|
|
11783
11912
|
"@storybook/react": "^8.0.6",
|
|
11784
11913
|
"@swc/core": "^1.4.12",
|
|
11785
|
-
"@tscircuit/core": "
|
|
11914
|
+
"@tscircuit/core": "0.0.236",
|
|
11786
11915
|
"@tscircuit/eagle-xml-converter": "^0.0.6",
|
|
11787
11916
|
"@tscircuit/props": "^0.0.108",
|
|
11788
11917
|
"@tscircuit/soup-util": "^0.0.38",
|
|
11789
11918
|
"@types/color": "^3.0.6",
|
|
11790
11919
|
"@types/node": "18.7.23",
|
|
11791
11920
|
"@types/react": "^18.3.3",
|
|
11792
|
-
"circuit-json": "^0.0.
|
|
11921
|
+
"circuit-json": "^0.0.120",
|
|
11793
11922
|
next: "^14.1.4",
|
|
11794
11923
|
react: "^18.2.0",
|
|
11795
11924
|
"react-dom": "^18.2.0",
|
|
@@ -12120,7 +12249,7 @@ var ToolbarOverlay = function(param) {
|
|
|
12120
12249
|
// src/components/ErrorOverlay.tsx
|
|
12121
12250
|
var import_css2 = require("@emotion/css");
|
|
12122
12251
|
var import_react14 = require("react");
|
|
12123
|
-
var
|
|
12252
|
+
var import_transformation_matrix7 = require("transformation-matrix");
|
|
12124
12253
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
12125
12254
|
var ErrorSVG = function(param) {
|
|
12126
12255
|
var screenPort1 = param.screenPort1, screenPort2 = param.screenPort2, errorCenter = param.errorCenter, canLineBeDrawn = param.canLineBeDrawn;
|
|
@@ -12169,7 +12298,7 @@ var ErrorSVG = function(param) {
|
|
|
12169
12298
|
};
|
|
12170
12299
|
var ErrorOverlay = function(param) {
|
|
12171
12300
|
var children = param.children, transform = param.transform, elements = param.elements;
|
|
12172
|
-
if (!transform) transform = (0,
|
|
12301
|
+
if (!transform) transform = (0, import_transformation_matrix7.identity)();
|
|
12173
12302
|
var containerRef = (0, import_react14.useRef)(null);
|
|
12174
12303
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", {
|
|
12175
12304
|
style: {
|
|
@@ -12189,11 +12318,11 @@ var ErrorOverlay = function(param) {
|
|
|
12189
12318
|
return el2.type === "pcb_port" && el2.pcb_port_id === (pcb_port_ids === null || pcb_port_ids === void 0 ? void 0 : pcb_port_ids[1]);
|
|
12190
12319
|
});
|
|
12191
12320
|
if (!port1 || !port2) return null;
|
|
12192
|
-
var screenPort1 = (0,
|
|
12321
|
+
var screenPort1 = (0, import_transformation_matrix7.applyToPoint)(transform, {
|
|
12193
12322
|
x: port1.x,
|
|
12194
12323
|
y: port1.y
|
|
12195
12324
|
});
|
|
12196
|
-
var screenPort2 = (0,
|
|
12325
|
+
var screenPort2 = (0, import_transformation_matrix7.applyToPoint)(transform, {
|
|
12197
12326
|
x: port2.x,
|
|
12198
12327
|
y: port2.y
|
|
12199
12328
|
});
|
|
@@ -12233,7 +12362,7 @@ var ErrorOverlay = function(param) {
|
|
|
12233
12362
|
};
|
|
12234
12363
|
// src/components/EditPlacementOverlay.tsx
|
|
12235
12364
|
var import_react15 = require("react");
|
|
12236
|
-
var
|
|
12365
|
+
var import_transformation_matrix8 = require("transformation-matrix");
|
|
12237
12366
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
12238
12367
|
var isInsideOf = function(pcb_component2, point2) {
|
|
12239
12368
|
var padding = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
@@ -12247,7 +12376,7 @@ var isInsideOf = function(pcb_component2, point2) {
|
|
|
12247
12376
|
};
|
|
12248
12377
|
var EditPlacementOverlay = function(param) {
|
|
12249
12378
|
var children = param.children, disabledProp = param.disabled, transform = param.transform, soup = param.soup, cancelPanDrag = param.cancelPanDrag, onCreateEditEvent = param.onCreateEditEvent, onModifyEditEvent = param.onModifyEditEvent;
|
|
12250
|
-
if (!transform) transform = (0,
|
|
12379
|
+
if (!transform) transform = (0, import_transformation_matrix8.identity)();
|
|
12251
12380
|
var containerRef = (0, import_react15.useRef)(null);
|
|
12252
12381
|
var _ref = _sliced_to_array((0, import_react15.useState)(null), 2), activePcbComponentId = _ref[0], setActivePcbComponent = _ref[1];
|
|
12253
12382
|
var _ref1 = _sliced_to_array((0, import_react15.useState)(null), 2), dragState = _ref1[0], setDragState = _ref1[1];
|
|
@@ -12274,7 +12403,7 @@ var EditPlacementOverlay = function(param) {
|
|
|
12274
12403
|
var x = e.clientX - rect.left;
|
|
12275
12404
|
var y = e.clientY - rect.top;
|
|
12276
12405
|
if (isNaN(x) || isNaN(y)) return;
|
|
12277
|
-
var rwMousePoint = (0,
|
|
12406
|
+
var rwMousePoint = (0, import_transformation_matrix8.applyToPoint)((0, import_transformation_matrix8.inverse)(transform), {
|
|
12278
12407
|
x: x,
|
|
12279
12408
|
y: y
|
|
12280
12409
|
});
|
|
@@ -12335,7 +12464,7 @@ var EditPlacementOverlay = function(param) {
|
|
|
12335
12464
|
var x = e.clientX - rect.left;
|
|
12336
12465
|
var y = e.clientY - rect.top;
|
|
12337
12466
|
if (isNaN(x) || isNaN(y)) return;
|
|
12338
|
-
var rwMousePoint = (0,
|
|
12467
|
+
var rwMousePoint = (0, import_transformation_matrix8.applyToPoint)((0, import_transformation_matrix8.inverse)(transform), {
|
|
12339
12468
|
x: x,
|
|
12340
12469
|
y: y
|
|
12341
12470
|
});
|
|
@@ -12368,7 +12497,7 @@ var EditPlacementOverlay = function(param) {
|
|
|
12368
12497
|
return e.type === "pcb_component";
|
|
12369
12498
|
}).map(function(e) {
|
|
12370
12499
|
if (!(e === null || e === void 0 ? void 0 : e.center)) return null;
|
|
12371
|
-
var projectedCenter = (0,
|
|
12500
|
+
var projectedCenter = (0, import_transformation_matrix8.applyToPoint)(transform, e.center);
|
|
12372
12501
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", {
|
|
12373
12502
|
style: {
|
|
12374
12503
|
position: "absolute",
|
|
@@ -12388,7 +12517,7 @@ var EditPlacementOverlay = function(param) {
|
|
|
12388
12517
|
};
|
|
12389
12518
|
// src/components/EditTraceHintOverlay.tsx
|
|
12390
12519
|
var import_react17 = require("react");
|
|
12391
|
-
var
|
|
12520
|
+
var import_transformation_matrix9 = require("transformation-matrix");
|
|
12392
12521
|
// src/components/HotkeyActionMenu.tsx
|
|
12393
12522
|
var import_css3 = require("@emotion/css");
|
|
12394
12523
|
var import_react16 = require("react");
|
|
@@ -12463,7 +12592,7 @@ var isInsideOfPlatedHole = function(hole, point2) {
|
|
|
12463
12592
|
var EditTraceHintOverlay = function(param) {
|
|
12464
12593
|
var children = param.children, disabledProp = param.disabled, transform = param.transform, soup = param.soup, cancelPanDrag = param.cancelPanDrag, onCreateEditEvent = param.onCreateEditEvent, onModifyEditEvent = param.onModifyEditEvent;
|
|
12465
12594
|
var _containerRef_current;
|
|
12466
|
-
if (!transform) transform = (0,
|
|
12595
|
+
if (!transform) transform = (0, import_transformation_matrix9.identity)();
|
|
12467
12596
|
var containerRef = (0, import_react17.useRef)(null);
|
|
12468
12597
|
var containerBounds = (_containerRef_current = containerRef.current) === null || _containerRef_current === void 0 ? void 0 : _containerRef_current.getBoundingClientRect();
|
|
12469
12598
|
var _ref = _sliced_to_array((0, import_react17.useState)(null), 2), selectedElement = _ref[0], setSelectedElement = _ref[1];
|
|
@@ -12477,8 +12606,8 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12477
12606
|
var disabled = disabledProp || !in_edit_trace_mode;
|
|
12478
12607
|
var ogCenterScreen, dragEndScreen;
|
|
12479
12608
|
if ((dragState === null || dragState === void 0 ? void 0 : dragState.originalCenter) && (dragState === null || dragState === void 0 ? void 0 : dragState.dragEnd)) {
|
|
12480
|
-
ogCenterScreen = (0,
|
|
12481
|
-
dragEndScreen = (0,
|
|
12609
|
+
ogCenterScreen = (0, import_transformation_matrix9.applyToPoint)(transform, dragState === null || dragState === void 0 ? void 0 : dragState.originalCenter);
|
|
12610
|
+
dragEndScreen = (0, import_transformation_matrix9.applyToPoint)(transform, dragState === null || dragState === void 0 ? void 0 : dragState.dragEnd);
|
|
12482
12611
|
}
|
|
12483
12612
|
(0, import_react17.useEffect)(function() {
|
|
12484
12613
|
var keyDown = function keyDown(e) {
|
|
@@ -12507,7 +12636,7 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12507
12636
|
var x = e.clientX - rect.left;
|
|
12508
12637
|
var y = e.clientY - rect.top;
|
|
12509
12638
|
if (isNaN(x) || isNaN(y)) return;
|
|
12510
|
-
var rwMousePoint = (0,
|
|
12639
|
+
var rwMousePoint = (0, import_transformation_matrix9.applyToPoint)((0, import_transformation_matrix9.inverse)(transform), {
|
|
12511
12640
|
x: x,
|
|
12512
12641
|
y: y
|
|
12513
12642
|
});
|
|
@@ -12572,7 +12701,7 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12572
12701
|
var x = e.clientX - rect.left;
|
|
12573
12702
|
var y = e.clientY - rect.top;
|
|
12574
12703
|
if (isNaN(x) || isNaN(y)) return;
|
|
12575
|
-
var rwMousePoint = (0,
|
|
12704
|
+
var rwMousePoint = (0, import_transformation_matrix9.applyToPoint)((0, import_transformation_matrix9.inverse)(transform), {
|
|
12576
12705
|
x: x,
|
|
12577
12706
|
y: y
|
|
12578
12707
|
});
|
|
@@ -12591,14 +12720,14 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12591
12720
|
var x = e.clientX - rect.left;
|
|
12592
12721
|
var y = e.clientY - rect.top;
|
|
12593
12722
|
if (isNaN(x) || isNaN(y)) return;
|
|
12594
|
-
var rwMousePoint = (0,
|
|
12723
|
+
var rwMousePoint = (0, import_transformation_matrix9.applyToPoint)((0, import_transformation_matrix9.inverse)(transform), {
|
|
12595
12724
|
x: x,
|
|
12596
12725
|
y: y
|
|
12597
12726
|
});
|
|
12598
12727
|
if (dragState) {
|
|
12599
12728
|
cancelPanDrag();
|
|
12600
12729
|
var _dragState_editEvent_route_slice_;
|
|
12601
|
-
var lastPointScreen = (0,
|
|
12730
|
+
var lastPointScreen = (0, import_transformation_matrix9.applyToPoint)(transform, (_dragState_editEvent_route_slice_ = dragState.editEvent.route.slice(-1)[0]) !== null && _dragState_editEvent_route_slice_ !== void 0 ? _dragState_editEvent_route_slice_ : dragState.originalCenter);
|
|
12602
12731
|
var distanceFromLastPoint = Math.sqrt(Math.pow(x - lastPointScreen.x, 2) + Math.pow(y - lastPointScreen.y, 2));
|
|
12603
12732
|
if (distanceFromLastPoint < 20) {
|
|
12604
12733
|
onCreateEditEvent(_object_spread_props(_object_spread({}, dragState.editEvent), {
|
|
@@ -12636,13 +12765,13 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12636
12765
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", {
|
|
12637
12766
|
stroke: "red",
|
|
12638
12767
|
d: "M ".concat(ogCenterScreen.x, " ").concat(ogCenterScreen.y, " ").concat(dragState === null || dragState === void 0 ? void 0 : dragState.editEvent.route.map(function(p) {
|
|
12639
|
-
return (0,
|
|
12768
|
+
return (0, import_transformation_matrix9.applyToPoint)(transform, p);
|
|
12640
12769
|
}).map(function(p) {
|
|
12641
12770
|
return "L ".concat(p.x, " ").concat(p.y);
|
|
12642
12771
|
}).join(" "), " L ").concat(dragEndScreen.x, " ").concat(dragEndScreen.y)
|
|
12643
12772
|
}),
|
|
12644
12773
|
dragState === null || dragState === void 0 ? void 0 : dragState.editEvent.route.map(function(r, i) {
|
|
12645
|
-
var rScreen = (0,
|
|
12774
|
+
var rScreen = (0, import_transformation_matrix9.applyToPoint)(transform, r);
|
|
12646
12775
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react17.Fragment, {
|
|
12647
12776
|
children: [
|
|
12648
12777
|
r.via && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", {
|
|
@@ -12690,7 +12819,7 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12690
12819
|
}).map(function(e) {
|
|
12691
12820
|
var route = e.route;
|
|
12692
12821
|
var pcb_port2 = su_default(soup).pcb_port.get(e.pcb_port_id);
|
|
12693
|
-
var pcb_port_screen = (0,
|
|
12822
|
+
var pcb_port_screen = (0, import_transformation_matrix9.applyToPoint)(transform, pcb_port2);
|
|
12694
12823
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react17.Fragment, {
|
|
12695
12824
|
children: [
|
|
12696
12825
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", {
|
|
@@ -12703,13 +12832,13 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12703
12832
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", {
|
|
12704
12833
|
stroke: "red",
|
|
12705
12834
|
d: "M ".concat(pcb_port_screen.x, " ").concat(pcb_port_screen.y, " ").concat(route.map(function(r) {
|
|
12706
|
-
return (0,
|
|
12835
|
+
return (0, import_transformation_matrix9.applyToPoint)(transform, r);
|
|
12707
12836
|
}).map(function(r) {
|
|
12708
12837
|
return "L ".concat(r.x, " ").concat(r.y);
|
|
12709
12838
|
}).join(" "))
|
|
12710
12839
|
}, "path-".concat(e.pcb_port_id)),
|
|
12711
12840
|
route.map(function(r) {
|
|
12712
|
-
return _object_spread({}, r, (0,
|
|
12841
|
+
return _object_spread({}, r, (0, import_transformation_matrix9.applyToPoint)(transform, r));
|
|
12713
12842
|
}).map(function(r, i) {
|
|
12714
12843
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react17.Fragment, {
|
|
12715
12844
|
children: [
|
|
@@ -12755,7 +12884,7 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12755
12884
|
});
|
|
12756
12885
|
};
|
|
12757
12886
|
// src/components/RatsNestOverlay.tsx
|
|
12758
|
-
var
|
|
12887
|
+
var import_transformation_matrix10 = require("transformation-matrix");
|
|
12759
12888
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
12760
12889
|
var RatsNestOverlay = function(param) {
|
|
12761
12890
|
var transform = param.transform, soup = param.soup, children = param.children;
|
|
@@ -12763,7 +12892,7 @@ var RatsNestOverlay = function(param) {
|
|
|
12763
12892
|
return s.is_showing_rats_nest;
|
|
12764
12893
|
});
|
|
12765
12894
|
if (!soup || !isShowingRatsNest) return children;
|
|
12766
|
-
if (!transform) transform = (0,
|
|
12895
|
+
if (!transform) transform = (0, import_transformation_matrix10.identity)();
|
|
12767
12896
|
var sourceTraces = su_default(soup).source_trace.list();
|
|
12768
12897
|
var groups = [];
|
|
12769
12898
|
sourceTraces.forEach(function(sourceTrace) {
|
|
@@ -12797,7 +12926,7 @@ var RatsNestOverlay = function(param) {
|
|
|
12797
12926
|
},
|
|
12798
12927
|
children: groups.map(function(group, index) {
|
|
12799
12928
|
var points = group.map(function(port) {
|
|
12800
|
-
return (0,
|
|
12929
|
+
return (0, import_transformation_matrix10.applyToPoint)(transform, {
|
|
12801
12930
|
x: port.x,
|
|
12802
12931
|
y: port.y
|
|
12803
12932
|
});
|
|
@@ -12965,7 +13094,7 @@ var CanvasElementsRenderer = function(props) {
|
|
|
12965
13094
|
};
|
|
12966
13095
|
// src/PCBViewer.tsx
|
|
12967
13096
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
12968
|
-
var defaultTransform = (0,
|
|
13097
|
+
var defaultTransform = (0, import_transformation_matrix11.compose)((0, import_transformation_matrix11.translate)(400, 300), (0, import_transformation_matrix11.scale)(40, -40));
|
|
12969
13098
|
var PCBViewer = function(param) {
|
|
12970
13099
|
var children = param.children, soup = param.soup, circuitJson = param.circuitJson, _param_height = param.height, height = _param_height === void 0 ? 600 : _param_height, initialState = param.initialState, _param_allowEditing = param.allowEditing, allowEditing = _param_allowEditing === void 0 ? true : _param_allowEditing, editEventsProp = param.editEvents, onEditEventsChanged = param.onEditEventsChanged;
|
|
12971
13100
|
soup !== null && soup !== void 0 ? soup : soup = circuitJson;
|
|
@@ -13000,7 +13129,7 @@ var PCBViewer = function(param) {
|
|
|
13000
13129
|
var _elmBounds_width, _elmBounds_height;
|
|
13001
13130
|
var scaleFactor = Math.min(((_elmBounds_width = elmBounds.width) !== null && _elmBounds_width !== void 0 ? _elmBounds_width : 0) / width, ((_elmBounds_height = elmBounds.height) !== null && _elmBounds_height !== void 0 ? _elmBounds_height : 0) / height2, 100) * 0.75;
|
|
13002
13131
|
var _elmBounds_width1, _elmBounds_height1;
|
|
13003
|
-
setTransform((0,
|
|
13132
|
+
setTransform((0, import_transformation_matrix11.compose)((0, import_transformation_matrix11.translate)(((_elmBounds_width1 = elmBounds.width) !== null && _elmBounds_width1 !== void 0 ? _elmBounds_width1 : 0) / 2, ((_elmBounds_height1 = elmBounds.height) !== null && _elmBounds_height1 !== void 0 ? _elmBounds_height1 : 0) / 2), (0, import_transformation_matrix11.scale)(scaleFactor, -scaleFactor, 0, 0), (0, import_transformation_matrix11.translate)(-center.x, -center.y)));
|
|
13004
13133
|
};
|
|
13005
13134
|
(0, import_react20.useEffect)(function() {
|
|
13006
13135
|
if (refDimensions && refDimensions.width !== 0 && (children || soup)) {
|