@react-shimeji/core 0.2.0 → 0.2.1

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.cjs CHANGED
@@ -986,6 +986,7 @@ function environmentRectangle(bounds) {
986
986
  };
987
987
  }
988
988
  var PLATFORM_NEARBY_DISTANCE = 400;
989
+ var PLATFORM_EDGE_TOLERANCE = 16;
989
990
  function distanceToRectangle(point, rectangle) {
990
991
  const dx = Math.max(rectangle.x - point.x, 0, point.x - rectangle.x - rectangle.width);
991
992
  const dy = Math.max(rectangle.y - point.y, 0, point.y - rectangle.y - rectangle.height);
@@ -1059,9 +1060,11 @@ var Mascot = class {
1059
1060
  }
1060
1061
  if (!started) break;
1061
1062
  }
1062
- const wasOnPlatformTop = environment.mascot.environment.activeIE.visible && environment.mascot.environment.activeIE.topBorder.isOn(this.state);
1063
+ const activeIE = environment.mascot.environment.activeIE;
1064
+ const wasOnPlatformTop = activeIE.visible && activeIE.topBorder.isOn(this.state);
1063
1065
  const completed = this.actions.tick(deltaMs, environment, bounds);
1064
- if (wasOnPlatformTop && !platforms.some((platform) => isOnTop(this.state, platform))) {
1066
+ const remainedNearPlatform = this.state.x >= activeIE.left - PLATFORM_EDGE_TOLERANCE && this.state.x <= activeIE.right + PLATFORM_EDGE_TOLERANCE;
1067
+ if (wasOnPlatformTop && !remainedNearPlatform && !platforms.some((platform) => isOnTop(this.state, platform))) {
1065
1068
  this.actions.cancel();
1066
1069
  this.currentBehavior = this.findFallBehavior();
1067
1070
  if (this.currentBehavior) this.startBehavior(this.createEnvironment(bounds, platforms));