@tscircuit/pcb-viewer 1.11.288 → 1.11.290
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 +7 -20
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -9494,14 +9494,6 @@ import { lineAlphabet, svgAlphabet } from "@tscircuit/alphabet";
|
|
|
9494
9494
|
// src/lib/convert-text-to-lines.ts
|
|
9495
9495
|
var LETTER_HEIGHT_TO_WIDTH_RATIO = 0.6;
|
|
9496
9496
|
var LETTER_HEIGHT_TO_SPACE_RATIO = 0.2;
|
|
9497
|
-
var LOWERCASE_BASELINE_OFFSET = (() => {
|
|
9498
|
-
const referenceLetters = ["a", "c", "e", "m", "n", "o", "r", "s", "u", "x"];
|
|
9499
|
-
const offsets = referenceLetters.map((letter) => lineAlphabet[letter]).filter((lines) => lines && lines.length > 0).map(
|
|
9500
|
-
(lines) => Math.min(...lines.map((line) => Math.min(line.y1, line.y2)))
|
|
9501
|
-
);
|
|
9502
|
-
return offsets.length > 0 ? Math.min(...offsets) : 0;
|
|
9503
|
-
})();
|
|
9504
|
-
var getBaselineOffsetForLetter = (letter) => letter >= "a" && letter <= "z" ? LOWERCASE_BASELINE_OFFSET : 0;
|
|
9505
9497
|
var getTextGeometry = (text) => {
|
|
9506
9498
|
const target_height = text.size * 0.7;
|
|
9507
9499
|
const target_width_char = target_height * LETTER_HEIGHT_TO_WIDTH_RATIO;
|
|
@@ -9515,9 +9507,7 @@ var getTextGeometry = (text) => {
|
|
|
9515
9507
|
return line.length * target_width_char + (line.length - 1) * space_between_chars;
|
|
9516
9508
|
}) : [];
|
|
9517
9509
|
const width = line_widths.length > 0 ? Math.max(...line_widths) : 0;
|
|
9518
|
-
const
|
|
9519
|
-
const baselineOffset = hasLowercase ? LOWERCASE_BASELINE_OFFSET * target_height : 0;
|
|
9520
|
-
const height = line_count > 0 ? line_count * target_height + (line_count - 1) * space_between_lines + baselineOffset : 0;
|
|
9510
|
+
const height = line_count > 0 ? line_count * target_height + (line_count - 1) * space_between_lines : 0;
|
|
9521
9511
|
return {
|
|
9522
9512
|
text_lines,
|
|
9523
9513
|
line_count,
|
|
@@ -9562,7 +9552,6 @@ var convertTextToLines = (text) => {
|
|
|
9562
9552
|
for (let letterIndex = 0; letterIndex < text_lines[lineIndex].length; letterIndex++) {
|
|
9563
9553
|
const letter = text_lines[lineIndex][letterIndex];
|
|
9564
9554
|
const letterLines = lineAlphabet[letter] ?? lineAlphabet[letter.toUpperCase()];
|
|
9565
|
-
const baselineOffset = getBaselineOffsetForLetter(letter);
|
|
9566
9555
|
if (!letterLines) {
|
|
9567
9556
|
current_x_origin_for_char_box += target_width_char + space_between_chars;
|
|
9568
9557
|
continue;
|
|
@@ -9573,15 +9562,13 @@ var convertTextToLines = (text) => {
|
|
|
9573
9562
|
x2: norm_x2,
|
|
9574
9563
|
y2: norm_y2
|
|
9575
9564
|
} of letterLines) {
|
|
9576
|
-
const adjusted_y1 = norm_y1 - baselineOffset;
|
|
9577
|
-
const adjusted_y2 = norm_y2 - baselineOffset;
|
|
9578
9565
|
lines.push({
|
|
9579
9566
|
_pcb_drawing_object_id: getNewPcbDrawingObjectId("line"),
|
|
9580
9567
|
pcb_drawing_type: "line",
|
|
9581
9568
|
x1: current_x_origin_for_char_box + target_width_char * norm_x1,
|
|
9582
|
-
y1: text.y + lineYOffset + target_height *
|
|
9569
|
+
y1: text.y + lineYOffset + target_height * norm_y1,
|
|
9583
9570
|
x2: current_x_origin_for_char_box + target_width_char * norm_x2,
|
|
9584
|
-
y2: text.y + lineYOffset + target_height *
|
|
9571
|
+
y2: text.y + lineYOffset + target_height * norm_y2,
|
|
9585
9572
|
width: strokeWidth,
|
|
9586
9573
|
layer: text.layer,
|
|
9587
9574
|
unit: text.unit,
|
|
@@ -12829,8 +12816,8 @@ var BoardAnchorOffsetOverlay = ({
|
|
|
12829
12816
|
const yLabelOffset = isTargetRightOfAnchor ? VISUAL_CONFIG.LABEL_OFFSET_RIGHT : VISUAL_CONFIG.LABEL_OFFSET_LEFT;
|
|
12830
12817
|
const shouldShowXLabel = xLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
|
|
12831
12818
|
const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
|
|
12832
|
-
const xLabelText =
|
|
12833
|
-
const yLabelText =
|
|
12819
|
+
const xLabelText = `${displayOffsetX ?? offsetX.toFixed(2)}mm`;
|
|
12820
|
+
const yLabelText = `${displayOffsetY ?? offsetY.toFixed(2)}mm`;
|
|
12834
12821
|
return /* @__PURE__ */ jsxs9("g", { children: [
|
|
12835
12822
|
/* @__PURE__ */ jsx12(
|
|
12836
12823
|
"line",
|
|
@@ -13889,7 +13876,7 @@ import { css as css3 } from "@emotion/css";
|
|
|
13889
13876
|
// package.json
|
|
13890
13877
|
var package_default = {
|
|
13891
13878
|
name: "@tscircuit/pcb-viewer",
|
|
13892
|
-
version: "1.11.
|
|
13879
|
+
version: "1.11.289",
|
|
13893
13880
|
main: "dist/index.js",
|
|
13894
13881
|
type: "module",
|
|
13895
13882
|
repository: "tscircuit/pcb-viewer",
|
|
@@ -13939,7 +13926,7 @@ var package_default = {
|
|
|
13939
13926
|
},
|
|
13940
13927
|
dependencies: {
|
|
13941
13928
|
"@emotion/css": "^11.11.2",
|
|
13942
|
-
"@tscircuit/alphabet": "^0.0.
|
|
13929
|
+
"@tscircuit/alphabet": "^0.0.9",
|
|
13943
13930
|
"@tscircuit/math-utils": "^0.0.29",
|
|
13944
13931
|
"@vitejs/plugin-react": "^5.0.2",
|
|
13945
13932
|
"circuit-json": "^0.0.333",
|