From c71147a2fccf5d6ebd8a1eabd41e10b134248070 Mon Sep 17 00:00:00 2001 From: Code WvS Date: Sun, 8 Feb 2015 15:24:05 +0100 Subject: improve initial world loading; prepare conversion of sprites to "persons" --- objects.js | 20 ++++++++++++++++++-- snap.html | 40 ++++++++++++++++++++++++---------------- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/objects.js b/objects.js index af21b6d..3ea2879 100644 --- a/objects.js +++ b/objects.js @@ -215,6 +215,7 @@ SpriteMorph.prototype.initBlocks = function () { defaults: [null, 12] }, addMarker: { + dev: true, type: 'command', category: 'map', spec: 'add a marker to %l' @@ -1358,6 +1359,16 @@ SpriteMorph.prototype.init = function (globals) { this.isDraggable = true; this.isDown = false; + // Snap! - YOW code + this.icon = L.icon({ + iconUrl: 'images/marker-icon.png', + iconRetinaUrl: 'images/marker-icon-2x.png', + shadowUrl: 'images/marker-shadow.png' + }); + this.geoposition = window.map.getCenter(); + this.marker = L.marker(this.geoposition, {icon: this.icon, title: this.name}); + this.marker.addTo(window.map); + this.heading = 90; this.changed(); this.drawNew(); @@ -1724,7 +1735,10 @@ SpriteMorph.prototype.blockTemplates = function (category) { blocks.push(block('reportLocation')); blocks.push(block('focusMap')); - blocks.push(block('addMarker')); + + //if (this.world().isDevMode) { + blocks.push(block('addMarker')); + //} } /* else if (cat === 'motion') { @@ -4910,7 +4924,9 @@ StageMorph.prototype.blockTemplates = function (category) { blocks.push(block('reportLocation')); blocks.push(block('focusMap')); - blocks.push(block('addMarker')); + if (this.world().isDevMode) { + blocks.push(block('addMarker')); + } } /* else if (cat === 'motion') { diff --git a/snap.html b/snap.html index 47184f0..f2c323f 100755 --- a/snap.html +++ b/snap.html @@ -21,35 +21,43 @@ -
-- cgit v1.3.1