Changeset 69

Show
Ignore:
Timestamp:
11/06/07 23:35:12 (1 year ago)
Author:
al
Message:

Testing hitTest fixes for pie charts (Thanks to gacopys from plotkit page comments)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plotkit/trunk/PlotKit/Layout.js

    r64 r69  
    244244 
    245245    else if (this.style == "pie") { 
     246        x = 2 * x - 0.5; 
    246247        var dist = Math.sqrt((y-0.5)*(y-0.5) + (x-0.5)*(x-0.5)); 
    247248        if (dist > this.options.pieRadius) 
     
    250251        // TODO: actually doesn't work if we don't know how the Canvas 
    251252        //       lays it out, need to fix! 
    252         var angle = Math.atan2(y - 0.5, x - 0.5) - Math.PI/2; 
     253        var angle = 0.0; 
     254        if (y < 0.5 && x < 0.5) { 
     255            angle = Math.atan2(y - 0.5, x - 0.5) + 5 * Math.PI/2; 
     256        } 
     257        else { 
     258            angle = Math.atan2(y - 0.5, x - 0.5) + Math.PI/2; 
     259        } 
     260             
    253261        for (var i = 0; i < this.slices.length; i++) { 
    254262            var slice = this.slices[i]; 
  • plotkit/trunk/PlotKit/PlotKit_Packed.js

    r68 r69  
    395395}else{ 
    396396if(this.style=="pie"){ 
     397x=2*x-0.5; 
    397398var _71=Math.sqrt((y-0.5)*(y-0.5)+(x-0.5)*(x-0.5)); 
    398399if(_71>this.options.pieRadius){ 
    399400return null; 
    400401} 
    401 var _72=Math.atan2(y-0.5,x-0.5)-Math.PI/2; 
     402var _72=0; 
     403if(y<0.5&&x<0.5){ 
     404_72=Math.atan2(y-0.5,x-0.5)+5*Math.PI/2; 
     405}else{ 
     406_72=Math.atan2(y-0.5,x-0.5)+Math.PI/2; 
     407
    402408for(var i=0;i<this.slices.length;i++){ 
    403409var _73=this.slices[i];