@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.js CHANGED
@@ -939,6 +939,7 @@ function environmentRectangle(bounds) {
939
939
  };
940
940
  }
941
941
  var PLATFORM_NEARBY_DISTANCE = 400;
942
+ var PLATFORM_EDGE_TOLERANCE = 16;
942
943
  function distanceToRectangle(point, rectangle) {
943
944
  const dx = Math.max(rectangle.x - point.x, 0, point.x - rectangle.x - rectangle.width);
944
945
  const dy = Math.max(rectangle.y - point.y, 0, point.y - rectangle.y - rectangle.height);
@@ -1012,9 +1013,11 @@ var Mascot = class {
1012
1013
  }
1013
1014
  if (!started) break;
1014
1015
  }
1015
- const wasOnPlatformTop = environment.mascot.environment.activeIE.visible && environment.mascot.environment.activeIE.topBorder.isOn(this.state);
1016
+ const activeIE = environment.mascot.environment.activeIE;
1017
+ const wasOnPlatformTop = activeIE.visible && activeIE.topBorder.isOn(this.state);
1016
1018
  const completed = this.actions.tick(deltaMs, environment, bounds);
1017
- if (wasOnPlatformTop && !platforms.some((platform) => isOnTop(this.state, platform))) {
1019
+ const remainedNearPlatform = this.state.x >= activeIE.left - PLATFORM_EDGE_TOLERANCE && this.state.x <= activeIE.right + PLATFORM_EDGE_TOLERANCE;
1020
+ if (wasOnPlatformTop && !remainedNearPlatform && !platforms.some((platform) => isOnTop(this.state, platform))) {
1018
1021
  this.actions.cancel();
1019
1022
  this.currentBehavior = this.findFallBehavior();
1020
1023
  if (this.currentBehavior) this.startBehavior(this.createEnvironment(bounds, platforms));