@tscircuit/core 0.0.1057 → 0.0.1058

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 +21 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -8387,19 +8387,29 @@ var Port = class extends PrimitiveComponent2 {
8387
8387
  if (this.schematic_stem_line_id) {
8388
8388
  const line = db.schematic_line.get(this.schematic_stem_line_id);
8389
8389
  if (line) {
8390
- const p1 = applyToPoint14(transform, { x: line.x1, y: line.y1 });
8391
- const p2 = applyToPoint14(transform, { x: line.x2, y: line.y2 });
8390
+ const originalStemLength = Math.sqrt(
8391
+ (line.x1 - line.x2) ** 2 + (line.y1 - line.y2) ** 2
8392
+ );
8393
+ const anchorScaled = applyToPoint14(transform, {
8394
+ x: line.x2,
8395
+ y: line.y2
8396
+ });
8397
+ const { direction } = this._parsedProps;
8398
+ let outerX = anchorScaled.x;
8399
+ let outerY = anchorScaled.y;
8400
+ if (direction === "right") outerX += originalStemLength;
8401
+ else if (direction === "left") outerX -= originalStemLength;
8402
+ else if (direction === "up") outerY += originalStemLength;
8403
+ else if (direction === "down") outerY -= originalStemLength;
8392
8404
  db.schematic_line.update(this.schematic_stem_line_id, {
8393
- x1: p1.x,
8394
- y1: p1.y,
8395
- x2: p2.x,
8396
- y2: p2.y
8405
+ x1: outerX,
8406
+ y1: outerY,
8407
+ x2: anchorScaled.x,
8408
+ y2: anchorScaled.y
8397
8409
  });
8398
- const scaledStemLength = Math.sqrt(
8399
- (p1.x - p2.x) ** 2 + (p1.y - p2.y) ** 2
8400
- );
8401
8410
  db.schematic_port.update(this.schematic_port_id, {
8402
- distance_from_component_edge: scaledStemLength
8411
+ center: { x: outerX, y: outerY },
8412
+ distance_from_component_edge: originalStemLength
8403
8413
  });
8404
8414
  }
8405
8415
  }
@@ -18085,7 +18095,7 @@ import { identity as identity4 } from "transformation-matrix";
18085
18095
  var package_default = {
18086
18096
  name: "@tscircuit/core",
18087
18097
  type: "module",
18088
- version: "0.0.1056",
18098
+ version: "0.0.1057",
18089
18099
  types: "dist/index.d.ts",
18090
18100
  main: "dist/index.js",
18091
18101
  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.1057",
4
+ "version": "0.0.1058",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",