summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--objects.js10
-rwxr-xr-xsnap.html3
2 files changed, 12 insertions, 1 deletions
diff --git a/objects.js b/objects.js
index 0f0514d..92367f1 100644
--- a/objects.js
+++ b/objects.js
@@ -3176,6 +3176,9 @@ SpriteMorph.prototype.clearEffects = function () {
// SpriteMorph talk bubble
SpriteMorph.prototype.stopTalking = function () {
+ if (window.map.hasLayer(this.popup)) {
+ window.map.removeLayer(this.popup);
+ }
var bubble = this.talkBubble();
if (bubble) {bubble.destroy(); }
};
@@ -3190,6 +3193,13 @@ SpriteMorph.prototype.bubble = function (data, isThought, isQuestion) {
this.stopTalking();
if (data === '' || isNil(data)) {return; }
+
+ // Snap! YOW
+ this.popup = L.popup()
+ .setLatLng([this.yPosition(), this.xPosition()])
+ .setContent(data)
+ .addTo(window.map);
+
bubble = new SpriteBubbleMorph(
data,
stage ? stage.scale : 1,
diff --git a/snap.html b/snap.html
index b13115a..81ec7a9 100755
--- a/snap.html
+++ b/snap.html
@@ -72,7 +72,8 @@
// initialize leaflet
map = L.map('map', {
- keyboard: false
+ keyboard: false,
+ closePopupOnClick: false
}).setView([52.5170365, 13.3888599], 10);
// The map steals the key events, so the 'world' canvas has to be focused
map.on('mouseover', function() {document.getElementById('world').focus();});