@tscircuit/pcb-viewer 1.10.22 → 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 +184 -52
- 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");
|
|
@@ -11281,8 +11410,9 @@ var layerColorHightlightMap = {
|
|
|
11281
11410
|
};
|
|
11282
11411
|
var HighlightedPrimitiveBoxWithText = function(param) {
|
|
11283
11412
|
var primitive = param.primitive;
|
|
11284
|
-
var _primitive__element
|
|
11413
|
+
var _primitive__element;
|
|
11285
11414
|
var _ref = _sliced_to_array((0, import_react8.useState)(false), 2), finalState = _ref[0], setFinalState = _ref[1];
|
|
11415
|
+
var primitiveElement = primitive._element;
|
|
11286
11416
|
(0, import_react8.useEffect)(function() {
|
|
11287
11417
|
setTimeout(function() {
|
|
11288
11418
|
setFinalState(true);
|
|
@@ -11299,8 +11429,10 @@ var HighlightedPrimitiveBoxWithText = function(param) {
|
|
|
11299
11429
|
var sip = 26;
|
|
11300
11430
|
var _layerColorHightlightMap_primitive__element_layer;
|
|
11301
11431
|
var color2 = (_layerColorHightlightMap_primitive__element_layer = layerColorHightlightMap[primitive === null || primitive === void 0 ? void 0 : (_primitive__element = primitive._element) === null || _primitive__element === void 0 ? void 0 : _primitive__element.layer]) !== null && _layerColorHightlightMap_primitive__element_layer !== void 0 ? _layerColorHightlightMap_primitive__element_layer : "red";
|
|
11302
|
-
var
|
|
11303
|
-
|
|
11432
|
+
var rotation2 = 0;
|
|
11433
|
+
if (primitiveElement.type === "pcb_smtpad" && (primitiveElement === null || primitiveElement === void 0 ? void 0 : primitiveElement.shape) === "rotated_rect") {
|
|
11434
|
+
rotation2 = primitiveElement === null || primitiveElement === void 0 ? void 0 : primitiveElement.ccw_rotation;
|
|
11435
|
+
}
|
|
11304
11436
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", {
|
|
11305
11437
|
style: {
|
|
11306
11438
|
zIndex: zIndexMap.elementOverlay,
|
|
@@ -11387,7 +11519,7 @@ var MouseElementTracker = function(param) {
|
|
|
11387
11519
|
if (((_primitive__element = primitive._element) === null || _primitive__element === void 0 ? void 0 : _primitive__element.type) === "pcb_via") return "continue";
|
|
11388
11520
|
if (((_primitive__element1 = primitive._element) === null || _primitive__element1 === void 0 ? void 0 : _primitive__element1.type) === "pcb_component") return "continue";
|
|
11389
11521
|
if ((primitive === null || primitive === void 0 ? void 0 : primitive.layer) === "drill") return "continue";
|
|
11390
|
-
var screenPos = (0,
|
|
11522
|
+
var screenPos = (0, import_transformation_matrix5.applyToPoint)(transform, primitive);
|
|
11391
11523
|
var w = "w" in primitive ? primitive.w : "r" in primitive ? primitive.r * 2 : 0;
|
|
11392
11524
|
var h = "h" in primitive ? primitive.h : "r" in primitive ? primitive.r * 2 : 0;
|
|
11393
11525
|
var screenSize = {
|
|
@@ -11434,7 +11566,7 @@ var MouseElementTracker = function(param) {
|
|
|
11434
11566
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
11435
11567
|
var x = e.clientX - rect.left;
|
|
11436
11568
|
var y = e.clientY - rect.top;
|
|
11437
|
-
var rwPoint = (0,
|
|
11569
|
+
var rwPoint = (0, import_transformation_matrix5.applyToPoint)((0, import_transformation_matrix5.inverse)(transform), {
|
|
11438
11570
|
x: x,
|
|
11439
11571
|
y: y
|
|
11440
11572
|
});
|
|
@@ -11486,11 +11618,11 @@ var MouseElementTracker = function(param) {
|
|
|
11486
11618
|
};
|
|
11487
11619
|
// src/components/DimensionOverlay.tsx
|
|
11488
11620
|
var import_react11 = require("react");
|
|
11489
|
-
var
|
|
11621
|
+
var import_transformation_matrix6 = require("transformation-matrix");
|
|
11490
11622
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
11491
11623
|
var DimensionOverlay = function(param) {
|
|
11492
11624
|
var children = param.children, transform = param.transform;
|
|
11493
|
-
if (!transform) transform = (0,
|
|
11625
|
+
if (!transform) transform = (0, import_transformation_matrix6.identity)();
|
|
11494
11626
|
var _ref = _sliced_to_array((0, import_react11.useState)(false), 2), dimensionToolVisible = _ref[0], setDimensionToolVisible = _ref[1];
|
|
11495
11627
|
var _ref1 = _sliced_to_array((0, import_react11.useState)(false), 2), dimensionToolStretching = _ref1[0], setDimensionToolStretching = _ref1[1];
|
|
11496
11628
|
var _ref2 = _sliced_to_array((0, import_react11.useState)({
|
|
@@ -11558,8 +11690,8 @@ var DimensionOverlay = function(param) {
|
|
|
11558
11690
|
}, [
|
|
11559
11691
|
containerRef
|
|
11560
11692
|
]);
|
|
11561
|
-
var screenDStart = (0,
|
|
11562
|
-
var screenDEnd = (0,
|
|
11693
|
+
var screenDStart = (0, import_transformation_matrix6.applyToPoint)(transform, dStart);
|
|
11694
|
+
var screenDEnd = (0, import_transformation_matrix6.applyToPoint)(transform, dEnd);
|
|
11563
11695
|
var arrowScreenBounds = {
|
|
11564
11696
|
left: Math.min(screenDStart.x, screenDEnd.x),
|
|
11565
11697
|
right: Math.max(screenDStart.x, screenDEnd.x),
|
|
@@ -11592,7 +11724,7 @@ var DimensionOverlay = function(param) {
|
|
|
11592
11724
|
var rect = e.currentTarget.getBoundingClientRect();
|
|
11593
11725
|
var x = e.clientX - rect.left;
|
|
11594
11726
|
var y = e.clientY - rect.top;
|
|
11595
|
-
var rwPoint = (0,
|
|
11727
|
+
var rwPoint = (0, import_transformation_matrix6.applyToPoint)((0, import_transformation_matrix6.inverse)(transform), {
|
|
11596
11728
|
x: x,
|
|
11597
11729
|
y: y
|
|
11598
11730
|
});
|
|
@@ -11754,7 +11886,7 @@ var import_css = require("@emotion/css");
|
|
|
11754
11886
|
// package.json
|
|
11755
11887
|
var package_default = {
|
|
11756
11888
|
name: "@tscircuit/pcb-viewer",
|
|
11757
|
-
version: "1.10.
|
|
11889
|
+
version: "1.10.23",
|
|
11758
11890
|
main: "dist/index.js",
|
|
11759
11891
|
repository: "tscircuit/pcb-viewer",
|
|
11760
11892
|
license: "MIT",
|
|
@@ -11779,14 +11911,14 @@ var package_default = {
|
|
|
11779
11911
|
"@storybook/nextjs": "^8.0.6",
|
|
11780
11912
|
"@storybook/react": "^8.0.6",
|
|
11781
11913
|
"@swc/core": "^1.4.12",
|
|
11782
|
-
"@tscircuit/core": "
|
|
11914
|
+
"@tscircuit/core": "0.0.236",
|
|
11783
11915
|
"@tscircuit/eagle-xml-converter": "^0.0.6",
|
|
11784
11916
|
"@tscircuit/props": "^0.0.108",
|
|
11785
11917
|
"@tscircuit/soup-util": "^0.0.38",
|
|
11786
11918
|
"@types/color": "^3.0.6",
|
|
11787
11919
|
"@types/node": "18.7.23",
|
|
11788
11920
|
"@types/react": "^18.3.3",
|
|
11789
|
-
"circuit-json": "^0.0.
|
|
11921
|
+
"circuit-json": "^0.0.120",
|
|
11790
11922
|
next: "^14.1.4",
|
|
11791
11923
|
react: "^18.2.0",
|
|
11792
11924
|
"react-dom": "^18.2.0",
|
|
@@ -12117,7 +12249,7 @@ var ToolbarOverlay = function(param) {
|
|
|
12117
12249
|
// src/components/ErrorOverlay.tsx
|
|
12118
12250
|
var import_css2 = require("@emotion/css");
|
|
12119
12251
|
var import_react14 = require("react");
|
|
12120
|
-
var
|
|
12252
|
+
var import_transformation_matrix7 = require("transformation-matrix");
|
|
12121
12253
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
12122
12254
|
var ErrorSVG = function(param) {
|
|
12123
12255
|
var screenPort1 = param.screenPort1, screenPort2 = param.screenPort2, errorCenter = param.errorCenter, canLineBeDrawn = param.canLineBeDrawn;
|
|
@@ -12166,7 +12298,7 @@ var ErrorSVG = function(param) {
|
|
|
12166
12298
|
};
|
|
12167
12299
|
var ErrorOverlay = function(param) {
|
|
12168
12300
|
var children = param.children, transform = param.transform, elements = param.elements;
|
|
12169
|
-
if (!transform) transform = (0,
|
|
12301
|
+
if (!transform) transform = (0, import_transformation_matrix7.identity)();
|
|
12170
12302
|
var containerRef = (0, import_react14.useRef)(null);
|
|
12171
12303
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", {
|
|
12172
12304
|
style: {
|
|
@@ -12186,11 +12318,11 @@ var ErrorOverlay = function(param) {
|
|
|
12186
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]);
|
|
12187
12319
|
});
|
|
12188
12320
|
if (!port1 || !port2) return null;
|
|
12189
|
-
var screenPort1 = (0,
|
|
12321
|
+
var screenPort1 = (0, import_transformation_matrix7.applyToPoint)(transform, {
|
|
12190
12322
|
x: port1.x,
|
|
12191
12323
|
y: port1.y
|
|
12192
12324
|
});
|
|
12193
|
-
var screenPort2 = (0,
|
|
12325
|
+
var screenPort2 = (0, import_transformation_matrix7.applyToPoint)(transform, {
|
|
12194
12326
|
x: port2.x,
|
|
12195
12327
|
y: port2.y
|
|
12196
12328
|
});
|
|
@@ -12230,7 +12362,7 @@ var ErrorOverlay = function(param) {
|
|
|
12230
12362
|
};
|
|
12231
12363
|
// src/components/EditPlacementOverlay.tsx
|
|
12232
12364
|
var import_react15 = require("react");
|
|
12233
|
-
var
|
|
12365
|
+
var import_transformation_matrix8 = require("transformation-matrix");
|
|
12234
12366
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
12235
12367
|
var isInsideOf = function(pcb_component2, point2) {
|
|
12236
12368
|
var padding = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
@@ -12244,7 +12376,7 @@ var isInsideOf = function(pcb_component2, point2) {
|
|
|
12244
12376
|
};
|
|
12245
12377
|
var EditPlacementOverlay = function(param) {
|
|
12246
12378
|
var children = param.children, disabledProp = param.disabled, transform = param.transform, soup = param.soup, cancelPanDrag = param.cancelPanDrag, onCreateEditEvent = param.onCreateEditEvent, onModifyEditEvent = param.onModifyEditEvent;
|
|
12247
|
-
if (!transform) transform = (0,
|
|
12379
|
+
if (!transform) transform = (0, import_transformation_matrix8.identity)();
|
|
12248
12380
|
var containerRef = (0, import_react15.useRef)(null);
|
|
12249
12381
|
var _ref = _sliced_to_array((0, import_react15.useState)(null), 2), activePcbComponentId = _ref[0], setActivePcbComponent = _ref[1];
|
|
12250
12382
|
var _ref1 = _sliced_to_array((0, import_react15.useState)(null), 2), dragState = _ref1[0], setDragState = _ref1[1];
|
|
@@ -12271,7 +12403,7 @@ var EditPlacementOverlay = function(param) {
|
|
|
12271
12403
|
var x = e.clientX - rect.left;
|
|
12272
12404
|
var y = e.clientY - rect.top;
|
|
12273
12405
|
if (isNaN(x) || isNaN(y)) return;
|
|
12274
|
-
var rwMousePoint = (0,
|
|
12406
|
+
var rwMousePoint = (0, import_transformation_matrix8.applyToPoint)((0, import_transformation_matrix8.inverse)(transform), {
|
|
12275
12407
|
x: x,
|
|
12276
12408
|
y: y
|
|
12277
12409
|
});
|
|
@@ -12332,7 +12464,7 @@ var EditPlacementOverlay = function(param) {
|
|
|
12332
12464
|
var x = e.clientX - rect.left;
|
|
12333
12465
|
var y = e.clientY - rect.top;
|
|
12334
12466
|
if (isNaN(x) || isNaN(y)) return;
|
|
12335
|
-
var rwMousePoint = (0,
|
|
12467
|
+
var rwMousePoint = (0, import_transformation_matrix8.applyToPoint)((0, import_transformation_matrix8.inverse)(transform), {
|
|
12336
12468
|
x: x,
|
|
12337
12469
|
y: y
|
|
12338
12470
|
});
|
|
@@ -12365,7 +12497,7 @@ var EditPlacementOverlay = function(param) {
|
|
|
12365
12497
|
return e.type === "pcb_component";
|
|
12366
12498
|
}).map(function(e) {
|
|
12367
12499
|
if (!(e === null || e === void 0 ? void 0 : e.center)) return null;
|
|
12368
|
-
var projectedCenter = (0,
|
|
12500
|
+
var projectedCenter = (0, import_transformation_matrix8.applyToPoint)(transform, e.center);
|
|
12369
12501
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", {
|
|
12370
12502
|
style: {
|
|
12371
12503
|
position: "absolute",
|
|
@@ -12385,7 +12517,7 @@ var EditPlacementOverlay = function(param) {
|
|
|
12385
12517
|
};
|
|
12386
12518
|
// src/components/EditTraceHintOverlay.tsx
|
|
12387
12519
|
var import_react17 = require("react");
|
|
12388
|
-
var
|
|
12520
|
+
var import_transformation_matrix9 = require("transformation-matrix");
|
|
12389
12521
|
// src/components/HotkeyActionMenu.tsx
|
|
12390
12522
|
var import_css3 = require("@emotion/css");
|
|
12391
12523
|
var import_react16 = require("react");
|
|
@@ -12460,7 +12592,7 @@ var isInsideOfPlatedHole = function(hole, point2) {
|
|
|
12460
12592
|
var EditTraceHintOverlay = function(param) {
|
|
12461
12593
|
var children = param.children, disabledProp = param.disabled, transform = param.transform, soup = param.soup, cancelPanDrag = param.cancelPanDrag, onCreateEditEvent = param.onCreateEditEvent, onModifyEditEvent = param.onModifyEditEvent;
|
|
12462
12594
|
var _containerRef_current;
|
|
12463
|
-
if (!transform) transform = (0,
|
|
12595
|
+
if (!transform) transform = (0, import_transformation_matrix9.identity)();
|
|
12464
12596
|
var containerRef = (0, import_react17.useRef)(null);
|
|
12465
12597
|
var containerBounds = (_containerRef_current = containerRef.current) === null || _containerRef_current === void 0 ? void 0 : _containerRef_current.getBoundingClientRect();
|
|
12466
12598
|
var _ref = _sliced_to_array((0, import_react17.useState)(null), 2), selectedElement = _ref[0], setSelectedElement = _ref[1];
|
|
@@ -12474,8 +12606,8 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12474
12606
|
var disabled = disabledProp || !in_edit_trace_mode;
|
|
12475
12607
|
var ogCenterScreen, dragEndScreen;
|
|
12476
12608
|
if ((dragState === null || dragState === void 0 ? void 0 : dragState.originalCenter) && (dragState === null || dragState === void 0 ? void 0 : dragState.dragEnd)) {
|
|
12477
|
-
ogCenterScreen = (0,
|
|
12478
|
-
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);
|
|
12479
12611
|
}
|
|
12480
12612
|
(0, import_react17.useEffect)(function() {
|
|
12481
12613
|
var keyDown = function keyDown(e) {
|
|
@@ -12504,7 +12636,7 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12504
12636
|
var x = e.clientX - rect.left;
|
|
12505
12637
|
var y = e.clientY - rect.top;
|
|
12506
12638
|
if (isNaN(x) || isNaN(y)) return;
|
|
12507
|
-
var rwMousePoint = (0,
|
|
12639
|
+
var rwMousePoint = (0, import_transformation_matrix9.applyToPoint)((0, import_transformation_matrix9.inverse)(transform), {
|
|
12508
12640
|
x: x,
|
|
12509
12641
|
y: y
|
|
12510
12642
|
});
|
|
@@ -12569,7 +12701,7 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12569
12701
|
var x = e.clientX - rect.left;
|
|
12570
12702
|
var y = e.clientY - rect.top;
|
|
12571
12703
|
if (isNaN(x) || isNaN(y)) return;
|
|
12572
|
-
var rwMousePoint = (0,
|
|
12704
|
+
var rwMousePoint = (0, import_transformation_matrix9.applyToPoint)((0, import_transformation_matrix9.inverse)(transform), {
|
|
12573
12705
|
x: x,
|
|
12574
12706
|
y: y
|
|
12575
12707
|
});
|
|
@@ -12588,14 +12720,14 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12588
12720
|
var x = e.clientX - rect.left;
|
|
12589
12721
|
var y = e.clientY - rect.top;
|
|
12590
12722
|
if (isNaN(x) || isNaN(y)) return;
|
|
12591
|
-
var rwMousePoint = (0,
|
|
12723
|
+
var rwMousePoint = (0, import_transformation_matrix9.applyToPoint)((0, import_transformation_matrix9.inverse)(transform), {
|
|
12592
12724
|
x: x,
|
|
12593
12725
|
y: y
|
|
12594
12726
|
});
|
|
12595
12727
|
if (dragState) {
|
|
12596
12728
|
cancelPanDrag();
|
|
12597
12729
|
var _dragState_editEvent_route_slice_;
|
|
12598
|
-
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);
|
|
12599
12731
|
var distanceFromLastPoint = Math.sqrt(Math.pow(x - lastPointScreen.x, 2) + Math.pow(y - lastPointScreen.y, 2));
|
|
12600
12732
|
if (distanceFromLastPoint < 20) {
|
|
12601
12733
|
onCreateEditEvent(_object_spread_props(_object_spread({}, dragState.editEvent), {
|
|
@@ -12633,13 +12765,13 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12633
12765
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", {
|
|
12634
12766
|
stroke: "red",
|
|
12635
12767
|
d: "M ".concat(ogCenterScreen.x, " ").concat(ogCenterScreen.y, " ").concat(dragState === null || dragState === void 0 ? void 0 : dragState.editEvent.route.map(function(p) {
|
|
12636
|
-
return (0,
|
|
12768
|
+
return (0, import_transformation_matrix9.applyToPoint)(transform, p);
|
|
12637
12769
|
}).map(function(p) {
|
|
12638
12770
|
return "L ".concat(p.x, " ").concat(p.y);
|
|
12639
12771
|
}).join(" "), " L ").concat(dragEndScreen.x, " ").concat(dragEndScreen.y)
|
|
12640
12772
|
}),
|
|
12641
12773
|
dragState === null || dragState === void 0 ? void 0 : dragState.editEvent.route.map(function(r, i) {
|
|
12642
|
-
var rScreen = (0,
|
|
12774
|
+
var rScreen = (0, import_transformation_matrix9.applyToPoint)(transform, r);
|
|
12643
12775
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react17.Fragment, {
|
|
12644
12776
|
children: [
|
|
12645
12777
|
r.via && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("circle", {
|
|
@@ -12687,7 +12819,7 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12687
12819
|
}).map(function(e) {
|
|
12688
12820
|
var route = e.route;
|
|
12689
12821
|
var pcb_port2 = su_default(soup).pcb_port.get(e.pcb_port_id);
|
|
12690
|
-
var pcb_port_screen = (0,
|
|
12822
|
+
var pcb_port_screen = (0, import_transformation_matrix9.applyToPoint)(transform, pcb_port2);
|
|
12691
12823
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react17.Fragment, {
|
|
12692
12824
|
children: [
|
|
12693
12825
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("rect", {
|
|
@@ -12700,13 +12832,13 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12700
12832
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("path", {
|
|
12701
12833
|
stroke: "red",
|
|
12702
12834
|
d: "M ".concat(pcb_port_screen.x, " ").concat(pcb_port_screen.y, " ").concat(route.map(function(r) {
|
|
12703
|
-
return (0,
|
|
12835
|
+
return (0, import_transformation_matrix9.applyToPoint)(transform, r);
|
|
12704
12836
|
}).map(function(r) {
|
|
12705
12837
|
return "L ".concat(r.x, " ").concat(r.y);
|
|
12706
12838
|
}).join(" "))
|
|
12707
12839
|
}, "path-".concat(e.pcb_port_id)),
|
|
12708
12840
|
route.map(function(r) {
|
|
12709
|
-
return _object_spread({}, r, (0,
|
|
12841
|
+
return _object_spread({}, r, (0, import_transformation_matrix9.applyToPoint)(transform, r));
|
|
12710
12842
|
}).map(function(r, i) {
|
|
12711
12843
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react17.Fragment, {
|
|
12712
12844
|
children: [
|
|
@@ -12752,7 +12884,7 @@ var EditTraceHintOverlay = function(param) {
|
|
|
12752
12884
|
});
|
|
12753
12885
|
};
|
|
12754
12886
|
// src/components/RatsNestOverlay.tsx
|
|
12755
|
-
var
|
|
12887
|
+
var import_transformation_matrix10 = require("transformation-matrix");
|
|
12756
12888
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
12757
12889
|
var RatsNestOverlay = function(param) {
|
|
12758
12890
|
var transform = param.transform, soup = param.soup, children = param.children;
|
|
@@ -12760,7 +12892,7 @@ var RatsNestOverlay = function(param) {
|
|
|
12760
12892
|
return s.is_showing_rats_nest;
|
|
12761
12893
|
});
|
|
12762
12894
|
if (!soup || !isShowingRatsNest) return children;
|
|
12763
|
-
if (!transform) transform = (0,
|
|
12895
|
+
if (!transform) transform = (0, import_transformation_matrix10.identity)();
|
|
12764
12896
|
var sourceTraces = su_default(soup).source_trace.list();
|
|
12765
12897
|
var groups = [];
|
|
12766
12898
|
sourceTraces.forEach(function(sourceTrace) {
|
|
@@ -12794,7 +12926,7 @@ var RatsNestOverlay = function(param) {
|
|
|
12794
12926
|
},
|
|
12795
12927
|
children: groups.map(function(group, index) {
|
|
12796
12928
|
var points = group.map(function(port) {
|
|
12797
|
-
return (0,
|
|
12929
|
+
return (0, import_transformation_matrix10.applyToPoint)(transform, {
|
|
12798
12930
|
x: port.x,
|
|
12799
12931
|
y: port.y
|
|
12800
12932
|
});
|
|
@@ -12962,7 +13094,7 @@ var CanvasElementsRenderer = function(props) {
|
|
|
12962
13094
|
};
|
|
12963
13095
|
// src/PCBViewer.tsx
|
|
12964
13096
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
12965
|
-
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));
|
|
12966
13098
|
var PCBViewer = function(param) {
|
|
12967
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;
|
|
12968
13100
|
soup !== null && soup !== void 0 ? soup : soup = circuitJson;
|
|
@@ -12997,7 +13129,7 @@ var PCBViewer = function(param) {
|
|
|
12997
13129
|
var _elmBounds_width, _elmBounds_height;
|
|
12998
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;
|
|
12999
13131
|
var _elmBounds_width1, _elmBounds_height1;
|
|
13000
|
-
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)));
|
|
13001
13133
|
};
|
|
13002
13134
|
(0, import_react20.useEffect)(function() {
|
|
13003
13135
|
if (refDimensions && refDimensions.width !== 0 && (children || soup)) {
|