@tscircuit/core 0.0.1354 → 0.0.1355

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.
Files changed (2) hide show
  1. package/dist/index.js +32 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -18096,7 +18096,15 @@ import Debug8 from "debug";
18096
18096
  import { getBoundFromCenteredRect } from "@tscircuit/math-utils";
18097
18097
  import { symbols as symbols3 } from "schematic-symbols";
18098
18098
  var SYMBOL_TEXT_FONT_SIZE = 0.18;
18099
- var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set(["simple_resistor", "simple_capacitor"]);
18099
+ var TEXT_BOX_ENABLED_FTYPES = /* @__PURE__ */ new Set([
18100
+ "simple_resistor",
18101
+ "simple_capacitor",
18102
+ "simple_inductor",
18103
+ "simple_crystal",
18104
+ "simple_resonator",
18105
+ "simple_potentiometer",
18106
+ "simple_fuse"
18107
+ ]);
18100
18108
  function getTextBounds({
18101
18109
  text,
18102
18110
  position,
@@ -18209,19 +18217,28 @@ function getSchematicComponentWithTextBounds(db, schematicComponent) {
18209
18217
  const boxBounds = getSymbolBoxBounds(schematicComponent);
18210
18218
  const isVertical = schematicComponent.size.height > schematicComponent.size.width;
18211
18219
  if (isVertical) return textBounds;
18212
- const padX = Math.max(
18213
- boxBounds.minX - textBounds.minX,
18214
- textBounds.maxX - boxBounds.maxX
18215
- );
18216
- const padY = Math.max(
18217
- textBounds.maxY - boxBounds.maxY,
18218
- boxBounds.minY - textBounds.minY
18219
- );
18220
- return getBoundFromCenteredRect({
18221
- center: schematicComponent.center,
18222
- width: schematicComponent.size.width + 2 * padX,
18223
- height: schematicComponent.size.height + 2 * padY
18224
- });
18220
+ const padLeft = Math.max(0, boxBounds.minX - textBounds.minX);
18221
+ const padRight = Math.max(0, textBounds.maxX - boxBounds.maxX);
18222
+ const padTop = Math.max(0, textBounds.maxY - boxBounds.maxY);
18223
+ const padBottom = Math.max(0, boxBounds.minY - textBounds.minY);
18224
+ let left = padLeft;
18225
+ let right = padRight;
18226
+ if (padLeft > 0 && padRight > 0) {
18227
+ left = Math.max(padLeft, padRight);
18228
+ right = left;
18229
+ }
18230
+ let top = padTop;
18231
+ let bottom = padBottom;
18232
+ if (padTop > 0 && padBottom > 0) {
18233
+ top = Math.max(padTop, padBottom);
18234
+ bottom = top;
18235
+ }
18236
+ return {
18237
+ minX: boxBounds.minX - left,
18238
+ maxX: boxBounds.maxX + right,
18239
+ minY: boxBounds.minY - bottom,
18240
+ maxY: boxBounds.maxY + top
18241
+ };
18225
18242
  }
18226
18243
 
18227
18244
  // lib/components/primitive-components/Group/applySchematicMatchPackLayoutToTree.ts
@@ -24214,7 +24231,7 @@ import { identity as identity5 } from "transformation-matrix";
24214
24231
  var package_default = {
24215
24232
  name: "@tscircuit/core",
24216
24233
  type: "module",
24217
- version: "0.0.1353",
24234
+ version: "0.0.1354",
24218
24235
  types: "dist/index.d.ts",
24219
24236
  main: "dist/index.js",
24220
24237
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1354",
4
+ "version": "0.0.1355",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",