Changeset 55

Show
Ignore:
Timestamp:
29/08/06 20:52:52 (2 years ago)
Author:
al
Message:

updating excanvas.js to the latest SVN

Files:

Legend:

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

    r24 r55  
    5454        ss.cssText = "canvas{display:inline-block;overflow:hidden;" + 
    5555            "text-align:left;}" + 
    56             "canvas *{behavior:url(#default#VML)}"; 
     56            "g_vml_\\:*{behavior:url(#default#VML)}"; 
    5757 
    5858        // find all canvas elements 
     
    259259 
    260260    this.element_ = el; 
     261    this.arcScaleX_ = 1; 
     262    this.arcScaleY_ = 1; 
    261263  }; 
    262264 
     
    302304  contextPrototype.arc = function(aX, aY, aRadius, 
    303305                                  aStartAngle, aEndAngle, aClockwise) { 
    304     if (!aClockwise) { 
    305       var t = aStartAngle; 
    306       aStartAngle = aEndAngle; 
    307       aEndAngle = t; 
    308     } 
    309  
    310306    aRadius *= 10; 
     307    var arcType = aClockwise ? "at" : "wa"; 
    311308 
    312309    var xStart = aX + (mc(aStartAngle) * aRadius) - 5; 
     
    316313    var yEnd = aY + (ms(aEndAngle) * aRadius) - 5; 
    317314 
    318     this.currentPath_.push({type: "arc"
     315    this.currentPath_.push({type: arcType
    319316                           x: aX, 
    320317                           y: aY, 
     
    508505                     mr(c2.x), ",", mr(c2.y), ",", 
    509506                     mr(c.x), ",", mr(c.y)); 
    510       } else if (p.type == "arc") { 
    511         lineStr.push(" ar "); 
     507      } else if (p.type == "at" || p.type == "wa") { 
     508        lineStr.push(" ", p.type, " "); 
    512509        var c  = this.getCoords_(p.x, p.y); 
    513510        var cStart = this.getCoords_(p.xStart, p.yStart); 
    514511        var cEnd = this.getCoords_(p.xEnd, p.yEnd); 
    515512 
    516         // TODO: FIX (matricies (scale+rotation) now buggered this up) 
    517         //       VML arc also doesn't seem able to do rotated non-circular 
    518         //       arcs without parent grouping. 
    519         var absXScale = this.m_[0][0]; 
    520         var absYScale = this.m_[1][1]; 
    521  
    522         lineStr.push(mr(c.x - absXScale * p.radius), ",", 
    523                      mr(c.y - absYScale * p.radius), " ", 
    524                      mr(c.x + absXScale * p.radius), ",", 
    525                      mr(c.y + absYScale * p.radius), " ", 
     513        lineStr.push(mr(c.x - this.arcScaleX_ * p.radius), ",", 
     514                     mr(c.y - this.arcScaleY_ * p.radius), " ", 
     515                     mr(c.x + this.arcScaleX_ * p.radius), ",", 
     516                     mr(c.y + this.arcScaleY_ * p.radius), " ", 
    526517                     mr(cStart.x), ",", mr(cStart.y), " ", 
    527518                     mr(cEnd.x), ",", mr(cEnd.y)); 
     
    682673 
    683674  contextPrototype.scale = function(aX, aY) { 
     675    this.arcScaleX_ *= aX; 
     676    this.arcScaleY_ *= aY; 
    684677    var m1 = [ 
    685678      [aX, 0,  0],