summaryrefslogtreecommitdiff
path: root/objects.js
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-02-27 19:17:01 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-02-27 19:17:01 +0100
commit32c3612296c927c23b08c944619aa5ff8611d03b (patch)
tree671a550d8bed91ee982ced3156a11d078a13a23c /objects.js
parent35d3ec1170634e2330eb1a1493d38510081a95ad (diff)
downloadsnap-yow-32c3612296c927c23b08c944619aa5ff8611d03b.tar.gz
snap-yow-32c3612296c927c23b08c944619aa5ff8611d03b.zip
add marker click event
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;