@blockdia/scratch-blocks 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.nvmrc +1 -0
- package/LICENSE +674 -0
- package/README.md +57 -0
- package/TRADEMARK +1 -0
- package/blockly_compressed_horizontal.js +2268 -0
- package/blockly_compressed_vertical.js +2296 -0
- package/blockly_uncompressed_horizontal.js +1212 -0
- package/blockly_uncompressed_vertical.js +1212 -0
- package/blocks_common/colour.js +61 -0
- package/blocks_common/math.js +159 -0
- package/blocks_common/matrix.js +54 -0
- package/blocks_common/note.js +58 -0
- package/blocks_common/text.js +57 -0
- package/blocks_compressed.js +37 -0
- package/blocks_compressed_horizontal.js +68 -0
- package/blocks_compressed_vertical.js +216 -0
- package/blocks_horizontal/control.js +212 -0
- package/blocks_horizontal/default_toolbox.js +139 -0
- package/blocks_horizontal/event.js +190 -0
- package/blocks_horizontal/wedo.js +325 -0
- package/blocks_vertical/control.js +532 -0
- package/blocks_vertical/data.js +666 -0
- package/blocks_vertical/default_toolbox.js +571 -0
- package/blocks_vertical/event.js +329 -0
- package/blocks_vertical/extensions.js +294 -0
- package/blocks_vertical/looks.js +591 -0
- package/blocks_vertical/motion.js +587 -0
- package/blocks_vertical/operators.js +470 -0
- package/blocks_vertical/procedures.js +1051 -0
- package/blocks_vertical/sensing.js +555 -0
- package/blocks_vertical/sound.js +246 -0
- package/blocks_vertical/vertical_extensions.js +289 -0
- package/build/gen_blocks.js +1 -0
- package/build/test_expect.js +1 -0
- package/build/test_input.js +1 -0
- package/build.py +647 -0
- package/cleanup.sh +101 -0
- package/core/block.js +1837 -0
- package/core/block_animations.js +107 -0
- package/core/block_drag_surface.js +299 -0
- package/core/block_dragger.js +424 -0
- package/core/block_events.js +531 -0
- package/core/block_render_svg_horizontal.js +892 -0
- package/core/block_render_svg_vertical.js +1734 -0
- package/core/block_svg.js +1355 -0
- package/core/blockly.js +620 -0
- package/core/blocks.js +37 -0
- package/core/bubble.js +664 -0
- package/core/bubble_dragger.js +285 -0
- package/core/colours.js +177 -0
- package/core/comment.js +293 -0
- package/core/comment_events.js +539 -0
- package/core/connection.js +776 -0
- package/core/connection_db.js +300 -0
- package/core/constants.js +408 -0
- package/core/contextmenu.js +534 -0
- package/core/css.js +1354 -0
- package/core/data_category.js +490 -0
- package/core/dragged_connection_manager.js +260 -0
- package/core/dropdowndiv.js +408 -0
- package/core/events.js +429 -0
- package/core/events_abstract.js +113 -0
- package/core/extensions.js +450 -0
- package/core/field.js +810 -0
- package/core/field_angle.js +410 -0
- package/core/field_checkbox.js +133 -0
- package/core/field_colour.js +253 -0
- package/core/field_colour_slider.js +387 -0
- package/core/field_date.js +353 -0
- package/core/field_dropdown.js +447 -0
- package/core/field_iconmenu.js +309 -0
- package/core/field_image.js +200 -0
- package/core/field_label.js +136 -0
- package/core/field_label_serializable.js +125 -0
- package/core/field_matrix.js +566 -0
- package/core/field_note.js +850 -0
- package/core/field_number.js +366 -0
- package/core/field_numberdropdown.js +77 -0
- package/core/field_textdropdown.js +164 -0
- package/core/field_textinput.js +675 -0
- package/core/field_textinput_removable.js +105 -0
- package/core/field_variable.js +385 -0
- package/core/field_variable_getter.js +185 -0
- package/core/field_vertical_separator.js +161 -0
- package/core/flyout_base.js +935 -0
- package/core/flyout_button.js +324 -0
- package/core/flyout_dragger.js +83 -0
- package/core/flyout_extension_category_header.js +159 -0
- package/core/flyout_horizontal.js +475 -0
- package/core/flyout_vertical.js +770 -0
- package/core/generator.js +426 -0
- package/core/gesture.js +1010 -0
- package/core/grid.js +227 -0
- package/core/icon.js +205 -0
- package/core/inject.js +496 -0
- package/core/input.js +285 -0
- package/core/insertion_marker_manager.js +678 -0
- package/core/intersection_observer.js +102 -0
- package/core/msg.js +62 -0
- package/core/mutator.js +426 -0
- package/core/names.js +198 -0
- package/core/options.js +244 -0
- package/core/procedures.js +739 -0
- package/core/rendered_connection.js +417 -0
- package/core/scratch_block_comment.js +646 -0
- package/core/scratch_blocks_utils.js +246 -0
- package/core/scratch_bubble.js +699 -0
- package/core/scratch_events.js +131 -0
- package/core/scratch_msgs.js +85 -0
- package/core/scrollbar.js +875 -0
- package/core/toolbox.js +803 -0
- package/core/tooltip.js +337 -0
- package/core/touch.js +226 -0
- package/core/trashcan.js +343 -0
- package/core/ui_events.js +91 -0
- package/core/ui_menu_utils.js +68 -0
- package/core/utils.js +825 -0
- package/core/variable_events.js +259 -0
- package/core/variable_map.js +415 -0
- package/core/variable_model.js +116 -0
- package/core/variables.js +674 -0
- package/core/warning.js +199 -0
- package/core/widgetdiv.js +344 -0
- package/core/workspace.js +673 -0
- package/core/workspace_audio.js +170 -0
- package/core/workspace_comment.js +426 -0
- package/core/workspace_comment_render_svg.js +706 -0
- package/core/workspace_comment_svg.js +609 -0
- package/core/workspace_drag_surface_svg.js +195 -0
- package/core/workspace_dragger.js +132 -0
- package/core/workspace_svg.js +2382 -0
- package/core/xml.js +930 -0
- package/core/zoom_controls.js +301 -0
- package/dist/horizontal.js +222 -0
- package/dist/vertical.js +222 -0
- package/dist/web/horizontal.js +232 -0
- package/dist/web/vertical.js +232 -0
- package/i18n/common.py +234 -0
- package/i18n/create_messages.py +162 -0
- package/i18n/create_scratch_msgs.js +69 -0
- package/i18n/dedup_json.py +73 -0
- package/i18n/js_to_json.js +46 -0
- package/i18n/js_to_json.py +136 -0
- package/i18n/json_to_js.js +52 -0
- package/i18n/json_to_js.py +185 -0
- package/i18n/sync_tx_translations.js +111 -0
- package/i18n/test_scratch_msgs.js +87 -0
- package/i18n/tests.py +47 -0
- package/i18n/xliff_to_json.py +232 -0
- package/local_build.sh +70 -0
- package/media/click.mp3 +0 -0
- package/media/click.ogg +0 -0
- package/media/click.wav +0 -0
- package/media/comment-arrow-down.svg +10 -0
- package/media/comment-arrow-up.svg +10 -0
- package/media/delete-x.svg +10 -0
- package/media/delete.mp3 +0 -0
- package/media/delete.ogg +0 -0
- package/media/delete.wav +0 -0
- package/media/dropdown-arrow-dark.svg +1 -0
- package/media/dropdown-arrow.svg +1 -0
- package/media/extensions/microbit-block-icon.svg +130 -0
- package/media/extensions/music-block-icon.svg +17 -0
- package/media/extensions/pen-block-icon.svg +19 -0
- package/media/extensions/wedo2-block-icon.svg +36 -0
- package/media/eyedropper.svg +22 -0
- package/media/green-flag.svg +17 -0
- package/media/handclosed.cur +0 -0
- package/media/handdelete.cur +0 -0
- package/media/handopen.cur +0 -0
- package/media/icons/arrow.svg +12 -0
- package/media/icons/arrow_button.svg +1 -0
- package/media/icons/control_forever.svg +1 -0
- package/media/icons/control_repeat.svg +1 -0
- package/media/icons/control_stop.svg +1 -0
- package/media/icons/control_wait.svg +1 -0
- package/media/icons/event_broadcast_blue.svg +1 -0
- package/media/icons/event_broadcast_coral.svg +1 -0
- package/media/icons/event_broadcast_green.svg +1 -0
- package/media/icons/event_broadcast_magenta.svg +1 -0
- package/media/icons/event_broadcast_orange.svg +1 -0
- package/media/icons/event_broadcast_purple.svg +1 -0
- package/media/icons/event_when-broadcast-received_blue.svg +1 -0
- package/media/icons/event_when-broadcast-received_coral.svg +1 -0
- package/media/icons/event_when-broadcast-received_green.svg +1 -0
- package/media/icons/event_when-broadcast-received_magenta.svg +1 -0
- package/media/icons/event_when-broadcast-received_orange.svg +1 -0
- package/media/icons/event_when-broadcast-received_purple.svg +1 -0
- package/media/icons/event_whenflagclicked.svg +1 -0
- package/media/icons/remove.svg +19 -0
- package/media/icons/set-led_blue.svg +1 -0
- package/media/icons/set-led_coral.svg +1 -0
- package/media/icons/set-led_green.svg +1 -0
- package/media/icons/set-led_magenta.svg +1 -0
- package/media/icons/set-led_mystery.svg +1 -0
- package/media/icons/set-led_orange.svg +1 -0
- package/media/icons/set-led_purple.svg +1 -0
- package/media/icons/set-led_white.svg +1 -0
- package/media/icons/set-led_yellow.svg +1 -0
- package/media/icons/wedo_motor-clockwise.svg +1 -0
- package/media/icons/wedo_motor-counterclockwise.svg +1 -0
- package/media/icons/wedo_motor-speed_fast.svg +1 -0
- package/media/icons/wedo_motor-speed_med.svg +1 -0
- package/media/icons/wedo_motor-speed_slow.svg +1 -0
- package/media/icons/wedo_when-distance_close.svg +1 -0
- package/media/icons/wedo_when-tilt-backward.svg +1 -0
- package/media/icons/wedo_when-tilt-forward.svg +1 -0
- package/media/icons/wedo_when-tilt-left.svg +1 -0
- package/media/icons/wedo_when-tilt-right.svg +1 -0
- package/media/icons/wedo_when-tilt.svg +1 -0
- package/media/repeat.svg +18 -0
- package/media/rotate-left.svg +1 -0
- package/media/rotate-right.svg +1 -0
- package/media/sprites.png +0 -0
- package/media/status-not-ready.svg +13 -0
- package/media/status-ready.svg +13 -0
- package/media/zoom-in.svg +1 -0
- package/media/zoom-out.svg +1 -0
- package/media/zoom-reset.svg +1 -0
- package/msg/js/en.js +290 -0
- package/msg/json/en.json +285 -0
- package/msg/messages.js +359 -0
- package/msg/scratch_msgs.js +22969 -0
- package/package.json +60 -0
- package/pull_from_blockly.sh +151 -0
- package/renovate.json5 +15 -0
- package/shim/blockly_compressed_horizontal-blocks_compressed.js +1 -0
- package/shim/blockly_compressed_horizontal.Blockly.js +1 -0
- package/shim/blockly_compressed_horizontal.goog.js +1 -0
- package/shim/blockly_compressed_horizontal.js +1 -0
- package/shim/blockly_compressed_vertical-blocks_compressed.js +1 -0
- package/shim/blockly_compressed_vertical.Blockly.js +1 -0
- package/shim/blockly_compressed_vertical.goog.js +1 -0
- package/shim/blockly_compressed_vertical.js +1 -0
- package/shim/blocks_compressed_horizontal-blockly_compressed_horizontal-messages.js +1 -0
- package/shim/blocks_compressed_horizontal.js +1 -0
- package/shim/blocks_compressed_vertical-blockly_compressed_vertical-messages.js +1 -0
- package/shim/blocks_compressed_vertical.js +1 -0
- package/shim/gh-pages.js +1 -0
- package/shim/horizontal.js +1 -0
- package/shim/index.js +17 -0
- package/shim/vertical.js +1 -0
- package/universal-python.js +82 -0
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Visual Blocks Editor
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2016 Massachusetts Institute of Technology
|
|
6
|
+
* All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
'use strict';
|
|
22
|
+
|
|
23
|
+
goog.provide('Blockly.Blocks.sensing');
|
|
24
|
+
|
|
25
|
+
goog.require('Blockly.Blocks');
|
|
26
|
+
goog.require('Blockly.Colours');
|
|
27
|
+
goog.require('Blockly.constants');
|
|
28
|
+
goog.require('Blockly.ScratchBlocks.VerticalExtensions');
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Blockly.Blocks['sensing_touchingobject'] = {
|
|
32
|
+
/**
|
|
33
|
+
* Block to Report if its touching a Object.
|
|
34
|
+
* @this Blockly.Block
|
|
35
|
+
*/
|
|
36
|
+
init: function() {
|
|
37
|
+
this.jsonInit({
|
|
38
|
+
"message0": Blockly.Msg.SENSING_TOUCHINGOBJECT,
|
|
39
|
+
"args0": [
|
|
40
|
+
{
|
|
41
|
+
"type": "input_value",
|
|
42
|
+
"name": "TOUCHINGOBJECTMENU"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"category": Blockly.Categories.sensing,
|
|
46
|
+
"extensions": ["colours_sensing", "output_boolean"]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
Blockly.Blocks['sensing_touchingobjectmenu'] = {
|
|
52
|
+
/**
|
|
53
|
+
* "Touching [Object]" Block Menu.
|
|
54
|
+
* @this Blockly.Block
|
|
55
|
+
*/
|
|
56
|
+
init: function() {
|
|
57
|
+
this.jsonInit({
|
|
58
|
+
"message0": "%1",
|
|
59
|
+
"args0": [
|
|
60
|
+
{
|
|
61
|
+
"type": "field_dropdown",
|
|
62
|
+
"name": "TOUCHINGOBJECTMENU",
|
|
63
|
+
"options": [
|
|
64
|
+
[Blockly.Msg.SENSING_TOUCHINGOBJECT_POINTER, '_mouse_'],
|
|
65
|
+
[Blockly.Msg.SENSING_TOUCHINGOBJECT_EDGE, '_edge_']
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"extensions": ["colours_sensing", "output_string"]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
Blockly.Blocks['sensing_touchingcolor'] = {
|
|
75
|
+
/**
|
|
76
|
+
* Block to Report if its touching a certain Color.
|
|
77
|
+
* @this Blockly.Block
|
|
78
|
+
*/
|
|
79
|
+
init: function() {
|
|
80
|
+
this.jsonInit({
|
|
81
|
+
"message0": Blockly.Msg.SENSING_TOUCHINGCOLOR,
|
|
82
|
+
"args0": [
|
|
83
|
+
{
|
|
84
|
+
"type": "input_value",
|
|
85
|
+
"name": "COLOR"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"category": Blockly.Categories.sensing,
|
|
89
|
+
"extensions": ["colours_sensing", "output_boolean"]
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
Blockly.Blocks['sensing_coloristouchingcolor'] = {
|
|
95
|
+
/**
|
|
96
|
+
* Block to Report if a color is touching a certain Color.
|
|
97
|
+
* @this Blockly.Block
|
|
98
|
+
*/
|
|
99
|
+
init: function() {
|
|
100
|
+
this.jsonInit({
|
|
101
|
+
"message0": Blockly.Msg.SENSING_COLORISTOUCHINGCOLOR,
|
|
102
|
+
"args0": [
|
|
103
|
+
{
|
|
104
|
+
"type": "input_value",
|
|
105
|
+
"name": "COLOR"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"type": "input_value",
|
|
109
|
+
"name": "COLOR2"
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"category": Blockly.Categories.sensing,
|
|
113
|
+
"extensions": ["colours_sensing", "output_boolean"]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
Blockly.Blocks['sensing_distanceto'] = {
|
|
119
|
+
/**
|
|
120
|
+
* Block to Report distance to another Object.
|
|
121
|
+
* @this Blockly.Block
|
|
122
|
+
*/
|
|
123
|
+
init: function() {
|
|
124
|
+
this.jsonInit({
|
|
125
|
+
"message0": Blockly.Msg.SENSING_DISTANCETO,
|
|
126
|
+
"args0": [
|
|
127
|
+
{
|
|
128
|
+
"type": "input_value",
|
|
129
|
+
"name": "DISTANCETOMENU"
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"category": Blockly.Categories.sensing,
|
|
133
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
Blockly.Blocks['sensing_distancetomenu'] = {
|
|
139
|
+
/**
|
|
140
|
+
* "Distance to [Object]" Block Menu.
|
|
141
|
+
* @this Blockly.Block
|
|
142
|
+
*/
|
|
143
|
+
init: function() {
|
|
144
|
+
this.jsonInit({
|
|
145
|
+
"message0": "%1",
|
|
146
|
+
"args0": [
|
|
147
|
+
{
|
|
148
|
+
"type": "field_dropdown",
|
|
149
|
+
"name": "DISTANCETOMENU",
|
|
150
|
+
"options": [
|
|
151
|
+
[Blockly.Msg.SENSING_DISTANCETO_POINTER, '_mouse_']
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
],
|
|
155
|
+
"extensions": ["colours_sensing", "output_string"]
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
Blockly.Blocks['sensing_askandwait'] = {
|
|
161
|
+
/**
|
|
162
|
+
* Block to ask a question and wait
|
|
163
|
+
* @this Blockly.Block
|
|
164
|
+
*/
|
|
165
|
+
init: function() {
|
|
166
|
+
this.jsonInit({
|
|
167
|
+
"message0": Blockly.Msg.SENSING_ASKANDWAIT,
|
|
168
|
+
"args0": [
|
|
169
|
+
{
|
|
170
|
+
"type": "input_value",
|
|
171
|
+
"name": "QUESTION"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"category": Blockly.Categories.sensing,
|
|
175
|
+
"extensions": ["colours_sensing", "shape_statement"]
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
Blockly.Blocks['sensing_answer'] = {
|
|
181
|
+
/**
|
|
182
|
+
* Block to report answer
|
|
183
|
+
* @this Blockly.Block
|
|
184
|
+
*/
|
|
185
|
+
init: function() {
|
|
186
|
+
this.jsonInit({
|
|
187
|
+
"message0": Blockly.Msg.SENSING_ANSWER,
|
|
188
|
+
"category": Blockly.Categories.sensing,
|
|
189
|
+
"checkboxInFlyout": true,
|
|
190
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
Blockly.Blocks['sensing_keypressed'] = {
|
|
196
|
+
/**
|
|
197
|
+
* Block to Report if a key is pressed.
|
|
198
|
+
* @this Blockly.Block
|
|
199
|
+
*/
|
|
200
|
+
init: function() {
|
|
201
|
+
this.jsonInit({
|
|
202
|
+
"message0": Blockly.Msg.SENSING_KEYPRESSED,
|
|
203
|
+
"args0": [
|
|
204
|
+
{
|
|
205
|
+
"type": "input_value",
|
|
206
|
+
"name": "KEY_OPTION"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"category": Blockly.Categories.sensing,
|
|
210
|
+
"extensions": ["colours_sensing", "output_boolean"]
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
Blockly.Blocks['sensing_keyoptions'] = {
|
|
216
|
+
/**
|
|
217
|
+
* Options for Keys
|
|
218
|
+
* @this Blockly.Block
|
|
219
|
+
*/
|
|
220
|
+
init: function() {
|
|
221
|
+
this.jsonInit({
|
|
222
|
+
"message0": "%1",
|
|
223
|
+
"args0": [
|
|
224
|
+
{
|
|
225
|
+
"type": "field_dropdown",
|
|
226
|
+
"name": "KEY_OPTION",
|
|
227
|
+
"options": [
|
|
228
|
+
[Blockly.Msg.EVENT_WHENKEYPRESSED_SPACE, 'space'],
|
|
229
|
+
[Blockly.Msg.EVENT_WHENKEYPRESSED_UP, 'up arrow'],
|
|
230
|
+
[Blockly.Msg.EVENT_WHENKEYPRESSED_DOWN, 'down arrow'],
|
|
231
|
+
[Blockly.Msg.EVENT_WHENKEYPRESSED_RIGHT, 'right arrow'],
|
|
232
|
+
[Blockly.Msg.EVENT_WHENKEYPRESSED_LEFT, 'left arrow'],
|
|
233
|
+
[Blockly.Msg.EVENT_WHENKEYPRESSED_ANY, 'any'],
|
|
234
|
+
['a', 'a'],
|
|
235
|
+
['b', 'b'],
|
|
236
|
+
['c', 'c'],
|
|
237
|
+
['d', 'd'],
|
|
238
|
+
['e', 'e'],
|
|
239
|
+
['f', 'f'],
|
|
240
|
+
['g', 'g'],
|
|
241
|
+
['h', 'h'],
|
|
242
|
+
['i', 'i'],
|
|
243
|
+
['j', 'j'],
|
|
244
|
+
['k', 'k'],
|
|
245
|
+
['l', 'l'],
|
|
246
|
+
['m', 'm'],
|
|
247
|
+
['n', 'n'],
|
|
248
|
+
['o', 'o'],
|
|
249
|
+
['p', 'p'],
|
|
250
|
+
['q', 'q'],
|
|
251
|
+
['r', 'r'],
|
|
252
|
+
['s', 's'],
|
|
253
|
+
['t', 't'],
|
|
254
|
+
['u', 'u'],
|
|
255
|
+
['v', 'v'],
|
|
256
|
+
['w', 'w'],
|
|
257
|
+
['x', 'x'],
|
|
258
|
+
['y', 'y'],
|
|
259
|
+
['z', 'z'],
|
|
260
|
+
['0', '0'],
|
|
261
|
+
['1', '1'],
|
|
262
|
+
['2', '2'],
|
|
263
|
+
['3', '3'],
|
|
264
|
+
['4', '4'],
|
|
265
|
+
['5', '5'],
|
|
266
|
+
['6', '6'],
|
|
267
|
+
['7', '7'],
|
|
268
|
+
['8', '8'],
|
|
269
|
+
['9', '9']
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"extensions": ["colours_sensing", "output_string"]
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
Blockly.Blocks['sensing_mousedown'] = {
|
|
279
|
+
/**
|
|
280
|
+
* Block to Report if the mouse is down.
|
|
281
|
+
* @this Blockly.Block
|
|
282
|
+
*/
|
|
283
|
+
init: function() {
|
|
284
|
+
this.jsonInit({
|
|
285
|
+
"message0": Blockly.Msg.SENSING_MOUSEDOWN,
|
|
286
|
+
"category": Blockly.Categories.sensing,
|
|
287
|
+
"checkboxInFlyout": true,
|
|
288
|
+
"extensions": ["colours_sensing", "output_boolean"]
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
Blockly.Blocks['sensing_mousex'] = {
|
|
294
|
+
/**
|
|
295
|
+
* Block to report mouse's x position
|
|
296
|
+
* @this Blockly.Block
|
|
297
|
+
*/
|
|
298
|
+
init: function() {
|
|
299
|
+
this.jsonInit({
|
|
300
|
+
"message0": Blockly.Msg.SENSING_MOUSEX,
|
|
301
|
+
"category": Blockly.Categories.sensing,
|
|
302
|
+
"checkboxInFlyout": true,
|
|
303
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
Blockly.Blocks['sensing_mousey'] = {
|
|
309
|
+
/**
|
|
310
|
+
* Block to report mouse's y position
|
|
311
|
+
* @this Blockly.Block
|
|
312
|
+
*/
|
|
313
|
+
init: function() {
|
|
314
|
+
this.jsonInit({
|
|
315
|
+
"message0": Blockly.Msg.SENSING_MOUSEY,
|
|
316
|
+
"category": Blockly.Categories.sensing,
|
|
317
|
+
"checkboxInFlyout": true,
|
|
318
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
Blockly.Blocks['sensing_setdragmode'] = {
|
|
324
|
+
/**
|
|
325
|
+
* Block to set drag mode.
|
|
326
|
+
* @this Blockly.Block
|
|
327
|
+
*/
|
|
328
|
+
init: function() {
|
|
329
|
+
this.jsonInit({
|
|
330
|
+
"message0": Blockly.Msg.SENSING_SETDRAGMODE,
|
|
331
|
+
"args0": [
|
|
332
|
+
{
|
|
333
|
+
"type": "field_dropdown",
|
|
334
|
+
"name": "DRAG_MODE",
|
|
335
|
+
"options": [
|
|
336
|
+
[Blockly.Msg.SENSING_SETDRAGMODE_DRAGGABLE, 'draggable'],
|
|
337
|
+
[Blockly.Msg.SENSING_SETDRAGMODE_NOTDRAGGABLE, 'not draggable']
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
"category": Blockly.Categories.sensing,
|
|
342
|
+
"extensions": ["colours_sensing", "shape_statement"]
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
Blockly.Blocks['sensing_loudness'] = {
|
|
348
|
+
/**
|
|
349
|
+
* Block to report loudness
|
|
350
|
+
* @this Blockly.Block
|
|
351
|
+
*/
|
|
352
|
+
init: function() {
|
|
353
|
+
this.jsonInit({
|
|
354
|
+
"message0": Blockly.Msg.SENSING_LOUDNESS,
|
|
355
|
+
"category": Blockly.Categories.sensing,
|
|
356
|
+
"checkboxInFlyout": true,
|
|
357
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
Blockly.Blocks['sensing_loud'] = {
|
|
363
|
+
/**
|
|
364
|
+
* Block to report if the loudness is "loud" (greater than 10). This is an
|
|
365
|
+
* obsolete block that is implemented for compatibility with Scratch 2.0 and
|
|
366
|
+
* 1.4 projects.
|
|
367
|
+
* @this Blockly.Block
|
|
368
|
+
*/
|
|
369
|
+
init: function() {
|
|
370
|
+
this.jsonInit({
|
|
371
|
+
"message0": Blockly.Msg.SENSING_LOUD,
|
|
372
|
+
"category": Blockly.Categories.sensing,
|
|
373
|
+
"extensions": ["colours_sensing", "output_boolean"]
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
Blockly.Blocks['sensing_timer'] = {
|
|
379
|
+
/**
|
|
380
|
+
* Block to report timer
|
|
381
|
+
* @this Blockly.Block
|
|
382
|
+
*/
|
|
383
|
+
init: function() {
|
|
384
|
+
this.jsonInit({
|
|
385
|
+
"message0": Blockly.Msg.SENSING_TIMER,
|
|
386
|
+
"category": Blockly.Categories.sensing,
|
|
387
|
+
"checkboxInFlyout": true,
|
|
388
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
Blockly.Blocks['sensing_resettimer'] = {
|
|
394
|
+
/**
|
|
395
|
+
* Block to reset timer
|
|
396
|
+
* @this Blockly.Block
|
|
397
|
+
*/
|
|
398
|
+
init: function() {
|
|
399
|
+
this.jsonInit({
|
|
400
|
+
"message0": Blockly.Msg.SENSING_RESETTIMER,
|
|
401
|
+
"category": Blockly.Categories.sensing,
|
|
402
|
+
"extensions": ["colours_sensing", "shape_statement"]
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
Blockly.Blocks['sensing_of_object_menu'] = {
|
|
408
|
+
/**
|
|
409
|
+
* "* of _" object menu.
|
|
410
|
+
* @this Blockly.Block
|
|
411
|
+
*/
|
|
412
|
+
init: function() {
|
|
413
|
+
this.jsonInit({
|
|
414
|
+
"message0": "%1",
|
|
415
|
+
"args0": [
|
|
416
|
+
{
|
|
417
|
+
"type": "field_dropdown",
|
|
418
|
+
"name": "OBJECT",
|
|
419
|
+
"options": [
|
|
420
|
+
['Sprite1', 'Sprite1'],
|
|
421
|
+
['Stage', '_stage_']
|
|
422
|
+
]
|
|
423
|
+
}
|
|
424
|
+
],
|
|
425
|
+
"category": Blockly.Categories.sensing,
|
|
426
|
+
"extensions": ["colours_sensing", "output_string"]
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
Blockly.Blocks['sensing_of'] = {
|
|
433
|
+
/**
|
|
434
|
+
* Block to report properties of sprites.
|
|
435
|
+
* @this Blockly.Block
|
|
436
|
+
*/
|
|
437
|
+
init: function() {
|
|
438
|
+
this.jsonInit({
|
|
439
|
+
"message0": Blockly.Msg.SENSING_OF,
|
|
440
|
+
"args0": [
|
|
441
|
+
{
|
|
442
|
+
"type": "field_dropdown",
|
|
443
|
+
"name": "PROPERTY",
|
|
444
|
+
"options": [
|
|
445
|
+
[Blockly.Msg.SENSING_OF_XPOSITION, 'x position'],
|
|
446
|
+
[Blockly.Msg.SENSING_OF_YPOSITION, 'y position'],
|
|
447
|
+
[Blockly.Msg.SENSING_OF_DIRECTION, 'direction'],
|
|
448
|
+
[Blockly.Msg.SENSING_OF_COSTUMENUMBER, 'costume #'],
|
|
449
|
+
[Blockly.Msg.SENSING_OF_COSTUMENAME, 'costume name'],
|
|
450
|
+
[Blockly.Msg.SENSING_OF_SIZE, 'size'],
|
|
451
|
+
[Blockly.Msg.SENSING_OF_VOLUME, 'volume'],
|
|
452
|
+
[Blockly.Msg.SENSING_OF_BACKDROPNUMBER, 'backdrop #'],
|
|
453
|
+
[Blockly.Msg.SENSING_OF_BACKDROPNAME, 'backdrop name']
|
|
454
|
+
]
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"type": "input_value",
|
|
458
|
+
"name": "OBJECT"
|
|
459
|
+
}
|
|
460
|
+
],
|
|
461
|
+
"output": true,
|
|
462
|
+
"category": Blockly.Categories.sensing,
|
|
463
|
+
"outputShape": Blockly.OUTPUT_SHAPE_ROUND,
|
|
464
|
+
"extensions": ["colours_sensing"]
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
Blockly.Blocks['sensing_current'] = {
|
|
470
|
+
/**
|
|
471
|
+
* Block to Report the current option.
|
|
472
|
+
* @this Blockly.Block
|
|
473
|
+
*/
|
|
474
|
+
init: function() {
|
|
475
|
+
this.jsonInit({
|
|
476
|
+
"message0": Blockly.Msg.SENSING_CURRENT,
|
|
477
|
+
"args0": [
|
|
478
|
+
{
|
|
479
|
+
"type": "field_dropdown",
|
|
480
|
+
"name": "CURRENTMENU",
|
|
481
|
+
"options": [
|
|
482
|
+
[Blockly.Msg.SENSING_CURRENT_YEAR, 'YEAR'],
|
|
483
|
+
[Blockly.Msg.SENSING_CURRENT_MONTH, 'MONTH'],
|
|
484
|
+
[Blockly.Msg.SENSING_CURRENT_DATE, 'DATE'],
|
|
485
|
+
[Blockly.Msg.SENSING_CURRENT_DAYOFWEEK, 'DAYOFWEEK'],
|
|
486
|
+
[Blockly.Msg.SENSING_CURRENT_HOUR, 'HOUR'],
|
|
487
|
+
[Blockly.Msg.SENSING_CURRENT_MINUTE, 'MINUTE'],
|
|
488
|
+
[Blockly.Msg.SENSING_CURRENT_SECOND, 'SECOND']
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
],
|
|
492
|
+
"category": Blockly.Categories.sensing,
|
|
493
|
+
"checkboxInFlyout": true,
|
|
494
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
Blockly.Blocks['sensing_dayssince2000'] = {
|
|
500
|
+
/**
|
|
501
|
+
* Block to report days since 2000
|
|
502
|
+
* @this Blockly.Block
|
|
503
|
+
*/
|
|
504
|
+
init: function() {
|
|
505
|
+
this.jsonInit({
|
|
506
|
+
"message0": Blockly.Msg.SENSING_DAYSSINCE2000,
|
|
507
|
+
"category": Blockly.Categories.sensing,
|
|
508
|
+
"checkboxInFlyout": true,
|
|
509
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
Blockly.Blocks['sensing_username'] = {
|
|
515
|
+
/**
|
|
516
|
+
* Block to report user's username
|
|
517
|
+
* @this Blockly.Block
|
|
518
|
+
*/
|
|
519
|
+
init: function() {
|
|
520
|
+
this.jsonInit({
|
|
521
|
+
"message0": Blockly.Msg.SENSING_USERNAME,
|
|
522
|
+
"category": Blockly.Categories.sensing,
|
|
523
|
+
"checkboxInFlyout": true,
|
|
524
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
Blockly.Blocks['sensing_userid'] = {
|
|
530
|
+
/**
|
|
531
|
+
* Block to report user's ID. Does not actually do anything. This is an
|
|
532
|
+
* obsolete block that is implemented for compatibility with Scratch 2.0
|
|
533
|
+
* projects.
|
|
534
|
+
* @this Blockly.Block
|
|
535
|
+
*/
|
|
536
|
+
init: function() {
|
|
537
|
+
this.jsonInit({
|
|
538
|
+
"message0": Blockly.Msg.SENSING_USERID,
|
|
539
|
+
"category": Blockly.Categories.sensing,
|
|
540
|
+
"extensions": ["colours_sensing", "output_number"]
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
Blockly.Blocks['sensing_online'] = {
|
|
546
|
+
init: function() {
|
|
547
|
+
this.jsonInit({
|
|
548
|
+
// TODO: we need infrastructure to translate new blockly strings
|
|
549
|
+
"message0": "online?",
|
|
550
|
+
"category": Blockly.Categories.sensing,
|
|
551
|
+
"checkboxInFlyout": true,
|
|
552
|
+
"extensions": ["colours_sensing", "output_boolean"]
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
};
|