@tscircuit/pcb-viewer 1.11.214 → 1.11.216
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 +189 -34
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5285,10 +5285,12 @@ __export(dist_exports, {
|
|
|
5285
5285
|
any_soup_element: () => any_soup_element,
|
|
5286
5286
|
any_source_component: () => any_source_component,
|
|
5287
5287
|
battery_capacity: () => battery_capacity,
|
|
5288
|
+
brep_shape: () => brep_shape,
|
|
5288
5289
|
cad_component: () => cad_component,
|
|
5289
5290
|
capacitance: () => capacitance,
|
|
5290
5291
|
current: () => current,
|
|
5291
5292
|
distance: () => distance,
|
|
5293
|
+
external_footprint_load_error: () => external_footprint_load_error,
|
|
5292
5294
|
frequency: () => frequency,
|
|
5293
5295
|
getZodPrefixedIdWithDefault: () => getZodPrefixedIdWithDefault,
|
|
5294
5296
|
inductance: () => inductance,
|
|
@@ -5300,8 +5302,9 @@ __export(dist_exports, {
|
|
|
5300
5302
|
pcb_board: () => pcb_board,
|
|
5301
5303
|
pcb_breakout_point: () => pcb_breakout_point,
|
|
5302
5304
|
pcb_component: () => pcb_component,
|
|
5305
|
+
pcb_component_outside_board_error: () => pcb_component_outside_board_error,
|
|
5303
5306
|
pcb_copper_pour: () => pcb_copper_pour,
|
|
5304
|
-
|
|
5307
|
+
pcb_copper_pour_brep: () => pcb_copper_pour_brep,
|
|
5305
5308
|
pcb_copper_pour_polygon: () => pcb_copper_pour_polygon,
|
|
5306
5309
|
pcb_copper_pour_rect: () => pcb_copper_pour_rect,
|
|
5307
5310
|
pcb_cutout: () => pcb_cutout,
|
|
@@ -5348,10 +5351,12 @@ __export(dist_exports, {
|
|
|
5348
5351
|
pcb_via: () => pcb_via,
|
|
5349
5352
|
point: () => point,
|
|
5350
5353
|
point3: () => point3,
|
|
5354
|
+
point_with_bulge: () => point_with_bulge,
|
|
5351
5355
|
port_arrangement: () => port_arrangement,
|
|
5352
5356
|
position: () => position,
|
|
5353
5357
|
position3: () => position3,
|
|
5354
5358
|
resistance: () => resistance,
|
|
5359
|
+
ring: () => ring,
|
|
5355
5360
|
rotation: () => rotation,
|
|
5356
5361
|
route_hint_point: () => route_hint_point,
|
|
5357
5362
|
schematic_box: () => schematic_box,
|
|
@@ -9743,10 +9748,10 @@ var size = z.object({
|
|
|
9743
9748
|
height: z.number()
|
|
9744
9749
|
});
|
|
9745
9750
|
expectTypesMatch(true);
|
|
9746
|
-
var randomId = (
|
|
9751
|
+
var randomId = (length3) => {
|
|
9747
9752
|
const chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
9748
9753
|
return Array.from(
|
|
9749
|
-
{ length:
|
|
9754
|
+
{ length: length3 },
|
|
9750
9755
|
() => chars[Math.floor(Math.random() * chars.length)]
|
|
9751
9756
|
).join("");
|
|
9752
9757
|
};
|
|
@@ -10094,9 +10099,6 @@ var source_manually_placed_via = z.object({
|
|
|
10094
10099
|
source_manually_placed_via_id: z.string(),
|
|
10095
10100
|
source_group_id: z.string(),
|
|
10096
10101
|
source_net_id: z.string(),
|
|
10097
|
-
x: distance,
|
|
10098
|
-
y: distance,
|
|
10099
|
-
layers: z.array(layer_ref),
|
|
10100
10102
|
subcircuit_id: z.string().optional(),
|
|
10101
10103
|
source_trace_id: z.string().optional()
|
|
10102
10104
|
}).describe("Defines a via that is manually placed in the source domain");
|
|
@@ -10394,6 +10396,21 @@ var schematic_table_cell = z.object({
|
|
|
10394
10396
|
subcircuit_id: z.string().optional()
|
|
10395
10397
|
}).describe("Defines a cell within a schematic_table");
|
|
10396
10398
|
expectTypesMatch(true);
|
|
10399
|
+
var point_with_bulge = z.object({
|
|
10400
|
+
x: distance,
|
|
10401
|
+
y: distance,
|
|
10402
|
+
bulge: z.number().optional()
|
|
10403
|
+
});
|
|
10404
|
+
expectTypesMatch(true);
|
|
10405
|
+
var ring = z.object({
|
|
10406
|
+
vertices: z.array(point_with_bulge)
|
|
10407
|
+
});
|
|
10408
|
+
expectTypesMatch(true);
|
|
10409
|
+
var brep_shape = z.object({
|
|
10410
|
+
outer_ring: ring,
|
|
10411
|
+
inner_rings: z.array(ring).default([])
|
|
10412
|
+
});
|
|
10413
|
+
expectTypesMatch(true);
|
|
10397
10414
|
var pcb_route_hint = z.object({
|
|
10398
10415
|
x: distance,
|
|
10399
10416
|
y: distance,
|
|
@@ -10496,6 +10513,9 @@ var pcb_circular_hole_with_rect_pad = z.object({
|
|
|
10496
10513
|
hole_diameter: z.number(),
|
|
10497
10514
|
rect_pad_width: z.number(),
|
|
10498
10515
|
rect_pad_height: z.number(),
|
|
10516
|
+
rect_border_radius: z.number().optional(),
|
|
10517
|
+
hole_offset_x: distance.default(0),
|
|
10518
|
+
hole_offset_y: distance.default(0),
|
|
10499
10519
|
x: distance,
|
|
10500
10520
|
y: distance,
|
|
10501
10521
|
layers: z.array(layer_ref),
|
|
@@ -10515,6 +10535,7 @@ var pcb_pill_hole_with_rect_pad = z.object({
|
|
|
10515
10535
|
hole_height: z.number(),
|
|
10516
10536
|
rect_pad_width: z.number(),
|
|
10517
10537
|
rect_pad_height: z.number(),
|
|
10538
|
+
rect_border_radius: z.number().optional(),
|
|
10518
10539
|
x: distance,
|
|
10519
10540
|
y: distance,
|
|
10520
10541
|
layers: z.array(layer_ref),
|
|
@@ -10535,6 +10556,7 @@ var pcb_rotated_pill_hole_with_rect_pad = z.object({
|
|
|
10535
10556
|
hole_ccw_rotation: rotation,
|
|
10536
10557
|
rect_pad_width: z.number(),
|
|
10537
10558
|
rect_pad_height: z.number(),
|
|
10559
|
+
rect_border_radius: z.number().optional(),
|
|
10538
10560
|
rect_ccw_rotation: rotation,
|
|
10539
10561
|
x: distance,
|
|
10540
10562
|
y: distance,
|
|
@@ -10594,6 +10616,7 @@ var pcb_smtpad_rect = z.object({
|
|
|
10594
10616
|
y: distance,
|
|
10595
10617
|
width: z.number(),
|
|
10596
10618
|
height: z.number(),
|
|
10619
|
+
rect_border_radius: z.number().optional(),
|
|
10597
10620
|
layer: layer_ref,
|
|
10598
10621
|
port_hints: z.array(z.string()).optional(),
|
|
10599
10622
|
pcb_component_id: z.string().optional(),
|
|
@@ -10609,6 +10632,7 @@ var pcb_smtpad_rotated_rect = z.object({
|
|
|
10609
10632
|
y: distance,
|
|
10610
10633
|
width: z.number(),
|
|
10611
10634
|
height: z.number(),
|
|
10635
|
+
rect_border_radius: z.number().optional(),
|
|
10612
10636
|
ccw_rotation: rotation,
|
|
10613
10637
|
layer: layer_ref,
|
|
10614
10638
|
port_hints: z.array(z.string()).optional(),
|
|
@@ -10945,6 +10969,18 @@ var pcb_silkscreen_text = z.object({
|
|
|
10945
10969
|
font_size: distance.default("0.2mm"),
|
|
10946
10970
|
pcb_component_id: z.string(),
|
|
10947
10971
|
text: z.string(),
|
|
10972
|
+
is_knockout: z.boolean().default(false).optional(),
|
|
10973
|
+
knockout_padding: z.object({
|
|
10974
|
+
left: length,
|
|
10975
|
+
top: length,
|
|
10976
|
+
bottom: length,
|
|
10977
|
+
right: length
|
|
10978
|
+
}).default({
|
|
10979
|
+
left: "0.2mm",
|
|
10980
|
+
top: "0.2mm",
|
|
10981
|
+
bottom: "0.2mm",
|
|
10982
|
+
right: "0.2mm"
|
|
10983
|
+
}).optional(),
|
|
10948
10984
|
ccw_rotation: z.number().optional(),
|
|
10949
10985
|
layer: layer_ref,
|
|
10950
10986
|
is_mirrored: z.boolean().default(false).optional(),
|
|
@@ -11115,6 +11151,20 @@ var pcb_missing_footprint_error = z.object({
|
|
|
11115
11151
|
expectTypesMatch(
|
|
11116
11152
|
true
|
|
11117
11153
|
);
|
|
11154
|
+
var external_footprint_load_error = z.object({
|
|
11155
|
+
type: z.literal("external_footprint_load_error"),
|
|
11156
|
+
external_footprint_load_error_id: getZodPrefixedIdWithDefault(
|
|
11157
|
+
"external_footprint_load_error"
|
|
11158
|
+
),
|
|
11159
|
+
pcb_component_id: z.string(),
|
|
11160
|
+
source_component_id: z.string(),
|
|
11161
|
+
pcb_group_id: z.string().optional(),
|
|
11162
|
+
subcircuit_id: z.string().optional(),
|
|
11163
|
+
footprinter_string: z.string().optional(),
|
|
11164
|
+
error_type: z.literal("external_footprint_load_error").default("external_footprint_load_error"),
|
|
11165
|
+
message: z.string()
|
|
11166
|
+
}).describe("Defines an error when an external footprint fails to load");
|
|
11167
|
+
expectTypesMatch(true);
|
|
11118
11168
|
var pcb_group = z.object({
|
|
11119
11169
|
type: z.literal("pcb_group"),
|
|
11120
11170
|
pcb_group_id: getZodPrefixedIdWithDefault("pcb_group"),
|
|
@@ -11221,10 +11271,9 @@ var pcb_copper_pour_rect = pcb_copper_pour_base.extend({
|
|
|
11221
11271
|
rotation: rotation.optional()
|
|
11222
11272
|
});
|
|
11223
11273
|
expectTypesMatch(true);
|
|
11224
|
-
var
|
|
11225
|
-
shape: z.literal("
|
|
11226
|
-
|
|
11227
|
-
radius: length
|
|
11274
|
+
var pcb_copper_pour_brep = pcb_copper_pour_base.extend({
|
|
11275
|
+
shape: z.literal("brep"),
|
|
11276
|
+
brep_shape
|
|
11228
11277
|
});
|
|
11229
11278
|
expectTypesMatch(true);
|
|
11230
11279
|
var pcb_copper_pour_polygon = pcb_copper_pour_base.extend({
|
|
@@ -11234,10 +11283,32 @@ var pcb_copper_pour_polygon = pcb_copper_pour_base.extend({
|
|
|
11234
11283
|
expectTypesMatch(true);
|
|
11235
11284
|
var pcb_copper_pour = z.discriminatedUnion("shape", [
|
|
11236
11285
|
pcb_copper_pour_rect,
|
|
11237
|
-
|
|
11286
|
+
pcb_copper_pour_brep,
|
|
11238
11287
|
pcb_copper_pour_polygon
|
|
11239
11288
|
]).describe("Defines a copper pour on the PCB.");
|
|
11240
11289
|
expectTypesMatch(true);
|
|
11290
|
+
var pcb_component_outside_board_error = z.object({
|
|
11291
|
+
type: z.literal("pcb_component_outside_board_error"),
|
|
11292
|
+
pcb_component_outside_board_error_id: getZodPrefixedIdWithDefault(
|
|
11293
|
+
"pcb_component_outside_board_error"
|
|
11294
|
+
),
|
|
11295
|
+
error_type: z.literal("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),
|
|
11296
|
+
message: z.string(),
|
|
11297
|
+
pcb_component_id: z.string(),
|
|
11298
|
+
pcb_board_id: z.string(),
|
|
11299
|
+
component_center: point,
|
|
11300
|
+
component_bounds: z.object({
|
|
11301
|
+
min_x: z.number(),
|
|
11302
|
+
max_x: z.number(),
|
|
11303
|
+
min_y: z.number(),
|
|
11304
|
+
max_y: z.number()
|
|
11305
|
+
}),
|
|
11306
|
+
subcircuit_id: z.string().optional(),
|
|
11307
|
+
source_component_id: z.string().optional()
|
|
11308
|
+
}).describe(
|
|
11309
|
+
"Error emitted when a PCB component is placed outside the board boundaries"
|
|
11310
|
+
);
|
|
11311
|
+
expectTypesMatch(true);
|
|
11241
11312
|
var cad_component = z.object({
|
|
11242
11313
|
type: z.literal("cad_component"),
|
|
11243
11314
|
cad_component_id: z.string(),
|
|
@@ -11253,6 +11324,11 @@ var cad_component = z.object({
|
|
|
11253
11324
|
model_obj_url: z.string().optional(),
|
|
11254
11325
|
model_stl_url: z.string().optional(),
|
|
11255
11326
|
model_3mf_url: z.string().optional(),
|
|
11327
|
+
model_gltf_url: z.string().optional(),
|
|
11328
|
+
model_glb_url: z.string().optional(),
|
|
11329
|
+
model_step_url: z.string().optional(),
|
|
11330
|
+
model_wrl_url: z.string().optional(),
|
|
11331
|
+
model_unit_to_mm_scale_factor: z.number().optional(),
|
|
11256
11332
|
model_jscad: z.any().optional()
|
|
11257
11333
|
}).describe("Defines a component on the PCB");
|
|
11258
11334
|
expectTypesMatch(true);
|
|
@@ -11332,6 +11408,7 @@ var any_circuit_element = z.union([
|
|
|
11332
11408
|
pcb_component,
|
|
11333
11409
|
pcb_hole,
|
|
11334
11410
|
pcb_missing_footprint_error,
|
|
11411
|
+
external_footprint_load_error,
|
|
11335
11412
|
pcb_manual_edit_conflict_warning,
|
|
11336
11413
|
pcb_plated_hole,
|
|
11337
11414
|
pcb_keepout,
|
|
@@ -11365,6 +11442,7 @@ var any_circuit_element = z.union([
|
|
|
11365
11442
|
pcb_ground_plane_region,
|
|
11366
11443
|
pcb_thermal_spoke,
|
|
11367
11444
|
pcb_copper_pour,
|
|
11445
|
+
pcb_component_outside_board_error,
|
|
11368
11446
|
schematic_box,
|
|
11369
11447
|
schematic_text,
|
|
11370
11448
|
schematic_line,
|
|
@@ -12587,7 +12665,7 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12587
12665
|
}
|
|
12588
12666
|
case "pcb_smtpad": {
|
|
12589
12667
|
if (element.shape === "rect" || element.shape === "rotated_rect") {
|
|
12590
|
-
const { shape, x, y, width, height, layer } = element;
|
|
12668
|
+
const { shape, x, y, width, height, layer, rect_border_radius } = element;
|
|
12591
12669
|
return [
|
|
12592
12670
|
{
|
|
12593
12671
|
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
@@ -12601,7 +12679,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12601
12679
|
_parent_pcb_component,
|
|
12602
12680
|
_parent_source_component,
|
|
12603
12681
|
_source_port,
|
|
12604
|
-
ccw_rotation: element.ccw_rotation
|
|
12682
|
+
ccw_rotation: element.ccw_rotation,
|
|
12683
|
+
roundness: rect_border_radius
|
|
12605
12684
|
}
|
|
12606
12685
|
];
|
|
12607
12686
|
} else if (element.shape === "circle") {
|
|
@@ -12620,6 +12699,20 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12620
12699
|
_source_port
|
|
12621
12700
|
}
|
|
12622
12701
|
];
|
|
12702
|
+
} else if (element.shape === "polygon") {
|
|
12703
|
+
const { layer, points } = element;
|
|
12704
|
+
return [
|
|
12705
|
+
{
|
|
12706
|
+
_pcb_drawing_object_id: `polygon_${globalPcbDrawingObjectCount++}`,
|
|
12707
|
+
pcb_drawing_type: "polygon",
|
|
12708
|
+
points,
|
|
12709
|
+
layer: layer || "top",
|
|
12710
|
+
_element: element,
|
|
12711
|
+
_parent_pcb_component,
|
|
12712
|
+
_parent_source_component,
|
|
12713
|
+
_source_port
|
|
12714
|
+
}
|
|
12715
|
+
];
|
|
12623
12716
|
}
|
|
12624
12717
|
return [];
|
|
12625
12718
|
}
|
|
@@ -12729,7 +12822,14 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12729
12822
|
}
|
|
12730
12823
|
];
|
|
12731
12824
|
} else if (element.shape === "circular_hole_with_rect_pad") {
|
|
12732
|
-
const {
|
|
12825
|
+
const {
|
|
12826
|
+
x,
|
|
12827
|
+
y,
|
|
12828
|
+
hole_diameter,
|
|
12829
|
+
rect_pad_width,
|
|
12830
|
+
rect_pad_height,
|
|
12831
|
+
rect_border_radius
|
|
12832
|
+
} = element;
|
|
12733
12833
|
const hole_offset_x = element.hole_offset_x ?? 0;
|
|
12734
12834
|
const hole_offset_y = element.hole_offset_y ?? 0;
|
|
12735
12835
|
return [
|
|
@@ -12745,7 +12845,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12745
12845
|
_element: element,
|
|
12746
12846
|
_parent_pcb_component,
|
|
12747
12847
|
_parent_source_component,
|
|
12748
|
-
_source_port
|
|
12848
|
+
_source_port,
|
|
12849
|
+
roundness: rect_border_radius
|
|
12749
12850
|
},
|
|
12750
12851
|
{
|
|
12751
12852
|
_pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
|
|
@@ -12765,7 +12866,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12765
12866
|
hole_width,
|
|
12766
12867
|
hole_height,
|
|
12767
12868
|
rect_pad_width,
|
|
12768
|
-
rect_pad_height
|
|
12869
|
+
rect_pad_height,
|
|
12870
|
+
rect_border_radius
|
|
12769
12871
|
} = element;
|
|
12770
12872
|
return [
|
|
12771
12873
|
{
|
|
@@ -12780,7 +12882,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12780
12882
|
_element: element,
|
|
12781
12883
|
_parent_pcb_component,
|
|
12782
12884
|
_parent_source_component,
|
|
12783
|
-
_source_port
|
|
12885
|
+
_source_port,
|
|
12886
|
+
roundness: rect_border_radius
|
|
12784
12887
|
},
|
|
12785
12888
|
{
|
|
12786
12889
|
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
@@ -12803,7 +12906,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12803
12906
|
hole_ccw_rotation,
|
|
12804
12907
|
rect_pad_width,
|
|
12805
12908
|
rect_pad_height,
|
|
12806
|
-
rect_ccw_rotation
|
|
12909
|
+
rect_ccw_rotation,
|
|
12910
|
+
rect_border_radius
|
|
12807
12911
|
} = element;
|
|
12808
12912
|
return [
|
|
12809
12913
|
{
|
|
@@ -12819,7 +12923,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12819
12923
|
_parent_pcb_component,
|
|
12820
12924
|
_parent_source_component,
|
|
12821
12925
|
_source_port,
|
|
12822
|
-
ccw_rotation: rect_ccw_rotation
|
|
12926
|
+
ccw_rotation: rect_ccw_rotation,
|
|
12927
|
+
roundness: rect_border_radius
|
|
12823
12928
|
},
|
|
12824
12929
|
{
|
|
12825
12930
|
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
@@ -13585,24 +13690,42 @@ var Drawer = class {
|
|
|
13585
13690
|
is_filled = true,
|
|
13586
13691
|
has_stroke,
|
|
13587
13692
|
is_stroke_dashed,
|
|
13588
|
-
stroke_width
|
|
13693
|
+
stroke_width,
|
|
13694
|
+
roundness
|
|
13589
13695
|
}) {
|
|
13590
13696
|
const [x1$, y1$] = applyToPoint3(this.transform, [x - w / 2, y - h / 2]);
|
|
13591
13697
|
const [x2$, y2$] = applyToPoint3(this.transform, [x + w / 2, y + h / 2]);
|
|
13592
13698
|
this.applyAperture();
|
|
13593
13699
|
const ctx = this.getLayerCtx();
|
|
13700
|
+
const radius$ = roundness ? scaleOnly(this.transform, roundness) : 0;
|
|
13594
13701
|
const shouldDrawStroke = has_stroke === void 0 ? is_filled === false : has_stroke;
|
|
13595
13702
|
if (mesh_fill) {
|
|
13596
13703
|
ctx.save();
|
|
13597
13704
|
ctx.beginPath();
|
|
13598
|
-
|
|
13705
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13706
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13707
|
+
} else {
|
|
13708
|
+
ctx.rect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13709
|
+
}
|
|
13599
13710
|
ctx.clip();
|
|
13600
13711
|
this.drawMeshPattern(x - w / 2, y - h / 2, w, h, 0.15);
|
|
13601
13712
|
ctx.restore();
|
|
13602
|
-
|
|
13713
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13714
|
+
ctx.beginPath();
|
|
13715
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13716
|
+
ctx.stroke();
|
|
13717
|
+
} else {
|
|
13718
|
+
ctx.strokeRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13719
|
+
}
|
|
13603
13720
|
} else {
|
|
13604
13721
|
if (is_filled !== false) {
|
|
13605
|
-
|
|
13722
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13723
|
+
ctx.beginPath();
|
|
13724
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13725
|
+
ctx.fill();
|
|
13726
|
+
} else {
|
|
13727
|
+
ctx.fillRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13728
|
+
}
|
|
13606
13729
|
}
|
|
13607
13730
|
if (shouldDrawStroke) {
|
|
13608
13731
|
const originalLineWidth = ctx.lineWidth;
|
|
@@ -13622,7 +13745,13 @@ var Drawer = class {
|
|
|
13622
13745
|
}
|
|
13623
13746
|
ctx.setLineDash(dashPattern);
|
|
13624
13747
|
}
|
|
13625
|
-
|
|
13748
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13749
|
+
ctx.beginPath();
|
|
13750
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13751
|
+
ctx.stroke();
|
|
13752
|
+
} else {
|
|
13753
|
+
ctx.strokeRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13754
|
+
}
|
|
13626
13755
|
if (is_stroke_dashed) {
|
|
13627
13756
|
ctx.setLineDash([]);
|
|
13628
13757
|
}
|
|
@@ -13632,11 +13761,12 @@ var Drawer = class {
|
|
|
13632
13761
|
}
|
|
13633
13762
|
}
|
|
13634
13763
|
}
|
|
13635
|
-
rotatedRect(x, y, w, h, ccw_rotation, mesh_fill) {
|
|
13764
|
+
rotatedRect(x, y, w, h, ccw_rotation, roundness, mesh_fill) {
|
|
13636
13765
|
const ctx = this.getLayerCtx();
|
|
13637
13766
|
this.applyAperture();
|
|
13638
13767
|
const [x1$, y1$] = applyToPoint3(this.transform, [x - w / 2, y - h / 2]);
|
|
13639
13768
|
const [x2$, y2$] = applyToPoint3(this.transform, [x + w / 2, y + h / 2]);
|
|
13769
|
+
const radius$ = roundness ? scaleOnly(this.transform, roundness) : 0;
|
|
13640
13770
|
ctx.save();
|
|
13641
13771
|
const [centerX, centerY] = applyToPoint3(this.transform, [x, y]);
|
|
13642
13772
|
ctx.translate(centerX, centerY);
|
|
@@ -13645,12 +13775,28 @@ var Drawer = class {
|
|
|
13645
13775
|
ctx.translate(-centerX, -centerY);
|
|
13646
13776
|
if (mesh_fill) {
|
|
13647
13777
|
ctx.beginPath();
|
|
13648
|
-
|
|
13778
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13779
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13780
|
+
} else {
|
|
13781
|
+
ctx.rect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13782
|
+
}
|
|
13649
13783
|
ctx.clip();
|
|
13650
13784
|
this.drawMeshPattern(x - w / 2, y - h / 2, w, h, 0.15);
|
|
13651
|
-
|
|
13785
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13786
|
+
ctx.beginPath();
|
|
13787
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13788
|
+
ctx.stroke();
|
|
13789
|
+
} else {
|
|
13790
|
+
ctx.strokeRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13791
|
+
}
|
|
13652
13792
|
} else {
|
|
13653
|
-
|
|
13793
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13794
|
+
ctx.beginPath();
|
|
13795
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13796
|
+
ctx.fill();
|
|
13797
|
+
} else {
|
|
13798
|
+
ctx.fillRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13799
|
+
}
|
|
13654
13800
|
}
|
|
13655
13801
|
ctx.restore();
|
|
13656
13802
|
}
|
|
@@ -14102,7 +14248,8 @@ var drawRect = (drawer, rect) => {
|
|
|
14102
14248
|
is_filled: rect.is_filled,
|
|
14103
14249
|
has_stroke: rect.has_stroke,
|
|
14104
14250
|
is_stroke_dashed: rect.is_stroke_dashed,
|
|
14105
|
-
stroke_width: rect.stroke_width
|
|
14251
|
+
stroke_width: rect.stroke_width,
|
|
14252
|
+
roundness: rect.roundness
|
|
14106
14253
|
});
|
|
14107
14254
|
};
|
|
14108
14255
|
var drawRotatedRect = (drawer, rect) => {
|
|
@@ -14110,7 +14257,15 @@ var drawRotatedRect = (drawer, rect) => {
|
|
|
14110
14257
|
color: getColor(rect),
|
|
14111
14258
|
layer: rect.layer
|
|
14112
14259
|
});
|
|
14113
|
-
drawer.rotatedRect(
|
|
14260
|
+
drawer.rotatedRect(
|
|
14261
|
+
rect.x,
|
|
14262
|
+
rect.y,
|
|
14263
|
+
rect.w,
|
|
14264
|
+
rect.h,
|
|
14265
|
+
rect.ccw_rotation,
|
|
14266
|
+
rect.roundness,
|
|
14267
|
+
rect.mesh_fill
|
|
14268
|
+
);
|
|
14114
14269
|
};
|
|
14115
14270
|
var drawRotatedPill = (drawer, pill) => {
|
|
14116
14271
|
drawer.equip({
|
|
@@ -16337,7 +16492,7 @@ function ifSetsMatchExactly(set1, set2) {
|
|
|
16337
16492
|
return Array.from(set1).every((item) => set2.has(item));
|
|
16338
16493
|
}
|
|
16339
16494
|
|
|
16340
|
-
// node_modules/@tscircuit/math-utils/dist/chunk-
|
|
16495
|
+
// node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
|
|
16341
16496
|
function pointToSegmentDistance2(p, v, w) {
|
|
16342
16497
|
const l2 = (w.x - v.x) ** 2 + (w.y - v.y) ** 2;
|
|
16343
16498
|
if (l2 === 0) return distance3(p, v);
|
|
@@ -16792,7 +16947,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
16792
16947
|
// package.json
|
|
16793
16948
|
var package_default = {
|
|
16794
16949
|
name: "@tscircuit/pcb-viewer",
|
|
16795
|
-
version: "1.11.
|
|
16950
|
+
version: "1.11.215",
|
|
16796
16951
|
main: "dist/index.js",
|
|
16797
16952
|
type: "module",
|
|
16798
16953
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -16828,7 +16983,7 @@ var package_default = {
|
|
|
16828
16983
|
"react-cosmos-plugin-vite": "7.0.0-beta.0",
|
|
16829
16984
|
"react-dom": "19.1.0",
|
|
16830
16985
|
"react-use": "^17.4.0",
|
|
16831
|
-
tscircuit: "^0.0.
|
|
16986
|
+
tscircuit: "^0.0.642",
|
|
16832
16987
|
tsup: "^8.0.2",
|
|
16833
16988
|
"type-fest": "^3.0.0",
|
|
16834
16989
|
typescript: "^5.4.4",
|
|
@@ -16843,7 +16998,7 @@ var package_default = {
|
|
|
16843
16998
|
dependencies: {
|
|
16844
16999
|
"@emotion/css": "^11.11.2",
|
|
16845
17000
|
"@vitejs/plugin-react": "^5.0.2",
|
|
16846
|
-
"circuit-to-svg": "^0.0.
|
|
17001
|
+
"circuit-to-svg": "^0.0.191",
|
|
16847
17002
|
color: "^4.2.3",
|
|
16848
17003
|
"react-supergrid": "^1.0.10",
|
|
16849
17004
|
"react-toastify": "^10.0.5",
|