minerender 2.1.0-alpha.130 → 2.1.0-alpha.131

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.
@@ -2691,13 +2691,13 @@ function applyElementRotation(rotation, geometry) {
2691
2691
  break;
2692
2692
  }
2693
2693
  if (rotation.rescale) {
2694
- if (Math.abs(rotation.angle) === 22.5) {
2695
- const s = 1 / Math.cos(0.39269909262657166);
2696
- geometry.scale(s, 1, s);
2697
- } else {
2698
- const s = 1 / Math.cos(0.7853981852531433);
2699
- geometry.scale(s, 1, s);
2700
- }
2694
+ const angle = toRadians(rotation.angle);
2695
+ const s = 1 / Math.max(Math.abs(Math.cos(angle)), Math.abs(Math.sin(angle)));
2696
+ geometry.scale(
2697
+ rotation.axis === "x" /* X */ ? 1 : s,
2698
+ rotation.axis === "y" /* Y */ ? 1 : s,
2699
+ rotation.axis === "z" /* Z */ ? 1 : s
2700
+ );
2701
2701
  }
2702
2702
  geometry.translate(origin.x, origin.y, origin.z);
2703
2703
  }