summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-02-28 13:06:33 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-02-28 13:06:33 +0100
commite4e487c7a3b5a792e63e20be6a3b902a292e8d59 (patch)
tree1c51686270f2ac28f9ab4785d551b1c32921f48e
parent14369802342f49a440ce0700c4b86ef8682155ba (diff)
downloadsnap-yow-e4e487c7a3b5a792e63e20be6a3b902a292e8d59.tar.gz
snap-yow-e4e487c7a3b5a792e63e20be6a3b902a292e8d59.zip
attempt to fix marker loading problems
-rw-r--r--gui.js7
-rw-r--r--store.js14
2 files changed, 13 insertions, 8 deletions
diff --git a/gui.js b/gui.js
index 875a3d2..a914f08 100644
--- a/gui.js
+++ b/gui.js
@@ -212,9 +212,6 @@ IDE_Morph.prototype.init = function (isAutoFill) {
this.globalVariables = new VariableFrame();
- // recreate all Sprite markers (Snap-YOW)
- window.spriteGroup = L.layerGroup().addTo(window.map);
-
this.currentSprite = new SpriteMorph(this.globalVariables);
this.sprites = new List([this.currentSprite]);
this.currentCategory = 'map';
@@ -2803,7 +2800,9 @@ IDE_Morph.prototype.newProject = function () {
this.globalVariables = new VariableFrame();
// recreate all Sprite markers (Snap-YOW)
- window.map.removeLayer(window.spriteGroup);
+ if (window.map.hasLayer(window.spriteGroup)) {
+ window.map.removeLayer(window.spriteGroup);
+ }
window.spriteGroup = L.layerGroup().addTo(window.map);
this.currentSprite = new SpriteMorph(this.globalVariables);
diff --git a/store.js b/store.js
index d810985..8d78578 100644
--- a/store.js
+++ b/store.js
@@ -1313,10 +1313,6 @@ SnapSerializer.prototype.openProject = function (project, ide) {
sprites = [],
sprite;
- // recreate all Sprite markers (Snap-YOW)
- window.map.removeLayer(window.spriteGroup);
- window.spriteGroup = L.layerGroup().addTo(window.map);
-
if (!project || !project.stage) {
return;
}
@@ -1337,6 +1333,16 @@ SnapSerializer.prototype.openProject = function (project, ide) {
return x.idx - y.idx;
});
+ // Snap! YOW
+ // recreate all Sprite markers (Snap-YOW)
+ window.map.removeLayer(window.spriteGroup);
+ window.spriteGroup = L.layerGroup().addTo(window.map);
+
+ sprites.forEach(function (sprite) {
+ // create the markers
+ sprite.updateMarker();
+ });
+
ide.sprites = new List(sprites);
sprite = sprites[0] || project.stage;