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.

54 lines
1.4 KiB

  1. function ColourCircle(innercol, outercol, x, y, stage,xoman,arrno){
  2. this.scale = stage.canvas.width/1200;
  3. this.radius = 22.5*this.scale;
  4. this.strokewidth = 9.5*this.scale;
  5. this.innercol = innercol;
  6. this.outercol = outercol;
  7. this.circle = null;
  8. this.dragging = false;
  9. this.number = arrno;
  10. this.setContainerPosition = function(x,y){
  11. this.circle.x = x;
  12. this.circle.y = y;
  13. stage.addChild(this.circle);
  14. }
  15. this.setDragDropListeners = function(){
  16. var c = this.circle;
  17. var d = this;
  18. var s = stage;
  19. var xo = xoman;
  20. this.circle.on("mousedown", function (evt) {
  21. this.offset = {x: c.x - evt.stageX, y: c.y - evt.stageY};
  22. this.dragging = false;
  23. });
  24. this.circle.on("pressmove", function (evt) {
  25. c.x = evt.stageX + this.offset.x;
  26. c.y = evt.stageY + this.offset.y;
  27. this.dragging = true;
  28. });
  29. this.circle.on("click", function (evt) {
  30. if (this.dragging!=true){
  31. xo.updateSVG(d.innercol,d.outercol,d.number);
  32. }
  33. this.dragging = false;
  34. });
  35. }
  36. this.init = function(){
  37. this.number = arrno;
  38. var circle = new createjs.Shape();
  39. circle.graphics.beginFill(this.innercol).drawCircle(0,0,this.radius);
  40. circle.graphics.beginStroke(this.outercol);
  41. circle.graphics.setStrokeStyle(this.strokewidth);
  42. circle.graphics.drawCircle(0,0,this.radius);
  43. this.circle = circle;
  44. this.setContainerPosition(x,y);
  45. this.setDragDropListeners();
  46. }
  47. }