0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

blocklyでobjectを動かす。その18

Posted at

概要

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: '&copy; <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"
};

フローを書く。

image.png

写真

image.png

成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?