define.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. * @license Licensed under the Apache License, Version 2.0 (the "License"):
  3. * http://www.apache.org/licenses/LICENSE-2.0
  4. */
  5. /**
  6. * @fileoverview Block for the Arduino map functionality.
  7. * The Arduino built in functions syntax can be found at:
  8. * http://arduino.cc/en/Reference/HomePage
  9. *
  10. * TODO: This block can be improved to set the new range properly.
  11. */
  12. 'use strict';
  13. goog.require('Blockly.Blocks');
  14. goog.require('Blockly.Types');
  15. /** Common HSV hue for all blocks in this category. */
  16. Blockly.Blocks.variables.HUE = 330;
  17. Blockly.Blocks['define'] = {
  18. // init: function() {
  19. // this.appendValueInput("define_init")
  20. // .setCheck("define_var")
  21. // .appendField("define");
  22. // this.appendDummyInput()
  23. // .appendField("for");
  24. // this.appendValueInput("define_variable")
  25. // // .setCheck(["Number", "String"]);
  26. // // .setCheck(["Number", Blockly.Types.TEXT.checkList.concat('Array')]);
  27. // // .setCheck(Blockly.Types.TEXT.checkList.concat('Array');
  28. // // .setCheck(Blockly.Types.TEXT);
  29. // this.setPreviousStatement(true, null);
  30. // this.setNextStatement(true, null);
  31. // this.setColour(255);
  32. // this.setTooltip('LE');
  33. // this.setHelpUrl('');
  34. // }
  35. init: function() {
  36. this.appendValueInput("define_init")
  37. .setCheck("define_var")
  38. .appendField("define");
  39. this.appendDummyInput();
  40. this.appendValueInput("define_variable")
  41. .setCheck(["String", "Number"])
  42. .appendField("for");
  43. this.setPreviousStatement(true, null);
  44. this.setNextStatement(true, null);
  45. this.setColour(255);
  46. this.setTooltip('LE');
  47. this.setHelpUrl('');
  48. }
  49. };
  50. Blockly.Blocks['define_var'] = {
  51. init: function() {
  52. this.appendDummyInput()
  53. .appendField(new Blockly.FieldVariable("item"), "define_variable");
  54. this.setOutput(true, null);
  55. this.setColour(210);
  56. this.setTooltip('');
  57. this.setHelpUrl('');
  58. }
  59. };