A Blockly slider field.
yarn add @blockly/field-slider
npm install @blockly/field-slider --save
This field is an extension of the Blockly.FieldNumber field. See the Blockly.FieldNumber documentation on what parameters and configurations this field supports.
import * as Blockly from 'blockly';
import {FieldSlider} from '@blockly/field-slider';
Blockly.Blocks["test_field_slider"] = {
init: function () {
this.appendDummyInput()
.appendField("slider: ")
.appendField(new FieldSlider(50), "FIELDNAME")
}
};
import * as Blockly from 'blockly';
import '@blockly/field-slider';
Blockly.defineBlocksWithJsonArray([
{
"type": "test_field_slider",
"message0": "slider: %1",
"args0": [
{
"type": "field_slider",
"name": "FIELDNAME",
"value": 50
}
]
}]);
Apache 2.0