diff options
| author | Code WvS <code-wvs@quantentunnel.de> | 2015-02-27 19:17:01 +0100 |
|---|---|---|
| committer | Code WvS <code-wvs@quantentunnel.de> | 2015-02-27 19:17:01 +0100 |
| commit | 32c3612296c927c23b08c944619aa5ff8611d03b (patch) | |
| tree | 671a550d8bed91ee982ced3156a11d078a13a23c | |
| parent | 35d3ec1170634e2330eb1a1493d38510081a95ad (diff) | |
| download | snap-yow-32c3612296c927c23b08c944619aa5ff8611d03b.tar.gz snap-yow-32c3612296c927c23b08c944619aa5ff8611d03b.zip | |
add marker click event
| -rw-r--r-- | objects.js | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; |
