@tscircuit/pcb-viewer 1.11.254 → 1.11.256
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 +73 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7417,6 +7417,21 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
7417
7417
|
_source_port,
|
|
7418
7418
|
roundness: rect_border_radius
|
|
7419
7419
|
},
|
|
7420
|
+
{
|
|
7421
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7422
|
+
pcb_drawing_type: "rect",
|
|
7423
|
+
x,
|
|
7424
|
+
y,
|
|
7425
|
+
w: rect_pad_width,
|
|
7426
|
+
h: rect_pad_height,
|
|
7427
|
+
layer: "bottom",
|
|
7428
|
+
// Rectangular pad on bottom layer
|
|
7429
|
+
_element: element,
|
|
7430
|
+
_parent_pcb_component,
|
|
7431
|
+
_parent_source_component,
|
|
7432
|
+
_source_port,
|
|
7433
|
+
roundness: rect_border_radius
|
|
7434
|
+
},
|
|
7420
7435
|
{
|
|
7421
7436
|
_pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
|
|
7422
7437
|
_element: element,
|
|
@@ -7454,6 +7469,21 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
7454
7469
|
_source_port,
|
|
7455
7470
|
roundness: rect_border_radius
|
|
7456
7471
|
},
|
|
7472
|
+
{
|
|
7473
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7474
|
+
pcb_drawing_type: "rect",
|
|
7475
|
+
x,
|
|
7476
|
+
y,
|
|
7477
|
+
w: rect_pad_width,
|
|
7478
|
+
h: rect_pad_height,
|
|
7479
|
+
layer: "bottom",
|
|
7480
|
+
// Rectangular pad on bottom layer
|
|
7481
|
+
_element: element,
|
|
7482
|
+
_parent_pcb_component,
|
|
7483
|
+
_parent_source_component,
|
|
7484
|
+
_source_port,
|
|
7485
|
+
roundness: rect_border_radius
|
|
7486
|
+
},
|
|
7457
7487
|
{
|
|
7458
7488
|
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
7459
7489
|
_element: element,
|
|
@@ -7495,6 +7525,22 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
7495
7525
|
ccw_rotation: rect_ccw_rotation,
|
|
7496
7526
|
roundness: rect_border_radius
|
|
7497
7527
|
},
|
|
7528
|
+
{
|
|
7529
|
+
_pcb_drawing_object_id: `rect_${globalPcbDrawingObjectCount++}`,
|
|
7530
|
+
pcb_drawing_type: "rect",
|
|
7531
|
+
x,
|
|
7532
|
+
y,
|
|
7533
|
+
w: rect_pad_width,
|
|
7534
|
+
h: rect_pad_height,
|
|
7535
|
+
layer: "bottom",
|
|
7536
|
+
// Rectangular pad on bottom layer
|
|
7537
|
+
_element: element,
|
|
7538
|
+
_parent_pcb_component,
|
|
7539
|
+
_parent_source_component,
|
|
7540
|
+
_source_port,
|
|
7541
|
+
ccw_rotation: rect_ccw_rotation,
|
|
7542
|
+
roundness: rect_border_radius
|
|
7543
|
+
},
|
|
7498
7544
|
{
|
|
7499
7545
|
_pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
|
|
7500
7546
|
_element: element,
|
|
@@ -7962,13 +8008,24 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
7962
8008
|
_source_port
|
|
7963
8009
|
});
|
|
7964
8010
|
if (text) {
|
|
8011
|
+
const baseOffset = (font_size ?? 1) * 1.5;
|
|
8012
|
+
const perpX = -unitY;
|
|
8013
|
+
const perpY = unitX;
|
|
8014
|
+
const midpointX = (from.x + to.x) / 2;
|
|
8015
|
+
const midpointY = (from.y + to.y) / 2;
|
|
8016
|
+
let textOffset = baseOffset;
|
|
8017
|
+
if (Math.abs(unitX) > Math.abs(unitY)) {
|
|
8018
|
+
textOffset = midpointY >= 0 ? baseOffset : -baseOffset;
|
|
8019
|
+
} else {
|
|
8020
|
+
textOffset = midpointX >= 0 ? -baseOffset : baseOffset;
|
|
8021
|
+
}
|
|
7965
8022
|
primitives.push({
|
|
7966
8023
|
_pcb_drawing_object_id: getNewPcbDrawingObjectId(
|
|
7967
8024
|
"pcb_fabrication_note_dimension"
|
|
7968
8025
|
),
|
|
7969
8026
|
pcb_drawing_type: "text",
|
|
7970
|
-
x: (from.x + to.x) / 2,
|
|
7971
|
-
y: (from.y + to.y) / 2,
|
|
8027
|
+
x: (from.x + to.x) / 2 + perpX * textOffset,
|
|
8028
|
+
y: (from.y + to.y) / 2 + perpY * textOffset,
|
|
7972
8029
|
layer,
|
|
7973
8030
|
align: "center",
|
|
7974
8031
|
text,
|
|
@@ -8213,11 +8270,22 @@ var convertElementToPrimitives = (element, allElements) => {
|
|
|
8213
8270
|
_element: element
|
|
8214
8271
|
});
|
|
8215
8272
|
if (text) {
|
|
8273
|
+
const baseOffset = font_size * 1.5;
|
|
8274
|
+
const perpX = -unitY;
|
|
8275
|
+
const perpY = unitX;
|
|
8276
|
+
const midpointX = (from.x + to.x) / 2;
|
|
8277
|
+
const midpointY = (from.y + to.y) / 2;
|
|
8278
|
+
let textOffset = baseOffset;
|
|
8279
|
+
if (Math.abs(unitX) > Math.abs(unitY)) {
|
|
8280
|
+
textOffset = midpointY >= 0 ? baseOffset : -baseOffset;
|
|
8281
|
+
} else {
|
|
8282
|
+
textOffset = midpointX >= 0 ? -baseOffset : baseOffset;
|
|
8283
|
+
}
|
|
8216
8284
|
primitives.push({
|
|
8217
8285
|
_pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_note_dimension"),
|
|
8218
8286
|
pcb_drawing_type: "text",
|
|
8219
|
-
x: (from.x + to.x) / 2,
|
|
8220
|
-
y: (from.y + to.y) / 2,
|
|
8287
|
+
x: (from.x + to.x) / 2 + perpX * textOffset,
|
|
8288
|
+
y: (from.y + to.y) / 2 + perpY * textOffset,
|
|
8221
8289
|
layer: "notes",
|
|
8222
8290
|
align: "center",
|
|
8223
8291
|
text,
|
|
@@ -12374,7 +12442,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
12374
12442
|
// package.json
|
|
12375
12443
|
var package_default = {
|
|
12376
12444
|
name: "@tscircuit/pcb-viewer",
|
|
12377
|
-
version: "1.11.
|
|
12445
|
+
version: "1.11.255",
|
|
12378
12446
|
main: "dist/index.js",
|
|
12379
12447
|
type: "module",
|
|
12380
12448
|
repository: "tscircuit/pcb-viewer",
|