scratch-blocks 2.0.2 → 2.0.3
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/commitlint.config.js +2 -2
- package/dist/main.mjs +1 -2
- package/dist/types/msg/scratch_msgs.d.ts.map +1 -1
- package/dist/types/src/block_reporting.d.ts.map +1 -1
- package/dist/types/src/blocks/colour.d.ts +0 -19
- package/dist/types/src/blocks/colour.d.ts.map +1 -1
- package/dist/types/src/blocks/control.d.ts +0 -19
- package/dist/types/src/blocks/control.d.ts.map +1 -1
- package/dist/types/src/blocks/data.d.ts +0 -19
- package/dist/types/src/blocks/data.d.ts.map +1 -1
- package/dist/types/src/blocks/event.d.ts +0 -19
- package/dist/types/src/blocks/event.d.ts.map +1 -1
- package/dist/types/src/blocks/looks.d.ts +0 -19
- package/dist/types/src/blocks/looks.d.ts.map +1 -1
- package/dist/types/src/blocks/math.d.ts +0 -19
- package/dist/types/src/blocks/math.d.ts.map +1 -1
- package/dist/types/src/blocks/matrix.d.ts +0 -19
- package/dist/types/src/blocks/matrix.d.ts.map +1 -1
- package/dist/types/src/blocks/motion.d.ts +0 -19
- package/dist/types/src/blocks/motion.d.ts.map +1 -1
- package/dist/types/src/blocks/note.d.ts +0 -19
- package/dist/types/src/blocks/note.d.ts.map +1 -1
- package/dist/types/src/blocks/operators.d.ts +0 -19
- package/dist/types/src/blocks/operators.d.ts.map +1 -1
- package/dist/types/src/blocks/procedures.d.ts +6 -9
- package/dist/types/src/blocks/procedures.d.ts.map +1 -1
- package/dist/types/src/blocks/sensing.d.ts +0 -19
- package/dist/types/src/blocks/sensing.d.ts.map +1 -1
- package/dist/types/src/blocks/sound.d.ts +0 -19
- package/dist/types/src/blocks/sound.d.ts.map +1 -1
- package/dist/types/src/blocks/text.d.ts +0 -19
- package/dist/types/src/blocks/text.d.ts.map +1 -1
- package/dist/types/src/blocks/vertical_extensions.d.ts +0 -19
- package/dist/types/src/blocks/vertical_extensions.d.ts.map +1 -1
- package/dist/types/src/checkable_continuous_flyout.d.ts +2 -7
- package/dist/types/src/checkable_continuous_flyout.d.ts.map +1 -1
- package/dist/types/src/checkbox_bubble.d.ts +13 -12
- package/dist/types/src/checkbox_bubble.d.ts.map +1 -1
- package/dist/types/src/colours.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +0 -7
- package/dist/types/src/constants.d.ts.map +1 -1
- package/dist/types/src/context_menu_items.d.ts +0 -5
- package/dist/types/src/context_menu_items.d.ts.map +1 -1
- package/dist/types/src/data_category.d.ts +2 -4
- package/dist/types/src/data_category.d.ts.map +1 -1
- package/dist/types/src/events/events_block_comment_base.d.ts +2 -3
- package/dist/types/src/events/events_block_comment_base.d.ts.map +1 -1
- package/dist/types/src/events/events_block_comment_change.d.ts +0 -5
- package/dist/types/src/events/events_block_comment_change.d.ts.map +1 -1
- package/dist/types/src/events/events_block_comment_collapse.d.ts +0 -5
- package/dist/types/src/events/events_block_comment_collapse.d.ts.map +1 -1
- package/dist/types/src/events/events_block_comment_create.d.ts +0 -5
- package/dist/types/src/events/events_block_comment_create.d.ts.map +1 -1
- package/dist/types/src/events/events_block_comment_delete.d.ts +0 -5
- package/dist/types/src/events/events_block_comment_delete.d.ts.map +1 -1
- package/dist/types/src/events/events_block_comment_move.d.ts +0 -5
- package/dist/types/src/events/events_block_comment_move.d.ts.map +1 -1
- package/dist/types/src/events/events_block_comment_resize.d.ts +0 -5
- package/dist/types/src/events/events_block_comment_resize.d.ts.map +1 -1
- package/dist/types/src/events/events_block_drag_end.d.ts +1 -2
- package/dist/types/src/events/events_block_drag_end.d.ts.map +1 -1
- package/dist/types/src/events/events_block_drag_outside.d.ts +1 -2
- package/dist/types/src/events/events_block_drag_outside.d.ts.map +1 -1
- package/dist/types/src/events/events_scratch_variable_create.d.ts +0 -5
- package/dist/types/src/events/events_scratch_variable_create.d.ts.map +1 -1
- package/dist/types/src/fields/field_colour_slider.d.ts +3 -27
- package/dist/types/src/fields/field_colour_slider.d.ts.map +1 -1
- package/dist/types/src/fields/field_matrix.d.ts +0 -19
- package/dist/types/src/fields/field_matrix.d.ts.map +1 -1
- package/dist/types/src/fields/field_note.d.ts +8 -23
- package/dist/types/src/fields/field_note.d.ts.map +1 -1
- package/dist/types/src/fields/field_textinput_removable.d.ts +2 -4
- package/dist/types/src/fields/field_textinput_removable.d.ts.map +1 -1
- package/dist/types/src/fields/field_variable_getter.d.ts +0 -19
- package/dist/types/src/fields/field_variable_getter.d.ts.map +1 -1
- package/dist/types/src/fields/field_vertical_separator.d.ts +0 -19
- package/dist/types/src/fields/field_vertical_separator.d.ts.map +1 -1
- package/dist/types/src/fields/scratch_field_angle.d.ts +0 -19
- package/dist/types/src/fields/scratch_field_angle.d.ts.map +1 -1
- package/dist/types/src/fields/scratch_field_dropdown.d.ts +0 -5
- package/dist/types/src/fields/scratch_field_dropdown.d.ts.map +1 -1
- package/dist/types/src/fields/scratch_field_number.d.ts +0 -19
- package/dist/types/src/fields/scratch_field_number.d.ts.map +1 -1
- package/dist/types/src/fields/scratch_field_variable.d.ts +4 -7
- package/dist/types/src/fields/scratch_field_variable.d.ts.map +1 -1
- package/dist/types/src/flyout_checkbox_icon.d.ts +2 -3
- package/dist/types/src/flyout_checkbox_icon.d.ts.map +1 -1
- package/dist/types/src/glows.d.ts +1 -3
- package/dist/types/src/glows.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +50 -51
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/procedures.d.ts +6 -8
- package/dist/types/src/procedures.d.ts.map +1 -1
- package/dist/types/src/recyclable_block_flyout_inflater.d.ts +3 -5
- package/dist/types/src/recyclable_block_flyout_inflater.d.ts.map +1 -1
- package/dist/types/src/renderer/bowler_hat.d.ts +2 -3
- package/dist/types/src/renderer/bowler_hat.d.ts.map +1 -1
- package/dist/types/src/renderer/cat/cat_face.d.ts +6 -5
- package/dist/types/src/renderer/cat/cat_face.d.ts.map +1 -1
- package/dist/types/src/renderer/cat/constants.d.ts +2 -2
- package/dist/types/src/renderer/cat/constants.d.ts.map +1 -1
- package/dist/types/src/renderer/cat/drawer.d.ts +3 -4
- package/dist/types/src/renderer/cat/drawer.d.ts.map +1 -1
- package/dist/types/src/renderer/cat/path_object.d.ts +2 -3
- package/dist/types/src/renderer/cat/path_object.d.ts.map +1 -1
- package/dist/types/src/renderer/cat/render_info.d.ts +3 -4
- package/dist/types/src/renderer/cat/render_info.d.ts.map +1 -1
- package/dist/types/src/renderer/cat/renderer.d.ts +6 -7
- package/dist/types/src/renderer/cat/renderer.d.ts.map +1 -1
- package/dist/types/src/renderer/constants.d.ts +4 -4
- package/dist/types/src/renderer/constants.d.ts.map +1 -1
- package/dist/types/src/renderer/drawer.d.ts +5 -4
- package/dist/types/src/renderer/drawer.d.ts.map +1 -1
- package/dist/types/src/renderer/path_object.d.ts +1 -3
- package/dist/types/src/renderer/path_object.d.ts.map +1 -1
- package/dist/types/src/renderer/render_info.d.ts +3 -4
- package/dist/types/src/renderer/render_info.d.ts.map +1 -1
- package/dist/types/src/renderer/renderer.d.ts +8 -15
- package/dist/types/src/renderer/renderer.d.ts.map +1 -1
- package/dist/types/src/scratch_block_paster.d.ts +0 -5
- package/dist/types/src/scratch_block_paster.d.ts.map +1 -1
- package/dist/types/src/scratch_blocks_utils.d.ts +0 -20
- package/dist/types/src/scratch_blocks_utils.d.ts.map +1 -1
- package/dist/types/src/scratch_comment_bubble.d.ts +1 -4
- package/dist/types/src/scratch_comment_bubble.d.ts.map +1 -1
- package/dist/types/src/scratch_comment_icon.d.ts +2 -3
- package/dist/types/src/scratch_comment_icon.d.ts.map +1 -1
- package/dist/types/src/scratch_connection_checker.d.ts +0 -5
- package/dist/types/src/scratch_connection_checker.d.ts.map +1 -1
- package/dist/types/src/scratch_continuous_category.d.ts +5 -5
- package/dist/types/src/scratch_continuous_category.d.ts.map +1 -1
- package/dist/types/src/scratch_continuous_toolbox.d.ts +3 -6
- package/dist/types/src/scratch_continuous_toolbox.d.ts.map +1 -1
- package/dist/types/src/scratch_dragger.d.ts +1 -10
- package/dist/types/src/scratch_dragger.d.ts.map +1 -1
- package/dist/types/src/scratch_insertion_marker_previewer.d.ts +0 -5
- package/dist/types/src/scratch_insertion_marker_previewer.d.ts.map +1 -1
- package/dist/types/src/scratch_variable_map.d.ts +0 -5
- package/dist/types/src/scratch_variable_map.d.ts.map +1 -1
- package/dist/types/src/scratch_variable_model.d.ts +1 -2
- package/dist/types/src/scratch_variable_model.d.ts.map +1 -1
- package/dist/types/src/scratch_zoom_controls.d.ts +4 -6
- package/dist/types/src/scratch_zoom_controls.d.ts.map +1 -1
- package/dist/types/src/shadows.d.ts +2 -2
- package/dist/types/src/shadows.d.ts.map +1 -1
- package/dist/types/src/status_indicator_label.d.ts +4 -6
- package/dist/types/src/status_indicator_label.d.ts.map +1 -1
- package/dist/types/src/status_indicator_label_flyout_inflater.d.ts +1 -6
- package/dist/types/src/status_indicator_label_flyout_inflater.d.ts.map +1 -1
- package/dist/types/src/variables.d.ts +4 -8
- package/dist/types/src/variables.d.ts.map +1 -1
- package/dist/types/src/xml.d.ts +2 -3
- package/dist/types/src/xml.d.ts.map +1 -1
- package/dist/types/tests/jsunit/block_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/connection_db_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/connection_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/event_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/extensions_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/field_number_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/field_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/field_variable_getter_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/field_variable_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/gesture_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/input_test.d.ts +1 -0
- package/dist/types/tests/jsunit/input_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/json_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/names_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/procedure_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/scratch_block_comment_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/svg_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/test_utilities.d.ts.map +1 -1
- package/dist/types/tests/jsunit/utils_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/variable_map_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/variable_model_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/widget_div_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/workspace_comment_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/workspace_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/workspace_undo_redo_test.d.ts.map +1 -1
- package/dist/types/tests/jsunit/xml_test.d.ts.map +1 -1
- package/dist/types/tests/workspace_svg/workspace_svg_test.d.ts.map +1 -1
- package/eslint.config.mjs +69 -0
- package/i18n/create_scratch_msgs.js +44 -45
- package/i18n/js_to_json.js +40 -32
- package/i18n/json_to_js.js +37 -37
- package/i18n/sync_tx_translations.js +64 -65
- package/i18n/test_scratch_msgs.js +66 -63
- package/msg/js/en.js +289 -287
- package/msg/json/en.json +284 -284
- package/msg/messages.js +289 -287
- package/msg/scratch_msgs.js +22959 -22970
- package/package.json +6 -3
- package/prettier.config.mjs +3 -0
- package/release.config.js +7 -7
- package/renovate.json5 +7 -9
- package/src/block_reporting.ts +15 -18
- package/src/blocks/colour.ts +12 -15
- package/src/blocks/control.ts +167 -177
- package/src/blocks/data.ts +225 -292
- package/src/blocks/event.ts +121 -123
- package/src/blocks/looks.ts +165 -167
- package/src/blocks/math.ts +44 -46
- package/src/blocks/matrix.ts +11 -13
- package/src/blocks/motion.ts +151 -153
- package/src/blocks/note.ts +11 -13
- package/src/blocks/operators.ts +158 -160
- package/src/blocks/procedures.ts +415 -523
- package/src/blocks/sensing.ts +163 -165
- package/src/blocks/sound.ts +58 -60
- package/src/blocks/text.ts +10 -12
- package/src/blocks/vertical_extensions.ts +86 -102
- package/src/checkable_continuous_flyout.ts +25 -42
- package/src/checkbox_bubble.ts +83 -100
- package/src/colours.ts +35 -37
- package/src/constants.ts +22 -29
- package/src/context_menu_items.ts +56 -81
- package/src/css.ts +3 -4
- package/src/data_category.ts +137 -251
- package/src/events/events_block_comment_base.ts +21 -31
- package/src/events/events_block_comment_change.ts +21 -42
- package/src/events/events_block_comment_collapse.ts +22 -43
- package/src/events/events_block_comment_create.ts +29 -46
- package/src/events/events_block_comment_delete.ts +10 -19
- package/src/events/events_block_comment_move.ts +27 -52
- package/src/events/events_block_comment_resize.ts +28 -55
- package/src/events/events_block_drag_end.ts +16 -26
- package/src/events/events_block_drag_outside.ts +12 -22
- package/src/events/events_scratch_variable_create.ts +33 -56
- package/src/fields/field_colour_slider.ts +173 -228
- package/src/fields/field_matrix.ts +200 -269
- package/src/fields/field_note.ts +272 -377
- package/src/fields/field_textinput_removable.ts +25 -40
- package/src/fields/field_variable_getter.ts +26 -31
- package/src/fields/field_vertical_separator.ts +19 -24
- package/src/fields/scratch_field_angle.ts +150 -186
- package/src/fields/scratch_field_dropdown.ts +15 -19
- package/src/fields/scratch_field_number.ts +123 -180
- package/src/fields/scratch_field_variable.ts +54 -75
- package/src/flyout_checkbox_icon.ts +18 -28
- package/src/glows.ts +51 -58
- package/src/index.ts +119 -133
- package/src/procedures.ts +146 -213
- package/src/recyclable_block_flyout_inflater.ts +14 -25
- package/src/renderer/bowler_hat.ts +6 -8
- package/src/renderer/cat/cat_face.ts +98 -99
- package/src/renderer/cat/constants.ts +67 -87
- package/src/renderer/cat/drawer.ts +21 -27
- package/src/renderer/cat/path_object.ts +3 -5
- package/src/renderer/cat/render_info.ts +5 -8
- package/src/renderer/cat/renderer.ts +11 -15
- package/src/renderer/constants.ts +34 -49
- package/src/renderer/drawer.ts +35 -51
- package/src/renderer/path_object.ts +4 -10
- package/src/renderer/render_info.ts +36 -56
- package/src/renderer/renderer.ts +16 -29
- package/src/scratch_block_paster.ts +12 -20
- package/src/scratch_blocks_utils.ts +4 -7
- package/src/scratch_comment_bubble.ts +70 -101
- package/src/scratch_comment_icon.ts +74 -123
- package/src/scratch_connection_checker.ts +7 -17
- package/src/scratch_continuous_category.ts +24 -28
- package/src/scratch_continuous_toolbox.ts +20 -27
- package/src/scratch_dragger.ts +42 -81
- package/src/scratch_insertion_marker_previewer.ts +6 -11
- package/src/scratch_variable_map.ts +5 -12
- package/src/scratch_variable_model.ts +4 -11
- package/src/scratch_zoom_controls.ts +101 -156
- package/src/shadows.ts +32 -37
- package/src/status_indicator_label.ts +54 -67
- package/src/status_indicator_label_flyout_inflater.ts +11 -21
- package/src/variables.ts +89 -138
- package/src/xml.ts +21 -35
- package/tsconfig.json +2 -6
- package/types/continuous-toolbox.d.ts +1 -1
- package/dist/main.mjs.LICENSE.txt +0 -163
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license
|
|
3
2
|
* Visual Blocks Editor
|
|
4
3
|
*
|
|
5
4
|
* Copyright 2012 Google Inc.
|
|
@@ -17,18 +16,17 @@
|
|
|
17
16
|
* See the License for the specific language governing permissions and
|
|
18
17
|
* limitations under the License.
|
|
19
18
|
*/
|
|
20
|
-
|
|
21
19
|
/**
|
|
22
|
-
* @
|
|
20
|
+
* @file Colour input field.
|
|
23
21
|
* @author fraser@google.com (Neil Fraser)
|
|
24
22
|
*/
|
|
25
|
-
import * as Blockly from
|
|
26
|
-
import { FieldColour, FieldColourFromJsonConfig } from
|
|
23
|
+
import * as Blockly from 'blockly/core'
|
|
24
|
+
import { FieldColour, FieldColourFromJsonConfig } from '@blockly/field-colour'
|
|
27
25
|
|
|
28
26
|
enum ColourChannel {
|
|
29
|
-
HUE =
|
|
30
|
-
SATURATION =
|
|
31
|
-
BRIGHTNESS =
|
|
27
|
+
HUE = 'hue',
|
|
28
|
+
SATURATION = 'saturation',
|
|
29
|
+
BRIGHTNESS = 'brightness',
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
/**
|
|
@@ -41,104 +39,89 @@ export class FieldColourSlider extends FieldColour {
|
|
|
41
39
|
* The button calls this function with a callback to update the field value.
|
|
42
40
|
* BEWARE: This is not a stable API. It may change.
|
|
43
41
|
*/
|
|
44
|
-
static activateEyedropper_?: (
|
|
45
|
-
callback: (colour: string) => void
|
|
46
|
-
) => void;
|
|
42
|
+
static activateEyedropper_?: (callback: (colour: string) => void) => void
|
|
47
43
|
|
|
48
44
|
/**
|
|
49
45
|
* Path to the eyedropper svg icon.
|
|
50
46
|
*/
|
|
51
|
-
EYEDROPPER_PATH =
|
|
52
|
-
SERIALIZABLE = true
|
|
53
|
-
EDITABLE = true
|
|
47
|
+
EYEDROPPER_PATH = 'eyedropper.svg'
|
|
48
|
+
SERIALIZABLE = true
|
|
49
|
+
EDITABLE = true
|
|
54
50
|
|
|
55
|
-
private hueChangeEventKey_?: Blockly.browserEvents.Data
|
|
56
|
-
private saturationChangeEventKey_?: Blockly.browserEvents.Data
|
|
57
|
-
private brightnessChangeEventKey_?: Blockly.browserEvents.Data
|
|
58
|
-
private hueSlider_?: HTMLInputElement
|
|
59
|
-
private saturationSlider_?: HTMLInputElement
|
|
60
|
-
private brightnessSlider_?: HTMLInputElement
|
|
61
|
-
private hueReadout_?: Element
|
|
62
|
-
private saturationReadout_?: Element
|
|
63
|
-
private brightnessReadout_?: Element
|
|
64
|
-
private hue_ = 0
|
|
65
|
-
private saturation_ = 0
|
|
66
|
-
private brightness_ = 0
|
|
67
|
-
private eyedropperEventData_?: Blockly.browserEvents.Data
|
|
51
|
+
private hueChangeEventKey_?: Blockly.browserEvents.Data
|
|
52
|
+
private saturationChangeEventKey_?: Blockly.browserEvents.Data
|
|
53
|
+
private brightnessChangeEventKey_?: Blockly.browserEvents.Data
|
|
54
|
+
private hueSlider_?: HTMLInputElement
|
|
55
|
+
private saturationSlider_?: HTMLInputElement
|
|
56
|
+
private brightnessSlider_?: HTMLInputElement
|
|
57
|
+
private hueReadout_?: Element
|
|
58
|
+
private saturationReadout_?: Element
|
|
59
|
+
private brightnessReadout_?: Element
|
|
60
|
+
private hue_ = 0
|
|
61
|
+
private saturation_ = 0
|
|
62
|
+
private brightness_ = 0
|
|
63
|
+
private eyedropperEventData_?: Blockly.browserEvents.Data
|
|
68
64
|
|
|
69
65
|
/**
|
|
70
66
|
* Construct a FieldColourSlider from a JSON arg object.
|
|
71
|
-
*
|
|
72
67
|
* @param options A JSON object with options (colour).
|
|
73
68
|
* @returns The new field instance.
|
|
74
69
|
*/
|
|
75
70
|
static fromJson(options: FieldColourFromJsonConfig): FieldColourSlider {
|
|
76
|
-
return new FieldColourSlider(options
|
|
71
|
+
return new FieldColourSlider(options.colour)
|
|
77
72
|
}
|
|
78
73
|
|
|
79
74
|
doValueUpdate_(newValue: string) {
|
|
80
|
-
super.doValueUpdate_(newValue)
|
|
81
|
-
this.updateSliderHandles_()
|
|
82
|
-
this.updateDom_()
|
|
75
|
+
super.doValueUpdate_(newValue)
|
|
76
|
+
this.updateSliderHandles_()
|
|
77
|
+
this.updateDom_()
|
|
83
78
|
}
|
|
84
79
|
|
|
85
80
|
/**
|
|
86
81
|
* Create the hue, saturation or value CSS gradient for the slide backgrounds.
|
|
87
|
-
*
|
|
88
82
|
* @param channel – Either "hue", "saturation" or "value".
|
|
89
|
-
* @
|
|
83
|
+
* @returns Array colour hex colour stops for the given channel
|
|
90
84
|
*/
|
|
91
85
|
private createColourStops_(channel: ColourChannel): string[] {
|
|
92
|
-
const stops = []
|
|
86
|
+
const stops = []
|
|
93
87
|
for (let n = 0; n <= 360; n += 20) {
|
|
94
88
|
switch (channel) {
|
|
95
89
|
case ColourChannel.HUE:
|
|
96
|
-
stops.push(
|
|
97
|
-
|
|
98
|
-
);
|
|
99
|
-
break;
|
|
90
|
+
stops.push(Blockly.utils.colour.hsvToHex(n, this.saturation_, this.brightness_))
|
|
91
|
+
break
|
|
100
92
|
case ColourChannel.SATURATION:
|
|
101
|
-
stops.push(
|
|
102
|
-
|
|
103
|
-
);
|
|
104
|
-
break;
|
|
93
|
+
stops.push(Blockly.utils.colour.hsvToHex(this.hue_, n / 360, this.brightness_))
|
|
94
|
+
break
|
|
105
95
|
case ColourChannel.BRIGHTNESS:
|
|
106
|
-
stops.push(
|
|
107
|
-
|
|
108
|
-
this.hue_,
|
|
109
|
-
this.saturation_,
|
|
110
|
-
(255 * n) / 360
|
|
111
|
-
)
|
|
112
|
-
);
|
|
113
|
-
break;
|
|
96
|
+
stops.push(Blockly.utils.colour.hsvToHex(this.hue_, this.saturation_, (255 * n) / 360))
|
|
97
|
+
break
|
|
114
98
|
default:
|
|
115
|
-
throw new Error(
|
|
99
|
+
throw new Error('Unknown channel for colour sliders: ' + channel)
|
|
116
100
|
}
|
|
117
101
|
}
|
|
118
|
-
return stops
|
|
102
|
+
return stops
|
|
119
103
|
}
|
|
120
104
|
|
|
121
105
|
/**
|
|
122
106
|
* Set the gradient CSS properties for the given node and channel
|
|
123
|
-
*
|
|
124
107
|
* @param node The DOM node the gradient will be set on.
|
|
125
108
|
* @param channel Either "hue", "saturation" or "value".
|
|
126
109
|
*/
|
|
127
110
|
private setGradient_(node: HTMLElement, channel: ColourChannel) {
|
|
128
|
-
const gradient = this.createColourStops_(channel).join(
|
|
129
|
-
node.style
|
|
111
|
+
const gradient = this.createColourStops_(channel).join(',')
|
|
112
|
+
node.style.background = `linear-gradient(to right, ${gradient})`
|
|
130
113
|
}
|
|
131
114
|
|
|
132
115
|
/**
|
|
133
116
|
* Update the readouts and slider backgrounds after value has changed.
|
|
134
117
|
*/
|
|
135
118
|
private updateDom_() {
|
|
136
|
-
const hueSlider = this.hueSlider_
|
|
137
|
-
const saturationSlider = this.saturationSlider_
|
|
138
|
-
const brightnessSlider = this.brightnessSlider_
|
|
139
|
-
const hueReadout = this.hueReadout_
|
|
140
|
-
const saturationReadout = this.saturationReadout_
|
|
141
|
-
const brightnessReadout = this.brightnessReadout_
|
|
119
|
+
const hueSlider = this.hueSlider_
|
|
120
|
+
const saturationSlider = this.saturationSlider_
|
|
121
|
+
const brightnessSlider = this.brightnessSlider_
|
|
122
|
+
const hueReadout = this.hueReadout_
|
|
123
|
+
const saturationReadout = this.saturationReadout_
|
|
124
|
+
const brightnessReadout = this.brightnessReadout_
|
|
142
125
|
if (
|
|
143
126
|
!hueSlider ||
|
|
144
127
|
!saturationSlider ||
|
|
@@ -147,96 +130,78 @@ export class FieldColourSlider extends FieldColour {
|
|
|
147
130
|
!saturationReadout ||
|
|
148
131
|
!brightnessReadout
|
|
149
132
|
) {
|
|
150
|
-
console.warn(
|
|
151
|
-
|
|
152
|
-
);
|
|
153
|
-
return;
|
|
133
|
+
console.warn('FieldColourSlider.updateDom_: slider/readout DOM is not fully initialized')
|
|
134
|
+
return
|
|
154
135
|
}
|
|
155
136
|
|
|
156
|
-
this.setGradient_(hueSlider, ColourChannel.HUE)
|
|
157
|
-
this.setGradient_(saturationSlider, ColourChannel.SATURATION)
|
|
158
|
-
this.setGradient_(brightnessSlider, ColourChannel.BRIGHTNESS)
|
|
137
|
+
this.setGradient_(hueSlider, ColourChannel.HUE)
|
|
138
|
+
this.setGradient_(saturationSlider, ColourChannel.SATURATION)
|
|
139
|
+
this.setGradient_(brightnessSlider, ColourChannel.BRIGHTNESS)
|
|
159
140
|
|
|
160
|
-
hueReadout.textContent = Math.floor(
|
|
161
|
-
|
|
162
|
-
).toFixed(0)
|
|
163
|
-
saturationReadout.textContent = Math.floor(
|
|
164
|
-
100 * this.saturation_
|
|
165
|
-
).toFixed(0);
|
|
166
|
-
brightnessReadout.textContent = Math.floor(
|
|
167
|
-
(100 * this.brightness_) / 255
|
|
168
|
-
).toFixed(0);
|
|
141
|
+
hueReadout.textContent = Math.floor((100 * this.hue_) / 360).toFixed(0)
|
|
142
|
+
saturationReadout.textContent = Math.floor(100 * this.saturation_).toFixed(0)
|
|
143
|
+
brightnessReadout.textContent = Math.floor((100 * this.brightness_) / 255).toFixed(0)
|
|
169
144
|
}
|
|
170
145
|
|
|
171
146
|
/**
|
|
172
147
|
* Update the slider handle positions from the current field value.
|
|
173
148
|
*/
|
|
174
149
|
private updateSliderHandles_() {
|
|
175
|
-
const hueSlider = this.hueSlider_
|
|
176
|
-
const saturationSlider = this.saturationSlider_
|
|
177
|
-
const brightnessSlider = this.brightnessSlider_
|
|
150
|
+
const hueSlider = this.hueSlider_
|
|
151
|
+
const saturationSlider = this.saturationSlider_
|
|
152
|
+
const brightnessSlider = this.brightnessSlider_
|
|
178
153
|
if (!hueSlider || !saturationSlider || !brightnessSlider) {
|
|
179
|
-
console.warn(
|
|
180
|
-
|
|
181
|
-
);
|
|
182
|
-
return;
|
|
154
|
+
console.warn('FieldColourSlider.updateSliderHandles_: slider DOM is not fully initialized')
|
|
155
|
+
return
|
|
183
156
|
}
|
|
184
157
|
|
|
185
|
-
hueSlider.value = `${this.hue_}
|
|
186
|
-
saturationSlider.value = `${this.saturation_}
|
|
187
|
-
brightnessSlider.value = `${this.brightness_}
|
|
158
|
+
hueSlider.value = `${this.hue_}`
|
|
159
|
+
saturationSlider.value = `${this.saturation_}`
|
|
160
|
+
brightnessSlider.value = `${this.brightness_}`
|
|
188
161
|
}
|
|
189
162
|
|
|
190
163
|
/**
|
|
191
164
|
* Create label and readout DOM elements, returning the readout.
|
|
192
|
-
*
|
|
193
165
|
* @param labelText Text for the label
|
|
194
|
-
* @
|
|
166
|
+
* @returns The container node and the readout node.
|
|
195
167
|
*/
|
|
196
168
|
private createLabelDom_(labelText: string): Element[] {
|
|
197
|
-
const labelContainer = document.createElement(
|
|
198
|
-
labelContainer.setAttribute(
|
|
199
|
-
const readout = document.createElement(
|
|
200
|
-
readout.setAttribute(
|
|
201
|
-
const label = document.createElement(
|
|
202
|
-
label.setAttribute(
|
|
203
|
-
label.textContent = labelText
|
|
204
|
-
labelContainer.appendChild(label)
|
|
205
|
-
labelContainer.appendChild(readout)
|
|
206
|
-
return [labelContainer, readout]
|
|
169
|
+
const labelContainer = document.createElement('div')
|
|
170
|
+
labelContainer.setAttribute('class', 'scratchColourPickerLabel')
|
|
171
|
+
const readout = document.createElement('span')
|
|
172
|
+
readout.setAttribute('class', 'scratchColourPickerReadout')
|
|
173
|
+
const label = document.createElement('span')
|
|
174
|
+
label.setAttribute('class', 'scratchColourPickerLabelText')
|
|
175
|
+
label.textContent = labelText
|
|
176
|
+
labelContainer.appendChild(label)
|
|
177
|
+
labelContainer.appendChild(readout)
|
|
178
|
+
return [labelContainer, readout]
|
|
207
179
|
}
|
|
208
180
|
|
|
209
181
|
/**
|
|
210
182
|
* Factory for creating the different slider callbacks
|
|
211
|
-
*
|
|
212
183
|
* @param channel One of "hue", "saturation" or "brightness"
|
|
213
184
|
* @returns The callback for slider update
|
|
214
185
|
*/
|
|
215
|
-
private sliderCallbackFactory_(
|
|
216
|
-
channel: ColourChannel
|
|
217
|
-
): (event: PointerEvent) => void {
|
|
186
|
+
private sliderCallbackFactory_(channel: ColourChannel): (event: PointerEvent) => void {
|
|
218
187
|
return (event: PointerEvent) => {
|
|
219
|
-
const channelValue = (event.target as HTMLInputElement).value
|
|
188
|
+
const channelValue = (event.target as HTMLInputElement).value
|
|
220
189
|
switch (channel) {
|
|
221
190
|
case ColourChannel.HUE:
|
|
222
|
-
this.hue_ = Number(channelValue)
|
|
223
|
-
break
|
|
191
|
+
this.hue_ = Number(channelValue)
|
|
192
|
+
break
|
|
224
193
|
case ColourChannel.SATURATION:
|
|
225
|
-
this.saturation_ = Number(channelValue)
|
|
226
|
-
break
|
|
194
|
+
this.saturation_ = Number(channelValue)
|
|
195
|
+
break
|
|
227
196
|
case ColourChannel.BRIGHTNESS:
|
|
228
|
-
this.brightness_ = Number(channelValue)
|
|
229
|
-
break
|
|
197
|
+
this.brightness_ = Number(channelValue)
|
|
198
|
+
break
|
|
230
199
|
}
|
|
231
|
-
const colour = Blockly.utils.colour.hsvToHex(
|
|
232
|
-
this.hue_,
|
|
233
|
-
this.saturation_,
|
|
234
|
-
this.brightness_
|
|
235
|
-
);
|
|
200
|
+
const colour = Blockly.utils.colour.hsvToHex(this.hue_, this.saturation_, this.brightness_)
|
|
236
201
|
if (colour !== null) {
|
|
237
|
-
this.setValue(colour, true)
|
|
202
|
+
this.setValue(colour, true)
|
|
238
203
|
}
|
|
239
|
-
}
|
|
204
|
+
}
|
|
240
205
|
}
|
|
241
206
|
|
|
242
207
|
/**
|
|
@@ -245,174 +210,154 @@ export class FieldColourSlider extends FieldColour {
|
|
|
245
210
|
private activateEyedropperInternal_() {
|
|
246
211
|
FieldColourSlider.activateEyedropper_?.((chosenColour: string) => {
|
|
247
212
|
// Update the internal hue/saturation/brightness values so sliders update.
|
|
248
|
-
const components = Blockly.utils.colour.hexToRgb(chosenColour)
|
|
249
|
-
const { hue, saturation, value } = this.rgbToHsv(
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
)
|
|
254
|
-
|
|
255
|
-
this.saturation_ = saturation;
|
|
256
|
-
this.brightness_ = value;
|
|
257
|
-
this.setValue(chosenColour);
|
|
258
|
-
});
|
|
213
|
+
const components = Blockly.utils.colour.hexToRgb(chosenColour)
|
|
214
|
+
const { hue, saturation, value } = this.rgbToHsv(components[0], components[1], components[2])
|
|
215
|
+
this.hue_ = hue
|
|
216
|
+
this.saturation_ = saturation
|
|
217
|
+
this.brightness_ = value
|
|
218
|
+
this.setValue(chosenColour)
|
|
219
|
+
})
|
|
259
220
|
}
|
|
260
221
|
|
|
261
222
|
/**
|
|
262
223
|
* Create hue, saturation and brightness sliders under the colour field.
|
|
263
224
|
*/
|
|
264
225
|
showEditor_() {
|
|
265
|
-
Blockly.DropDownDiv.hideWithoutAnimation()
|
|
266
|
-
Blockly.DropDownDiv.clearContent()
|
|
267
|
-
const div = Blockly.DropDownDiv.getContentDiv()
|
|
268
|
-
div.className =
|
|
226
|
+
Blockly.DropDownDiv.hideWithoutAnimation()
|
|
227
|
+
Blockly.DropDownDiv.clearContent()
|
|
228
|
+
const div = Blockly.DropDownDiv.getContentDiv()
|
|
229
|
+
div.className = 'scratchColourPicker'
|
|
269
230
|
|
|
270
231
|
// Init color component values that are used while the editor is open
|
|
271
232
|
// in order to keep the slider values stable.
|
|
272
|
-
const currentValue = this.getValue() ??
|
|
273
|
-
const components = Blockly.utils.colour.hexToRgb(currentValue)
|
|
274
|
-
const { hue, saturation, value } = this.rgbToHsv(
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
);
|
|
279
|
-
this.hue_ = hue;
|
|
280
|
-
this.saturation_ = saturation;
|
|
281
|
-
this.brightness_ = value;
|
|
233
|
+
const currentValue = this.getValue() ?? '#000000'
|
|
234
|
+
const components = Blockly.utils.colour.hexToRgb(currentValue)
|
|
235
|
+
const { hue, saturation, value } = this.rgbToHsv(components[0], components[1], components[2])
|
|
236
|
+
this.hue_ = hue
|
|
237
|
+
this.saturation_ = saturation
|
|
238
|
+
this.brightness_ = value
|
|
282
239
|
|
|
283
|
-
const hueElements = this.createLabelDom_(Blockly.Msg.COLOUR_HUE_LABEL)
|
|
284
|
-
div.appendChild(hueElements[0])
|
|
285
|
-
this.hueReadout_ = hueElements[1]
|
|
286
|
-
this.hueSlider_ = document.createElement(
|
|
287
|
-
this.hueSlider_.type =
|
|
288
|
-
this.hueSlider_.min =
|
|
289
|
-
this.hueSlider_.max =
|
|
290
|
-
this.hueSlider_.className =
|
|
291
|
-
div.appendChild(this.hueSlider_)
|
|
240
|
+
const hueElements = this.createLabelDom_(Blockly.Msg.COLOUR_HUE_LABEL)
|
|
241
|
+
div.appendChild(hueElements[0])
|
|
242
|
+
this.hueReadout_ = hueElements[1]
|
|
243
|
+
this.hueSlider_ = document.createElement('input')
|
|
244
|
+
this.hueSlider_.type = 'range'
|
|
245
|
+
this.hueSlider_.min = '0'
|
|
246
|
+
this.hueSlider_.max = '360'
|
|
247
|
+
this.hueSlider_.className = 'scratchColourSlider'
|
|
248
|
+
div.appendChild(this.hueSlider_)
|
|
292
249
|
|
|
293
|
-
const saturationElements = this.createLabelDom_(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
this.
|
|
298
|
-
this.saturationSlider_ =
|
|
299
|
-
this.saturationSlider_.
|
|
300
|
-
this.saturationSlider_.
|
|
301
|
-
this.saturationSlider_.
|
|
302
|
-
this.saturationSlider_
|
|
303
|
-
this.saturationSlider_.className = "scratchColourSlider";
|
|
304
|
-
div.appendChild(this.saturationSlider_);
|
|
250
|
+
const saturationElements = this.createLabelDom_(Blockly.Msg.COLOUR_SATURATION_LABEL)
|
|
251
|
+
div.appendChild(saturationElements[0])
|
|
252
|
+
this.saturationReadout_ = saturationElements[1]
|
|
253
|
+
this.saturationSlider_ = document.createElement('input')
|
|
254
|
+
this.saturationSlider_.type = 'range'
|
|
255
|
+
this.saturationSlider_.step = '0.001'
|
|
256
|
+
this.saturationSlider_.min = '0'
|
|
257
|
+
this.saturationSlider_.max = '1.0'
|
|
258
|
+
this.saturationSlider_.className = 'scratchColourSlider'
|
|
259
|
+
div.appendChild(this.saturationSlider_)
|
|
305
260
|
|
|
306
|
-
const brightnessElements = this.createLabelDom_(
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
this.
|
|
311
|
-
this.brightnessSlider_ =
|
|
312
|
-
this.brightnessSlider_.
|
|
313
|
-
this.brightnessSlider_.
|
|
314
|
-
this.brightnessSlider_
|
|
315
|
-
this.brightnessSlider_.className = "scratchColourSlider";
|
|
316
|
-
div.appendChild(this.brightnessSlider_);
|
|
261
|
+
const brightnessElements = this.createLabelDom_(Blockly.Msg.COLOUR_BRIGHTNESS_LABEL)
|
|
262
|
+
div.appendChild(brightnessElements[0])
|
|
263
|
+
this.brightnessReadout_ = brightnessElements[1]
|
|
264
|
+
this.brightnessSlider_ = document.createElement('input')
|
|
265
|
+
this.brightnessSlider_.type = 'range'
|
|
266
|
+
this.brightnessSlider_.min = '0'
|
|
267
|
+
this.brightnessSlider_.max = '255'
|
|
268
|
+
this.brightnessSlider_.className = 'scratchColourSlider'
|
|
269
|
+
div.appendChild(this.brightnessSlider_)
|
|
317
270
|
|
|
318
271
|
if (FieldColourSlider.activateEyedropper_) {
|
|
319
|
-
const button = document.createElement(
|
|
320
|
-
button.setAttribute(
|
|
321
|
-
const image = document.createElement(
|
|
322
|
-
image.src =
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
div.appendChild(button);
|
|
272
|
+
const button = document.createElement('button')
|
|
273
|
+
button.setAttribute('class', 'scratchEyedropper')
|
|
274
|
+
const image = document.createElement('img')
|
|
275
|
+
image.src = Blockly.getMainWorkspace().options.pathToMedia + this.EYEDROPPER_PATH
|
|
276
|
+
button.appendChild(image)
|
|
277
|
+
div.appendChild(button)
|
|
326
278
|
this.eyedropperEventData_ = Blockly.browserEvents.conditionalBind(
|
|
327
279
|
button,
|
|
328
|
-
|
|
280
|
+
'click',
|
|
329
281
|
this,
|
|
330
|
-
this.activateEyedropperInternal_
|
|
331
|
-
)
|
|
282
|
+
this.activateEyedropperInternal_,
|
|
283
|
+
)
|
|
332
284
|
}
|
|
333
285
|
|
|
334
|
-
Blockly.DropDownDiv.setColour(
|
|
335
|
-
Blockly.DropDownDiv.showPositionedByBlock(
|
|
336
|
-
this,
|
|
337
|
-
this.getSourceBlock() as Blockly.BlockSvg
|
|
338
|
-
);
|
|
286
|
+
Blockly.DropDownDiv.setColour('#ffffff', '#dddddd')
|
|
287
|
+
Blockly.DropDownDiv.showPositionedByBlock(this, this.getSourceBlock() as Blockly.BlockSvg)
|
|
339
288
|
|
|
340
289
|
// Set value updates the slider positions
|
|
341
290
|
// Do this before attaching callbacks to avoid extra events from initial set
|
|
342
|
-
this.setValue(this.getValue() ?? currentValue)
|
|
291
|
+
this.setValue(this.getValue() ?? currentValue)
|
|
343
292
|
|
|
344
293
|
this.hueChangeEventKey_ = Blockly.browserEvents.bind(
|
|
345
294
|
this.hueSlider_,
|
|
346
|
-
|
|
295
|
+
'input',
|
|
347
296
|
this,
|
|
348
|
-
this.sliderCallbackFactory_(ColourChannel.HUE)
|
|
349
|
-
)
|
|
297
|
+
this.sliderCallbackFactory_(ColourChannel.HUE),
|
|
298
|
+
)
|
|
350
299
|
this.saturationChangeEventKey_ = Blockly.browserEvents.bind(
|
|
351
300
|
this.saturationSlider_,
|
|
352
|
-
|
|
301
|
+
'input',
|
|
353
302
|
this,
|
|
354
|
-
this.sliderCallbackFactory_(ColourChannel.SATURATION)
|
|
355
|
-
)
|
|
303
|
+
this.sliderCallbackFactory_(ColourChannel.SATURATION),
|
|
304
|
+
)
|
|
356
305
|
this.brightnessChangeEventKey_ = Blockly.browserEvents.bind(
|
|
357
306
|
this.brightnessSlider_,
|
|
358
|
-
|
|
307
|
+
'input',
|
|
359
308
|
this,
|
|
360
|
-
this.sliderCallbackFactory_(ColourChannel.BRIGHTNESS)
|
|
361
|
-
)
|
|
309
|
+
this.sliderCallbackFactory_(ColourChannel.BRIGHTNESS),
|
|
310
|
+
)
|
|
362
311
|
}
|
|
363
312
|
|
|
364
313
|
dispose() {
|
|
365
314
|
if (this.hueChangeEventKey_) {
|
|
366
|
-
Blockly.browserEvents.unbind(this.hueChangeEventKey_)
|
|
315
|
+
Blockly.browserEvents.unbind(this.hueChangeEventKey_)
|
|
367
316
|
}
|
|
368
317
|
if (this.saturationChangeEventKey_) {
|
|
369
|
-
Blockly.browserEvents.unbind(this.saturationChangeEventKey_)
|
|
318
|
+
Blockly.browserEvents.unbind(this.saturationChangeEventKey_)
|
|
370
319
|
}
|
|
371
320
|
if (this.brightnessChangeEventKey_) {
|
|
372
|
-
Blockly.browserEvents.unbind(this.brightnessChangeEventKey_)
|
|
321
|
+
Blockly.browserEvents.unbind(this.brightnessChangeEventKey_)
|
|
373
322
|
}
|
|
374
323
|
if (this.eyedropperEventData_) {
|
|
375
|
-
Blockly.browserEvents.unbind(this.eyedropperEventData_)
|
|
324
|
+
Blockly.browserEvents.unbind(this.eyedropperEventData_)
|
|
376
325
|
}
|
|
377
|
-
Blockly.Events.setGroup(false)
|
|
378
|
-
super.dispose()
|
|
326
|
+
Blockly.Events.setGroup(false)
|
|
327
|
+
super.dispose()
|
|
379
328
|
}
|
|
380
329
|
|
|
381
330
|
// From Closure
|
|
382
|
-
rgbToHsv(
|
|
383
|
-
red
|
|
384
|
-
green
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
const
|
|
388
|
-
const min = Math.min(Math.min(red, green), blue);
|
|
389
|
-
let hue;
|
|
390
|
-
let saturation;
|
|
391
|
-
const value = max;
|
|
331
|
+
rgbToHsv(red: number, green: number, blue: number): { hue: number; saturation: number; value: number } {
|
|
332
|
+
const max = Math.max(Math.max(red, green), blue)
|
|
333
|
+
const min = Math.min(Math.min(red, green), blue)
|
|
334
|
+
let hue
|
|
335
|
+
let saturation
|
|
336
|
+
const value = max
|
|
392
337
|
if (min == max) {
|
|
393
|
-
hue = 0
|
|
394
|
-
saturation = 0
|
|
338
|
+
hue = 0
|
|
339
|
+
saturation = 0
|
|
395
340
|
} else {
|
|
396
|
-
const delta = max - min
|
|
397
|
-
saturation = delta / max
|
|
341
|
+
const delta = max - min
|
|
342
|
+
saturation = delta / max
|
|
398
343
|
|
|
399
344
|
if (red == max) {
|
|
400
|
-
hue = (green - blue) / delta
|
|
345
|
+
hue = (green - blue) / delta
|
|
401
346
|
} else if (green == max) {
|
|
402
|
-
hue = 2 + (blue - red) / delta
|
|
347
|
+
hue = 2 + (blue - red) / delta
|
|
403
348
|
} else {
|
|
404
|
-
hue = 4 + (red - green) / delta
|
|
349
|
+
hue = 4 + (red - green) / delta
|
|
405
350
|
}
|
|
406
|
-
hue *= 60
|
|
351
|
+
hue *= 60
|
|
407
352
|
if (hue < 0) {
|
|
408
|
-
hue += 360
|
|
353
|
+
hue += 360
|
|
409
354
|
}
|
|
410
355
|
if (hue > 360) {
|
|
411
|
-
hue -= 360
|
|
356
|
+
hue -= 360
|
|
412
357
|
}
|
|
413
358
|
}
|
|
414
359
|
|
|
415
|
-
return { hue, saturation, value }
|
|
360
|
+
return { hue, saturation, value }
|
|
416
361
|
}
|
|
417
362
|
}
|
|
418
363
|
|
|
@@ -420,5 +365,5 @@ export class FieldColourSlider extends FieldColour {
|
|
|
420
365
|
* Register the field and any dependencies.
|
|
421
366
|
*/
|
|
422
367
|
export function registerFieldColourSlider() {
|
|
423
|
-
Blockly.fieldRegistry.register(
|
|
368
|
+
Blockly.fieldRegistry.register('field_colour_slider', FieldColourSlider)
|
|
424
369
|
}
|