client/js/renderer/shapebuilder.js
changeset 458 423bdf56d103
parent 441 4732f078d0fe
child 467 fd2b5a7ec356
equal deleted inserted replaced
457:b38cf3d4cf1f 458:423bdf56d103
    33         "polygon":{
    33         "polygon":{
    34             getShape: function() {
    34             getShape: function() {
    35                 return new paper.Path.RegularPolygon([0, 0], 6, 1);
    35                 return new paper.Path.RegularPolygon([0, 0], 6, 1);
    36             },
    36             },
    37             getImageShape: function(center, radius) {
    37             getImageShape: function(center, radius) {
    38                 return new paper.Path.RegularPolygon([0, 0], 6, radius);
    38                 return new paper.Path.RegularPolygon(center, 6, radius);
    39             }
    39             }
    40         },
    40         },
    41         "diamond":{
    41         "diamond":{
    42             getShape: function() {
    42             getShape: function() {
    43                 var d = new paper.Path.Rectangle([-Math.SQRT2, -Math.SQRT2], [Math.SQRT2, Math.SQRT2]);
    43                 var d = new paper.Path.Rectangle([-Math.SQRT2, -Math.SQRT2], [Math.SQRT2, Math.SQRT2]);
    53         "star":{
    53         "star":{
    54             getShape: function() {
    54             getShape: function() {
    55                 return new paper.Path.Star([0, 0], 8, 1, 0.7);
    55                 return new paper.Path.Star([0, 0], 8, 1, 0.7);
    56             },
    56             },
    57             getImageShape: function(center, radius) {
    57             getImageShape: function(center, radius) {
    58                 return new paper.Path.Star([0, 0], 8, radius*1, radius*0.7);
    58                 return new paper.Path.Star(center, 8, radius*1, radius*0.7);
    59             }
    59             }
    60         },
    60         },
    61         "cloud": {
    61         "cloud": {
    62             getShape: function() {
    62             getShape: function() {
    63                 var path = new paper.Path(cloud_path);
    63                 var path = new paper.Path(cloud_path);
    67             getImageShape: function(center, radius) {
    67             getImageShape: function(center, radius) {
    68                 var path = new paper.Path(cloud_path);
    68                 var path = new paper.Path(cloud_path);
    69                 path.scale(radius);
    69                 path.scale(radius);
    70                 path.translate(center);
    70                 path.translate(center);
    71                 return path;
    71                 return path;
       
    72             }
       
    73         },
       
    74         "triangle": {
       
    75             getShape: function() {
       
    76                 return new paper.Path.RegularPolygon([0,0], 3, 1);
       
    77             },
       
    78             getImageShape: function(center, radius) {
       
    79                 return new paper.Path.RegularPolygon(center, 3, radius);
    72             }
    80             }
    73         },
    81         },
    74         "svg": function(path){
    82         "svg": function(path){
    75             return {
    83             return {
    76                 getShape: function() {
    84                 getShape: function() {
    95             shape = "circle";
   103             shape = "circle";
    96         }
   104         }
    97         return builders[shape];
   105         return builders[shape];
    98     };
   106     };
    99 
   107 
       
   108     ShapeBuilder.builders = builders;
       
   109 
   100     return ShapeBuilder;
   110     return ShapeBuilder;
   101 
   111 
   102 });
   112 });