Skip to content

Commit

Permalink
fix: readd the control blocks (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonfunko authored Apr 17, 2024
1 parent 4de530f commit f69d4ac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 33 deletions.
60 changes: 27 additions & 33 deletions blocks_vertical/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@
* limitations under the License.
*/

'use strict';

goog.provide('Blockly.Blocks.control');

goog.require('Blockly.Blocks');
goog.require('Blockly.Colours');
goog.require('Blockly.ScratchBlocks.VerticalExtensions');

import * as Blockly from 'blockly/core';
import {Categories} from '../src/categories.js';
import {Colours} from '../core/colours.js';

Blockly.Blocks['control_forever'] = {
/**
Expand All @@ -49,14 +44,14 @@ Blockly.Blocks['control_forever'] = {
"args2": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "repeat.svg",
"src": Blockly.getMainWorkspace().options.pathToMedia + "repeat.svg",
"width": 24,
"height": 24,
"alt": "*",
"flip_rtl": true
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_end"]
});
}
Expand Down Expand Up @@ -90,14 +85,14 @@ Blockly.Blocks['control_repeat'] = {
"args2": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "repeat.svg",
"src": Blockly.getMainWorkspace().options.pathToMedia + "repeat.svg",
"width": 24,
"height": 24,
"alt": "*",
"flip_rtl": true
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand Down Expand Up @@ -126,7 +121,7 @@ Blockly.Blocks['control_if'] = {
"name": "SUBSTACK"
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand Down Expand Up @@ -163,7 +158,7 @@ Blockly.Blocks['control_if_else'] = {
"name": "SUBSTACK2"
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand Down Expand Up @@ -206,11 +201,10 @@ Blockly.Blocks['control_stop'] = {
this.appendDummyInput()
.appendField(Blockly.Msg.CONTROL_STOP)
.appendField(stopDropdown, 'STOP_OPTION');
this.setCategory(Blockly.Categories.control);
this.setColour(Blockly.Colours.control.primary,
Blockly.Colours.control.secondary,
Blockly.Colours.control.tertiary,
Blockly.Colours.control.quaternary
this.setColour(Colours.control.primary,
Colours.control.secondary,
Colours.control.tertiary,
Colours.control.quaternary
);
this.setPreviousStatement(true);
},
Expand Down Expand Up @@ -240,7 +234,7 @@ Blockly.Blocks['control_wait'] = {
"name": "DURATION"
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand All @@ -261,7 +255,7 @@ Blockly.Blocks['control_wait_until'] = {
"check": "Boolean"
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand Down Expand Up @@ -294,14 +288,14 @@ Blockly.Blocks['control_repeat_until'] = {
"args2": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "repeat.svg",
"src": Blockly.getMainWorkspace().options.pathToMedia + "repeat.svg",
"width": 24,
"height": 24,
"alt": "*",
"flip_rtl": true
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand Down Expand Up @@ -334,14 +328,14 @@ Blockly.Blocks['control_while'] = {
"args2": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "repeat.svg",
"src": Blockly.getMainWorkspace().options.pathToMedia + "repeat.svg",
"width": 24,
"height": 24,
"alt": "*",
"flip_rtl": true
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand Down Expand Up @@ -374,7 +368,7 @@ Blockly.Blocks['control_for_each'] = {
"name": "SUBSTACK"
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand All @@ -391,7 +385,7 @@ Blockly.Blocks['control_start_as_clone'] = {
"message0": Blockly.Msg.CONTROL_STARTASCLONE,
"args0": [
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_hat"]
});
}
Expand Down Expand Up @@ -434,7 +428,7 @@ Blockly.Blocks['control_create_clone_of'] = {
"name": "CLONE_OPTION"
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand All @@ -450,7 +444,7 @@ Blockly.Blocks['control_delete_this_clone'] = {
"message0": Blockly.Msg.CONTROL_DELETETHISCLONE,
"args0": [
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_end"]
});
}
Expand All @@ -465,7 +459,7 @@ Blockly.Blocks['control_get_counter'] = {
init: function() {
this.jsonInit({
"message0": Blockly.Msg.CONTROL_COUNTER,
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "output_number"]
});
}
Expand All @@ -480,7 +474,7 @@ Blockly.Blocks['control_incr_counter'] = {
init: function() {
this.jsonInit({
"message0": Blockly.Msg.CONTROL_INCRCOUNTER,
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand All @@ -495,7 +489,7 @@ Blockly.Blocks['control_clear_counter'] = {
init: function() {
this.jsonInit({
"message0": Blockly.Msg.CONTROL_CLEARCOUNTER,
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand Down Expand Up @@ -525,7 +519,7 @@ Blockly.Blocks['control_all_at_once'] = {
"name": "SUBSTACK"
}
],
"category": Blockly.Categories.control,
"category": Categories.control,
"extensions": ["colours_control", "shape_statement"]
});
}
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import '../blocks_common/math.js';
import '../blocks_vertical/vertical_extensions.js';
import '../blocks_vertical/control.js';
import '../blocks_vertical/event.js';
import '../blocks_vertical/motion.js';
import '../blocks_vertical/operators.js';
Expand Down

0 comments on commit f69d4ac

Please sign in to comment.