mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Resolves #2086. This issue was caused by turnOnForDegrees() not resolving a promise. Additionally, this promise can only be resolved if its assigned before turnOnDegrees() was called, so in motorOnForRotation() it is now switched around.
This commit is contained in:
parent
f02433510a
commit
d9e0267fa0
1 changed files with 6 additions and 2 deletions
|
@ -471,7 +471,11 @@ class BoostMotor {
|
|||
* @param {number} direction - rotate in this direction
|
||||
*/
|
||||
turnOnForDegrees (degrees, direction) {
|
||||
if (this._power === 0) return;
|
||||
if (this._power === 0) {
|
||||
this.pendingPromiseFunction();
|
||||
return;
|
||||
}
|
||||
|
||||
degrees = Math.max(0, degrees);
|
||||
|
||||
const cmd = this._parent.generateOutputCommand(
|
||||
|
@ -1642,8 +1646,8 @@ class Scratch3BoostBlocks {
|
|||
const motor = this._peripheral.motor(portID);
|
||||
if (motor) {
|
||||
return new Promise(resolve => {
|
||||
motor.turnOnForDegrees(degrees, sign);
|
||||
motor.pendingPromiseFunction = resolve;
|
||||
motor.turnOnForDegrees(degrees, sign);
|
||||
});
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue