diff --git a/js/activity.js b/js/activity.js index 6d78143..e9fc15f 100644 --- a/js/activity.js +++ b/js/activity.js @@ -51,7 +51,7 @@ define(function (require) { var Star = "images/star.svg"; var Dot = "images/dot.svg"; var Pen = "images/pen.svg"; - var shape = -1; + var shape = 0; // Get things started init(); @@ -96,7 +96,6 @@ define(function (require) { // Create a drawing canvas drawingCanvas = new createjs.Shape(); stage.addChild(drawingCanvas); - new_positions(); stage.update(); } @@ -225,37 +224,26 @@ define(function (require) { } function new_positions() { - if (shape == -1) { - shape = 0; - return; - } for (i = 0; i < bitmaps.length; i++) { + var fontSize = 6; + var ovrhdX = i.toString().length * fontSize; + var ovrhdY = fontSize + 4; if (shape < shapes.length) { if (i < shapes[shape].length) { - var shapeX = shapes[shape][i][0]; - var shapeY = shapes[shape][i][1]; - var fontSize = 6; - var ovrhdX = i.toString().length * fontSize; - var ovrhdY = fontSize + 4; - bitmaps[i].x = shapeX; - bitmaps[i].y = shapeY; - bitmapLabels[i].x = shapeX - ovrhdX; - bitmapLabels[i].y = shapeY - ovrhdY; + bitmaps[i].x = shapes[shape][i][0]; + bitmaps[i].y = shapes[shape][i][1]; } else { - var outRange = -100; - bitmaps[i].x = outRange; - bitmaps[i].y = outRange; - bitmapLabels[i].x = outRange; - bitmapLabels[i].y = outRange; + bitmaps[i].x = -100; + bitmaps[i].y = -100; } } else { bitmaps[i].x = canvas.width * Math.random() | 0; bitmaps[i].y = canvas.height * Math.random() | 0; - bitmapLabels[i].x = canvas.width * Math.random() | 0; - bitmapLabels[i].y = canvas.height * Math.random() | 0; } + bitmapLabels[i].x = bitmaps[i].x - ovrhdX; + bitmapLabels[i].y = bitmaps[i].y - ovrhdY; } pen_bitmap.x = bitmaps[0].x; pen_bitmap.y = bitmaps[0].y;