From 71631f5aa2a8b761993ffe4c6f7bb9f2fda9f5c0 Mon Sep 17 00:00:00 2001 From: Daiki Fukumori Date: Wed, 11 Mar 2020 22:15:20 +0800 Subject: [PATCH] Correct the trigger of isTilted() --- src/extensions/scratch3_wedo2/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extensions/scratch3_wedo2/index.js b/src/extensions/scratch3_wedo2/index.js index e34d51a45..ce6050cf9 100644 --- a/src/extensions/scratch3_wedo2/index.js +++ b/src/extensions/scratch3_wedo2/index.js @@ -1543,8 +1543,8 @@ class Scratch3WeDo2Blocks { _isTilted (direction) { switch (direction) { case WeDo2TiltDirection.ANY: - return (Math.abs(this._peripheral.tiltX) >= Scratch3WeDo2Blocks.TILT_THRESHOLD) || - (Math.abs(this._peripheral.tiltY) >= Scratch3WeDo2Blocks.TILT_THRESHOLD); + return (this._peripheral.tiltX > 45 ? 256 - this._peripheral.tiltX : this._peripheral.tiltX) >= Scratch3WeDo2Blocks.TILT_THRESHOLD || + (this._peripheral.tiltY > 45 ? 256 - this._peripheral.tiltY : this._peripheral.tiltY) >= Scratch3WeDo2Blocks.TILT_THRESHOLD; default: return this._getTiltAngle(direction) >= Scratch3WeDo2Blocks.TILT_THRESHOLD; }