@tscircuit/pcb-viewer 1.11.213 → 1.11.215
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 +183 -35
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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") {
|
|
@@ -12729,7 +12808,14 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12729
12808
|
}
|
|
12730
12809
|
];
|
|
12731
12810
|
} else if (element.shape === "circular_hole_with_rect_pad") {
|
|
12732
|
-
const {
|
|
12811
|
+
const {
|
|
12812
|
+
x,
|
|
12813
|
+
y,
|
|
12814
|
+
hole_diameter,
|
|
12815
|
+
rect_pad_width,
|
|
12816
|
+
rect_pad_height,
|
|
12817
|
+
rect_border_radius
|
|
12818
|
+
} = element;
|
|
12733
12819
|
const hole_offset_x = element.hole_offset_x ?? 0;
|
|
12734
12820
|
const hole_offset_y = element.hole_offset_y ?? 0;
|
|
12735
12821
|
return [
|
|
@@ -12745,7 +12831,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12745
12831
|
_element: element,
|
|
12746
12832
|
_parent_pcb_component,
|
|
12747
12833
|
_parent_source_component,
|
|
12748
|
-
_source_port
|
|
12834
|
+
_source_port,
|
|
12835
|
+
roundness: rect_border_radius
|
|
12749
12836
|
},
|
|
12750
12837
|
{
|
|
12751
12838
|
_pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
|
|
@@ -12765,7 +12852,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12765
12852
|
hole_width,
|
|
12766
12853
|
hole_height,
|
|
12767
12854
|
rect_pad_width,
|
|
12768
|
-
rect_pad_height
|
|
12855
|
+
rect_pad_height,
|
|
12856
|
+
rect_border_radius
|
|
12769
12857
|
} = element;
|
|
12770
12858
|
return [
|
|
12771
12859
|
{
|
|
@@ -12780,7 +12868,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12780
12868
|
_element: element,
|
|
12781
12869
|
_parent_pcb_component,
|
|
12782
12870
|
_parent_source_component,
|
|
12783
|
-
_source_port
|
|
12871
|
+
_source_port,
|
|
12872
|
+
roundness: rect_border_radius
|
|
12784
12873
|
},
|
|
12785
12874
|
{
|
|
12786
12875
|
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
@@ -12803,7 +12892,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12803
12892
|
hole_ccw_rotation,
|
|
12804
12893
|
rect_pad_width,
|
|
12805
12894
|
rect_pad_height,
|
|
12806
|
-
rect_ccw_rotation
|
|
12895
|
+
rect_ccw_rotation,
|
|
12896
|
+
rect_border_radius
|
|
12807
12897
|
} = element;
|
|
12808
12898
|
return [
|
|
12809
12899
|
{
|
|
@@ -12819,7 +12909,8 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
12819
12909
|
_parent_pcb_component,
|
|
12820
12910
|
_parent_source_component,
|
|
12821
12911
|
_source_port,
|
|
12822
|
-
ccw_rotation: rect_ccw_rotation
|
|
12912
|
+
ccw_rotation: rect_ccw_rotation,
|
|
12913
|
+
roundness: rect_border_radius
|
|
12823
12914
|
},
|
|
12824
12915
|
{
|
|
12825
12916
|
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
@@ -13585,24 +13676,42 @@ var Drawer = class {
|
|
|
13585
13676
|
is_filled = true,
|
|
13586
13677
|
has_stroke,
|
|
13587
13678
|
is_stroke_dashed,
|
|
13588
|
-
stroke_width
|
|
13679
|
+
stroke_width,
|
|
13680
|
+
roundness
|
|
13589
13681
|
}) {
|
|
13590
13682
|
const [x1$, y1$] = applyToPoint3(this.transform, [x - w / 2, y - h / 2]);
|
|
13591
13683
|
const [x2$, y2$] = applyToPoint3(this.transform, [x + w / 2, y + h / 2]);
|
|
13592
13684
|
this.applyAperture();
|
|
13593
13685
|
const ctx = this.getLayerCtx();
|
|
13686
|
+
const radius$ = roundness ? scaleOnly(this.transform, roundness) : 0;
|
|
13594
13687
|
const shouldDrawStroke = has_stroke === void 0 ? is_filled === false : has_stroke;
|
|
13595
13688
|
if (mesh_fill) {
|
|
13596
13689
|
ctx.save();
|
|
13597
13690
|
ctx.beginPath();
|
|
13598
|
-
|
|
13691
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13692
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13693
|
+
} else {
|
|
13694
|
+
ctx.rect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13695
|
+
}
|
|
13599
13696
|
ctx.clip();
|
|
13600
13697
|
this.drawMeshPattern(x - w / 2, y - h / 2, w, h, 0.15);
|
|
13601
13698
|
ctx.restore();
|
|
13602
|
-
|
|
13699
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13700
|
+
ctx.beginPath();
|
|
13701
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13702
|
+
ctx.stroke();
|
|
13703
|
+
} else {
|
|
13704
|
+
ctx.strokeRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13705
|
+
}
|
|
13603
13706
|
} else {
|
|
13604
13707
|
if (is_filled !== false) {
|
|
13605
|
-
|
|
13708
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13709
|
+
ctx.beginPath();
|
|
13710
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13711
|
+
ctx.fill();
|
|
13712
|
+
} else {
|
|
13713
|
+
ctx.fillRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13714
|
+
}
|
|
13606
13715
|
}
|
|
13607
13716
|
if (shouldDrawStroke) {
|
|
13608
13717
|
const originalLineWidth = ctx.lineWidth;
|
|
@@ -13622,7 +13731,13 @@ var Drawer = class {
|
|
|
13622
13731
|
}
|
|
13623
13732
|
ctx.setLineDash(dashPattern);
|
|
13624
13733
|
}
|
|
13625
|
-
|
|
13734
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13735
|
+
ctx.beginPath();
|
|
13736
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13737
|
+
ctx.stroke();
|
|
13738
|
+
} else {
|
|
13739
|
+
ctx.strokeRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13740
|
+
}
|
|
13626
13741
|
if (is_stroke_dashed) {
|
|
13627
13742
|
ctx.setLineDash([]);
|
|
13628
13743
|
}
|
|
@@ -13632,11 +13747,12 @@ var Drawer = class {
|
|
|
13632
13747
|
}
|
|
13633
13748
|
}
|
|
13634
13749
|
}
|
|
13635
|
-
rotatedRect(x, y, w, h, ccw_rotation, mesh_fill) {
|
|
13750
|
+
rotatedRect(x, y, w, h, ccw_rotation, roundness, mesh_fill) {
|
|
13636
13751
|
const ctx = this.getLayerCtx();
|
|
13637
13752
|
this.applyAperture();
|
|
13638
13753
|
const [x1$, y1$] = applyToPoint3(this.transform, [x - w / 2, y - h / 2]);
|
|
13639
13754
|
const [x2$, y2$] = applyToPoint3(this.transform, [x + w / 2, y + h / 2]);
|
|
13755
|
+
const radius$ = roundness ? scaleOnly(this.transform, roundness) : 0;
|
|
13640
13756
|
ctx.save();
|
|
13641
13757
|
const [centerX, centerY] = applyToPoint3(this.transform, [x, y]);
|
|
13642
13758
|
ctx.translate(centerX, centerY);
|
|
@@ -13645,12 +13761,28 @@ var Drawer = class {
|
|
|
13645
13761
|
ctx.translate(-centerX, -centerY);
|
|
13646
13762
|
if (mesh_fill) {
|
|
13647
13763
|
ctx.beginPath();
|
|
13648
|
-
|
|
13764
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13765
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13766
|
+
} else {
|
|
13767
|
+
ctx.rect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13768
|
+
}
|
|
13649
13769
|
ctx.clip();
|
|
13650
13770
|
this.drawMeshPattern(x - w / 2, y - h / 2, w, h, 0.15);
|
|
13651
|
-
|
|
13771
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13772
|
+
ctx.beginPath();
|
|
13773
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13774
|
+
ctx.stroke();
|
|
13775
|
+
} else {
|
|
13776
|
+
ctx.strokeRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13777
|
+
}
|
|
13652
13778
|
} else {
|
|
13653
|
-
|
|
13779
|
+
if (radius$ > 0 && ctx.roundRect) {
|
|
13780
|
+
ctx.beginPath();
|
|
13781
|
+
ctx.roundRect(x1$, y1$, x2$ - x1$, y2$ - y1$, radius$);
|
|
13782
|
+
ctx.fill();
|
|
13783
|
+
} else {
|
|
13784
|
+
ctx.fillRect(x1$, y1$, x2$ - x1$, y2$ - y1$);
|
|
13785
|
+
}
|
|
13654
13786
|
}
|
|
13655
13787
|
ctx.restore();
|
|
13656
13788
|
}
|
|
@@ -14102,7 +14234,8 @@ var drawRect = (drawer, rect) => {
|
|
|
14102
14234
|
is_filled: rect.is_filled,
|
|
14103
14235
|
has_stroke: rect.has_stroke,
|
|
14104
14236
|
is_stroke_dashed: rect.is_stroke_dashed,
|
|
14105
|
-
stroke_width: rect.stroke_width
|
|
14237
|
+
stroke_width: rect.stroke_width,
|
|
14238
|
+
roundness: rect.roundness
|
|
14106
14239
|
});
|
|
14107
14240
|
};
|
|
14108
14241
|
var drawRotatedRect = (drawer, rect) => {
|
|
@@ -14110,7 +14243,15 @@ var drawRotatedRect = (drawer, rect) => {
|
|
|
14110
14243
|
color: getColor(rect),
|
|
14111
14244
|
layer: rect.layer
|
|
14112
14245
|
});
|
|
14113
|
-
drawer.rotatedRect(
|
|
14246
|
+
drawer.rotatedRect(
|
|
14247
|
+
rect.x,
|
|
14248
|
+
rect.y,
|
|
14249
|
+
rect.w,
|
|
14250
|
+
rect.h,
|
|
14251
|
+
rect.ccw_rotation,
|
|
14252
|
+
rect.roundness,
|
|
14253
|
+
rect.mesh_fill
|
|
14254
|
+
);
|
|
14114
14255
|
};
|
|
14115
14256
|
var drawRotatedPill = (drawer, pill) => {
|
|
14116
14257
|
drawer.equip({
|
|
@@ -16337,7 +16478,7 @@ function ifSetsMatchExactly(set1, set2) {
|
|
|
16337
16478
|
return Array.from(set1).every((item) => set2.has(item));
|
|
16338
16479
|
}
|
|
16339
16480
|
|
|
16340
|
-
// node_modules/@tscircuit/math-utils/dist/chunk-
|
|
16481
|
+
// node_modules/@tscircuit/math-utils/dist/chunk-EFLPMB4J.js
|
|
16341
16482
|
function pointToSegmentDistance2(p, v, w) {
|
|
16342
16483
|
const l2 = (w.x - v.x) ** 2 + (w.y - v.y) ** 2;
|
|
16343
16484
|
if (l2 === 0) return distance3(p, v);
|
|
@@ -16792,7 +16933,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
16792
16933
|
// package.json
|
|
16793
16934
|
var package_default = {
|
|
16794
16935
|
name: "@tscircuit/pcb-viewer",
|
|
16795
|
-
version: "1.11.
|
|
16936
|
+
version: "1.11.214",
|
|
16796
16937
|
main: "dist/index.js",
|
|
16797
16938
|
type: "module",
|
|
16798
16939
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -16828,7 +16969,7 @@ var package_default = {
|
|
|
16828
16969
|
"react-cosmos-plugin-vite": "7.0.0-beta.0",
|
|
16829
16970
|
"react-dom": "19.1.0",
|
|
16830
16971
|
"react-use": "^17.4.0",
|
|
16831
|
-
tscircuit: "^0.0.
|
|
16972
|
+
tscircuit: "^0.0.642",
|
|
16832
16973
|
tsup: "^8.0.2",
|
|
16833
16974
|
"type-fest": "^3.0.0",
|
|
16834
16975
|
typescript: "^5.4.4",
|
|
@@ -17098,6 +17239,9 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
17098
17239
|
const handleErrorsToggle = useCallback3(() => {
|
|
17099
17240
|
const newErrorsOpen = !isErrorsOpen;
|
|
17100
17241
|
setErrorsOpen(newErrorsOpen);
|
|
17242
|
+
if (newErrorsOpen) {
|
|
17243
|
+
setViewMenuOpen(false);
|
|
17244
|
+
}
|
|
17101
17245
|
if (!newErrorsOpen) {
|
|
17102
17246
|
setHoveredErrorId(null);
|
|
17103
17247
|
}
|
|
@@ -17116,7 +17260,11 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
17116
17260
|
window.dispatchEvent(new Event("arm-dimension-tool"));
|
|
17117
17261
|
}, []);
|
|
17118
17262
|
const handleViewMenuToggle = useCallback3(() => {
|
|
17119
|
-
|
|
17263
|
+
const newViewMenuOpen = !isViewMenuOpen;
|
|
17264
|
+
setViewMenuOpen(newViewMenuOpen);
|
|
17265
|
+
if (newViewMenuOpen) {
|
|
17266
|
+
setErrorsOpen(false);
|
|
17267
|
+
}
|
|
17120
17268
|
}, [isViewMenuOpen]);
|
|
17121
17269
|
return /* @__PURE__ */ jsxs12(
|
|
17122
17270
|
"div",
|
|
@@ -17225,7 +17373,7 @@ var ToolbarOverlay = ({ children, elements }) => {
|
|
|
17225
17373
|
] })
|
|
17226
17374
|
}
|
|
17227
17375
|
),
|
|
17228
|
-
isErrorsOpen && /* @__PURE__ */ jsx15(
|
|
17376
|
+
isErrorsOpen && errorCount > 0 && /* @__PURE__ */ jsx15(
|
|
17229
17377
|
"div",
|
|
17230
17378
|
{
|
|
17231
17379
|
style: {
|