not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
1.9 KiB

  1. define(["sugar-web/activity/activity",'easeljs','tweenjs','activity/editor','activity/colourcircle','activity/xoman'], function (act) {
  2. // Manipulate the DOM only when it is ready.
  3. requirejs(['domReady!'], function (doc) {
  4. // Initialize the activity.
  5. requirejs(['sugar-web/graphics/xocolor',"sugar-web/env","sugar-web/datastore"], function(xocol,env,datastore) {
  6. act.setup();
  7. act.getXOColor(function (error, colors) {
  8. runactivity(act,xocol,doc,colors,env,datastore);
  9. });
  10. });
  11. });
  12. });
  13. function runactivity(act,xocolor,doc,colors,env,datastore){
  14. var canvas;
  15. var stage;
  16. var g;
  17. var e;
  18. function init(){
  19. canvas = document.getElementById('actualcanvas');
  20. canvas.width = window.innerWidth;
  21. canvas.height = window.innerHeight-55;
  22. stage = new createjs.Stage(canvas);
  23. stage.update();
  24. stage.mouseEventsEnabled = true;
  25. createjs.Ticker.setFPS(30);
  26. createjs.Ticker.addEventListener("tick", handleTick);
  27. function handleTick() {
  28. stage.update();
  29. }
  30. window.addEventListener('resize', resizeCanvas, false);
  31. function resizeCanvas() {
  32. canvas.width = window.innerWidth;
  33. canvas.height = window.innerHeight-55;
  34. stage.update();
  35. location.reload();
  36. }
  37. e = new Editor(stage,xocolor,doc,colors,act,env,datastore);
  38. setTimeout(function(){ e.init(); }, 500);
  39. var saveButton = doc.getElementById("save-button");
  40. saveButton.addEventListener('click', function (a) {
  41. e.saveColours();
  42. });
  43. var resetButton = doc.getElementById("reset-button");
  44. resetButton.addEventListener('click', function (a) {
  45. stage.removeAllChildren();
  46. e = new Editor(stage,xocolor,doc,colors,act,env,datastore,true);
  47. e.init();
  48. });
  49. document.getElementById("stop-button").addEventListener('click', function (event) {
  50. e.stop();
  51. });
  52. }
  53. init();
  54. }