fix sb2 conversion to load into correct VIDEO_STATE

This commit is contained in:
Corey Frang 2018-04-05 15:10:16 -04:00 committed by Michael "Z" Goddard
parent 9cd5e4da2b
commit e20723994f
No known key found for this signature in database
GPG key ID: 762CD40DD5349872
2 changed files with 12 additions and 3 deletions

View file

@ -339,14 +339,13 @@ class Scratch3VideoSensingBlocks {
}
videoToggle (args) {
// imported blocks have VIDEO_STATE "off", "on", "on-flipped" as opposed to the numerics?
const state = Number(args.VIDEO_STATE);
// 1 == off, 2 & 3 are on (3 is flipped)
if (args.VIDEO_STATE === 'off' || state === 1) {
if (state === 1) {
this.runtime.ioDevices.video.disableVideo();
} else {
this.runtime.ioDevices.video.enableVideo();
this.runtime.ioDevices.video.mirror = args.VIDEO_STATE === 'on' || state === 2;
this.runtime.ioDevices.video.mirror = state === 2;
}
}

View file

@ -627,6 +627,16 @@ const parseBlock = function (sb2block, addBroadcastMsg, getVariableId, extension
} else if (fieldValue === 'this sprite') {
fieldValue = 2;
}
} else if (expectedArg.inputOp === 'videoSensing.menu.VIDEO_STATE') {
if (shadowObscured) {
fieldValue = 2;
} else if (fieldValue === 'off') {
fieldValue = 1;
} else if (fieldValue === 'on') {
fieldValue = 2;
} else if (fieldValue === 'on-flipped') {
fieldValue = 3;
}
} else if (shadowObscured) {
// Filled drop-down menu.
fieldValue = '';