From 32c3612296c927c23b08c944619aa5ff8611d03b Mon Sep 17 00:00:00 2001 From: Code WvS Date: Fri, 27 Feb 2015 19:17:01 +0100 Subject: add marker click event --- objects.js | 7 +++++++ 1 file changed, 7 insertions(+) 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: '
', @@ -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; -- cgit v1.3.1