@tscircuit/matchpack 0.0.8 → 0.0.9

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 +18 -23
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -90,7 +90,7 @@ function rotatePoint(point, angleDegrees) {
90
90
  }
91
91
  function getRotatedDimensions(width, height, rotation) {
92
92
  const normalizedRotation = (rotation % 360 + 360) % 360;
93
- if (normalizedRotation === 90 || normalizedRotation === 270) {
93
+ if (Math.round((normalizedRotation + 90) % 180) === 0) {
94
94
  return { width: height, height: width };
95
95
  }
96
96
  return { width, height };
@@ -559,28 +559,23 @@ var SingleInnerPartitionPackingSolver = class extends BaseSolver {
559
559
  this.inputProblem = inputProblem;
560
560
  }
561
561
  _step() {
562
- try {
563
- if (!this.activeSubSolver) {
564
- const packInput = this.createPackInput();
565
- this.activeSubSolver = new PackSolver2(packInput);
566
- this.activeSubSolver = this.activeSubSolver;
567
- }
568
- this.activeSubSolver.step();
569
- if (this.activeSubSolver.failed) {
570
- this.failed = true;
571
- this.error = `PackSolver2 failed: ${this.activeSubSolver.error}`;
572
- return;
573
- }
574
- if (this.activeSubSolver.solved) {
575
- this.layout = this.createLayoutFromPackingResult(
576
- this.activeSubSolver.packedComponents
577
- );
578
- this.solved = true;
579
- this.activeSubSolver = null;
580
- }
581
- } catch (error) {
562
+ if (!this.activeSubSolver) {
563
+ const packInput = this.createPackInput();
564
+ this.activeSubSolver = new PackSolver2(packInput);
565
+ this.activeSubSolver = this.activeSubSolver;
566
+ }
567
+ this.activeSubSolver.step();
568
+ if (this.activeSubSolver.failed) {
582
569
  this.failed = true;
583
- this.error = `Failed to pack partition: ${error}`;
570
+ this.error = `PackSolver2 failed: ${this.activeSubSolver.error}`;
571
+ return;
572
+ }
573
+ if (this.activeSubSolver.solved) {
574
+ this.layout = this.createLayoutFromPackingResult(
575
+ this.activeSubSolver.packedComponents
576
+ );
577
+ this.solved = true;
578
+ this.activeSubSolver = null;
584
579
  }
585
580
  }
586
581
  createPackInput() {
@@ -634,7 +629,7 @@ var SingleInnerPartitionPackingSolver = class extends BaseSolver {
634
629
  chipPlacements[chipId] = {
635
630
  x: packedComponent.center.x,
636
631
  y: packedComponent.center.y,
637
- ccwRotationDegrees: packedComponent.ccwRotationDegrees || 0
632
+ ccwRotationDegrees: packedComponent.ccwRotationOffset || packedComponent.ccwRotationDegrees || 0
638
633
  };
639
634
  }
640
635
  return {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tscircuit/matchpack",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.8",
5
+ "version": "0.0.9",
6
6
  "files": [
7
7
  "dist"
8
8
  ],
@@ -21,7 +21,7 @@
21
21
  "@tscircuit/schematic-viewer": "^2.0.26",
22
22
  "@types/bun": "latest",
23
23
  "bpc-graph": "^0.0.66",
24
- "calculate-packing": "^0.0.27",
24
+ "calculate-packing": "^0.0.28",
25
25
  "circuit-json": "^0.0.226",
26
26
  "graphics-debug": "^0.0.62",
27
27
  "react-cosmos": "^7.0.0",