diff --git a/js/activity-works.js b/js/activity-works.js index 4adef83..108eb6e 100644 --- a/js/activity-works.js +++ b/js/activity-works.js @@ -1,9 +1,7 @@ define(function (require) { var activity = require("sugar-web/activity/activity"); var icon = require("sugar-web/graphics/icon"); - require("easel"); - require("handlebars"); - var shapes = require("activity/shapes"); + // Manipulate the DOM only when it is ready. require(['domReady!'], function (doc) { @@ -16,25 +14,22 @@ define(function (require) { icon.colorize(activityButton, colors); }); - // Handle New Button Click var newButton = document.getElementById("new-button"); newButton.onclick = function () { new_positions(); } - // Handle Stop Button Click var stopButton = document.getElementById("stop-button"); stopButton.addEventListener('click', function (e) { activity.close(); }); - // Handle Clear Button Click var clearButton = document.getElementById("clear-button"); // **New Line** clearButton.addEventListener('click', clearCanvas); // **New Line** // Then create a list of the label elements - var nlabels = []; - for (var i = 0; i < 21; i++) { + nlabels = []; + for (i = 0; i < 21; i++) { nlabels[i] = document.getElementById("n" + i.toString()); } @@ -64,7 +59,6 @@ define(function (require) { var Pen = "images/pen.svg"; var shape = 0; - // Get things started init(); function init() { @@ -276,9 +270,6 @@ define(function (require) { shape = shape + 1; } - /** - * Clear the canvas and reset the activity state. - */ /** * Clear the canvas and reset the drawing lines. * This function removes only the drawn lines without affecting the turtles' positions. @@ -292,8 +283,6 @@ define(function (require) { oldPt = new createjs.Point(400, 300); midPt = oldPt; oldMidPt = oldPt; - - // Update the stage to reflect changes update = true; } }); diff --git a/js/activity.js b/js/activity.js index 4adef83..421d424 100644 --- a/js/activity.js +++ b/js/activity.js @@ -16,25 +16,21 @@ define(function (require) { icon.colorize(activityButton, colors); }); - // Handle New Button Click var newButton = document.getElementById("new-button"); newButton.onclick = function () { new_positions(); } - // Handle Stop Button Click var stopButton = document.getElementById("stop-button"); stopButton.addEventListener('click', function (e) { activity.close(); }); - - // Handle Clear Button Click var clearButton = document.getElementById("clear-button"); // **New Line** clearButton.addEventListener('click', clearCanvas); // **New Line** // Then create a list of the label elements - var nlabels = []; - for (var i = 0; i < 21; i++) { + nlabels = []; + for (i = 0; i < 21; i++) { nlabels[i] = document.getElementById("n" + i.toString()); } @@ -64,7 +60,6 @@ define(function (require) { var Pen = "images/pen.svg"; var shape = 0; - // Get things started init(); function init() { @@ -276,9 +271,6 @@ define(function (require) { shape = shape + 1; } - /** - * Clear the canvas and reset the activity state. - */ /** * Clear the canvas and reset the drawing lines. * This function removes only the drawn lines without affecting the turtles' positions. @@ -292,8 +284,6 @@ define(function (require) { oldPt = new createjs.Point(400, 300); midPt = oldPt; oldMidPt = oldPt; - - // Update the stage to reflect changes update = true; } });