From 200cb7423b8952fe7770ce8abed9f3f8383d9a61 Mon Sep 17 00:00:00 2001 From: Code WvS Date: Sat, 28 Feb 2015 15:38:59 +0100 Subject: add popups as speech bubbles --- objects.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'objects.js') 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, -- cgit v1.3.1