From 9ca58570819d895261734076af45b4c8c5d7b075 Mon Sep 17 00:00:00 2001 From: Code WvS Date: Sun, 8 Mar 2015 12:01:54 +0100 Subject: differ between shapes and lines --- gui.js | 2 ++ objects.js | 6 ++++-- snap.html | 2 ++ store.js | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/gui.js b/gui.js index 8cd3aaa..ed01c23 100644 --- a/gui.js +++ b/gui.js @@ -2836,6 +2836,8 @@ IDE_Morph.prototype.newProject = function () { window.map.removeLayer(window.penTrails); } window.penTrails = L.layerGroup().addTo(window.map); + window.penShapes = L.layerGroup().addTo(window.penTrails); + window.penLines = L.layerGroup().addTo(window.penTrails); this.currentSprite = new SpriteMorph(this.globalVariables); this.sprites = new List([this.currentSprite]); diff --git a/objects.js b/objects.js index 87ee8b7..a1b28bc 100644 --- a/objects.js +++ b/objects.js @@ -3342,7 +3342,7 @@ SpriteMorph.prototype.drawLine = function (start, dest) { destLatLng, ], {color: this.color.toString(), weight: this.size}) - .addTo(window.penTrails); + .addTo(window.penLines); } else { var latlngs = window.polylines[this.myPolylineIndex].getLatLngs(); for (var j = 0; j < latlngs.length; j++) { @@ -3354,7 +3354,7 @@ SpriteMorph.prototype.drawLine = function (start, dest) { .concat([destLatLng]); L.polygon(polyLL, {color: this.color.toString(), weight: this.size}) - .addTo(window.penTrails); + .addTo(window.penShapes); break; } } @@ -4722,6 +4722,8 @@ StageMorph.prototype.drawOn = function (aCanvas, aRect) { StageMorph.prototype.clearPenTrails = function () { window.map.removeLayer(window.penTrails); window.penTrails = L.layerGroup().addTo(window.map); + window.penShapes = L.layerGroup().addTo(window.penTrails); + window.penLines = L.layerGroup().addTo(window.penTrails); this.trailsCanvas = newCanvas(this.dimensions); this.changed(); }; diff --git a/snap.html b/snap.html index 597ac17..4542c92 100755 --- a/snap.html +++ b/snap.html @@ -121,6 +121,8 @@ // so polylines contains complete lines created by different sprites. // These lines might be (partially) transformed into polygons. window.penTrails = L.layerGroup().addTo(map); + window.shapes = L.layerGroup().addTo(window.penTrails); + window.lines = L.layerGroup().addTo(window.penTrails); window.polylines = polylines; polylineIndex = 0; polylines = []; diff --git a/store.js b/store.js index ad7cf82..9e7c1f8 100644 --- a/store.js +++ b/store.js @@ -1346,6 +1346,8 @@ SnapSerializer.prototype.openProject = function (project, ide) { // TODO: "pen trails" are not saved window.map.removeLayer(window.penTrails); window.penTrails = L.layerGroup().addTo(window.map); + window.penShapes = L.layerGroup().addTo(window.penTrails); + window.penLines = L.layerGroup().addTo(window.penTrails); sprites.forEach(function (sprite) { // create the markers -- cgit v1.3.1