summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
Diffstat (limited to 'objects.js')
-rw-r--r--objects.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/objects.js b/objects.js
index c99e9af..dd4954b 100644
--- a/objects.js
+++ b/objects.js
@@ -1400,7 +1400,10 @@ SpriteMorph.prototype.updateMarker = function () {
// sadly, the name can not be changed on the fly, so the element has to be recreated
// TODO: XSS? Extend L.Icon?
if (!this.marker) return;
+ var myself = this;
+
window.spriteGroup.removeLayer(this.marker);
+
this.icon = L.divIcon({
className: 'snap-sprite',
html: '<div id="icon-' + this.name + '"></div>',
@@ -1409,6 +1412,10 @@ SpriteMorph.prototype.updateMarker = function () {
});
this.marker = L.spriteMarker(this.geoposition, {icon: this.icon, title: this.name});
+ this.marker.on('click', function () {
+ myself.mouseClickLeft();
+ });
+
facing = this.rotationStyle ? this.heading : 90;
if (this.rotationStyle === 2) {
facing = 90;