From 62b8dd93afc85caf48088b1b566ba3eb2f437f03 Mon Sep 17 00:00:00 2001 From: Florrie Date: Mon, 30 Apr 2018 17:45:32 -0300 Subject: [PATCH 1/2] Spec maps for scroll blocks + "implementations" --- src/blocks/scratch3_motion.js | 9 +++++++- src/serialization/sb2_specmap.js | 39 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/blocks/scratch3_motion.js b/src/blocks/scratch3_motion.js index 524eab24a..ebe13a434 100644 --- a/src/blocks/scratch3_motion.js +++ b/src/blocks/scratch3_motion.js @@ -34,7 +34,12 @@ class Scratch3MotionBlocks { motion_sety: this.setY, motion_xposition: this.getX, motion_yposition: this.getY, - motion_direction: this.getDirection + motion_direction: this.getDirection, + motion_scroll_right: this.doNothing, + motion_scroll_up: this.doNothing, + motion_align_scene: this.doNothing, + motion_xscroll: this.doNothing, + motion_yscroll: this.doNothing }; } @@ -254,6 +259,8 @@ class Scratch3MotionBlocks { getDirection (args, util) { return util.target.direction; } + + doNothing () {} } module.exports = Scratch3MotionBlocks; diff --git a/src/serialization/sb2_specmap.js b/src/serialization/sb2_specmap.js index ff5ddd812..f06f3844b 100644 --- a/src/serialization/sb2_specmap.js +++ b/src/serialization/sb2_specmap.js @@ -206,6 +206,45 @@ const specMap = { argMap: [ ] }, + 'scrollRight': { + opcode: 'motion_scroll_right', + argMap: [ + { + type: 'input', + inputOp: 'math_number', + inputName: 'DISTANCE' + } + ] + }, + 'scrollUp': { + opcode: 'motion_scroll_up', + argMap: [ + { + type: 'input', + inputOp: 'math_number', + inputName: 'DISTANCE' + } + ] + }, + 'scrollAlign': { + opcode: 'motion_align_scene', + argMap: [ + { + type: 'field', + fieldName: 'ALIGNMENT' + } + ] + }, + 'xScroll': { + opcode: 'motion_xscroll', + argMap: [ + ] + }, + 'yScroll': { + opcode: 'motion_yscroll', + argMap: [ + ] + }, 'say:duration:elapsed:from:': { opcode: 'looks_sayforsecs', argMap: [ From 25bb4bc82ca9551fd3b2d54de10457a43aeb6cee Mon Sep 17 00:00:00 2001 From: Florrie Date: Tue, 1 May 2018 14:00:31 -0300 Subject: [PATCH 2/2] Remove doNothing method --- src/blocks/scratch3_motion.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/blocks/scratch3_motion.js b/src/blocks/scratch3_motion.js index ebe13a434..ce3f1ac46 100644 --- a/src/blocks/scratch3_motion.js +++ b/src/blocks/scratch3_motion.js @@ -35,11 +35,12 @@ class Scratch3MotionBlocks { motion_xposition: this.getX, motion_yposition: this.getY, motion_direction: this.getDirection, - motion_scroll_right: this.doNothing, - motion_scroll_up: this.doNothing, - motion_align_scene: this.doNothing, - motion_xscroll: this.doNothing, - motion_yscroll: this.doNothing + // Legacy no-op blocks: + motion_scroll_right: () => {}, + motion_scroll_up: () => {}, + motion_align_scene: () => {}, + motion_xscroll: () => {}, + motion_yscroll: () => {} }; } @@ -259,8 +260,6 @@ class Scratch3MotionBlocks { getDirection (args, util) { return util.target.direction; } - - doNothing () {} } module.exports = Scratch3MotionBlocks;