Sha256: 42549dbc97abcc740dfdf53975b811d16fed5cd1c02caf721daf8d4cce8f86c6
Contents?: true
Size: 1.27 KB
Versions: 30
Compression:
Stored size: 1.27 KB
Contents
# 「ペン」ジャンル <% category = 'pen' require 'smalruby_editor' require 'smalruby_editor/blockly_message_helper' color = SmalrubyEditor::COLORS[category.to_sym] %> # ペンを下ろす # ペンを上げる # <% %w(down_pen up_pen).each do |suffix| n = "#{category}_#{suffix}" %> Blockly.Blocks['<%= n %>'] = init: ()-> @setHelpUrl('') @setColour(<%= color %>) @appendDummyInput() .appendField(<%= bm(".#{suffix}") %>) @setPreviousStatement(true) @setNextStatement(true) @setTooltip('') Blockly.Ruby['<%= n %>'] = (block) -> Blockly.Ruby.characterMethodCall_('<%= suffix %>') <% end %> # ペンの色を[カラー]にする <% n = "#{category}_set_pen_color" %> Blockly.Blocks['<%= n %>'] = init: ()-> @setHelpUrl('') @setColour(<%= color %>) @interpolateMsg(<%= bm('.set_pen_color') %>, ['COLOUR', new Blockly.FieldColour('#ff0000')], Blockly.ALIGN_RIGHT) @setPreviousStatement(true) @setNextStatement(true) @setTooltip('') Blockly.Ruby['<%= n %>'] = (block) -> c = @getFieldValue('COLOUR') red = parseInt(c[1..2], 16) green = parseInt(c[3..4], 16) blue = parseInt(c[5..6], 16) Blockly.Ruby.characterSetVariable_('pen_color', "[#{red}, #{green}, #{blue}]")
Version data entries
30 entries across 30 versions & 1 rubygems