blocklyでobjectを動かす。その18
概要
blocklyでobjectを動かす。
leafletにmarkerを立ててみる。
stageを書く。
function marker(src) {
var line = src.split(",");
L.marker([line[0], line[1]], {
title: line[2]
}).addTo(map);
}
var map = L.map('map').setView([35.65858404, 139.74543162], 12);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
objectを書く。
Blockly.Blocks.marker = {
init: function() {
this.jsonInit({
message0: "marker %1",
args0: [{
type: "input_value",
name: "TEXT"
}],
previousStatement: null,
nextStatement: null,
style: "text_blocks",
tooltip: Blockly.Msg.TEXT_PRINT_TOOLTIP,
helpUrl: Blockly.Msg.TEXT_PRINT_HELPURL
})
}};
Blockly.JavaScript.marker = function(a) {
return "marker(" + (Blockly.JavaScript.valueToCode(a, "TEXT", Blockly.JavaScript.ORDER_NONE) || "''") + ");\n"
};
フローを書く。
function marker(src) {
var line = src.split(",");
L.marker([line[0], line[1]], {
title: line[2]
}).addTo(map);
}
var map = L.map('map').setView([35.65858404, 139.74543162], 12);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
Blockly.Blocks.marker = {
init: function() {
this.jsonInit({
message0: "marker %1",
args0: [{
type: "input_value",
name: "TEXT"
}],
previousStatement: null,
nextStatement: null,
style: "text_blocks",
tooltip: Blockly.Msg.TEXT_PRINT_TOOLTIP,
helpUrl: Blockly.Msg.TEXT_PRINT_HELPURL
})
}};
Blockly.JavaScript.marker = function(a) {
return "marker(" + (Blockly.JavaScript.valueToCode(a, "TEXT", Blockly.JavaScript.ORDER_NONE) || "''") + ");\n"
};
フローを書く。
写真
成果物
以上。
Author And Source
この問題について(blocklyでobjectを動かす。その18), 我々は、より多くの情報をここで見つけました https://qiita.com/ohisama@github/items/bd5d83f0b5f5722cd383著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .