summaryrefslogtreecommitdiff
path: root/snap.html
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-03-22 10:00:29 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-03-22 10:00:29 +0100
commitf6a5169f7f9673d298f3e2016f8a1cd834d79530 (patch)
tree7effbf4877261db00a77be21e48096acc1730407 /snap.html
parent3d03f9eb5cfe018fa570c95b2a58b3938665c5c6 (diff)
downloadsnap-yow-f6a5169f7f9673d298f3e2016f8a1cd834d79530.tar.gz
snap-yow-f6a5169f7f9673d298f3e2016f8a1cd834d79530.zip
allow drawing lines and shapes; use a different approach to close polygons
Diffstat (limited to 'snap.html')
-rwxr-xr-xsnap.html23
1 files changed, 13 insertions, 10 deletions
diff --git a/snap.html b/snap.html
index cd55673..06843c8 100755
--- a/snap.html
+++ b/snap.html
@@ -60,7 +60,7 @@
};
// Snap! YOW starts here
- var world, map, layer, spriteGroup, polylines, polylineIndex;
+ var world, map, layer, spriteGroup;
function loop() {
world.doOneCycle();
@@ -118,16 +118,19 @@
window.spriteGroup = spriteGroup;
spriteGroup = L.layerGroup().addTo(map);
- // During a pen down, a polyline is updated at polylines[this.myPolylineIndex].
- // On pen up, myPolylineIndex is set to polylineIndex and polylineIndex is incremented
- // so polylines contains complete lines created by different sprites.
- // These lines might be (partially) transformed into polygons.
+ // During a pen down, a polything (thing = line/shape) is updated
+ // at polything[this.myPolythingIndex].
+ // On pen down, myPolythingIndex is set to window.polythingIndex and
+ // window.polythingIndex is incremented
+ // so window.polygons and window.polylines contain
+ // polygons/lines created by all sprites.
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 = [];
+ window.penShapes = L.layerGroup().addTo(window.penTrails);
+ window.penLines = L.layerGroup().addTo(window.penTrails);
+ window.polygons = [];
+ window.polylines = [];
+ window.polygonIndex = 0;
+ window.polylineIndex = 0;
// Load the IDE
world = new WorldMorph(document.getElementById('world'));