From 2c6a9d85cf495dea63929f500f239769605e7e35 Mon Sep 17 00:00:00 2001 From: Kevin Andersen Date: Fri, 5 Apr 2019 13:05:52 -0400 Subject: [PATCH] Resolves #2087 and #2088 for rotation-based commands. There's quite a few interactions between degrees, their sign, and the currently set direction for the motor the degrees relate to. In this case, BoostMotor.turnOnDegrees() was being run with -degrees, and since that function does a Math.max between 0 and degrees, it resulted in 0 degrees. Because of this, and for clarity, turnOnDegrees now only gets called with positive values. If running CCW, that should be specified in the direction-parameter. --- src/extensions/scratch3_boost/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/extensions/scratch3_boost/index.js b/src/extensions/scratch3_boost/index.js index 665fc3fd4..b0d8e8ab5 100644 --- a/src/extensions/scratch3_boost/index.js +++ b/src/extensions/scratch3_boost/index.js @@ -1719,8 +1719,8 @@ class Scratch3BoostBlocks { if (motor.pendingTimeoutDelay) { motor.turnOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now()); } else if (motor.pendingPositionDestination) { - const p = motor.pendingPositionDestination - motor.position; - motor.turnOnForDegrees(p, Math.sign(p) * motor.direction); + const p = Math.abs(motor.pendingPositionDestination - motor.position); + motor.turnOnForDegrees(p, Math.sign(p)); } } } @@ -1758,8 +1758,8 @@ class Scratch3BoostBlocks { if (motor.pendingTimeoutDelay) { motor.turnOnFor(motor.pendingTimeoutStartTime + motor.pendingTimeoutDelay - Date.now()); } else if (motor.pendingPositionDestination) { - const p = motor.pendingPositionDestination - motor.position; - motor.turnOnForDegrees(p, Math.sign(p) * motor.direction); + const p = Math.abs(motor.pendingPositionDestination - motor.position); + motor.turnOnForDegrees(p, Math.sign(p)); } } }