Changeset 55
- Timestamp:
- 29/08/06 20:52:52 (2 years ago)
- Files:
-
- plotkit/trunk/PlotKit/excanvas.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plotkit/trunk/PlotKit/excanvas.js
r24 r55 54 54 ss.cssText = "canvas{display:inline-block;overflow:hidden;" + 55 55 "text-align:left;}" + 56 " canvas*{behavior:url(#default#VML)}";56 "g_vml_\\:*{behavior:url(#default#VML)}"; 57 57 58 58 // find all canvas elements … … 259 259 260 260 this.element_ = el; 261 this.arcScaleX_ = 1; 262 this.arcScaleY_ = 1; 261 263 }; 262 264 … … 302 304 contextPrototype.arc = function(aX, aY, aRadius, 303 305 aStartAngle, aEndAngle, aClockwise) { 304 if (!aClockwise) {305 var t = aStartAngle;306 aStartAngle = aEndAngle;307 aEndAngle = t;308 }309 310 306 aRadius *= 10; 307 var arcType = aClockwise ? "at" : "wa"; 311 308 312 309 var xStart = aX + (mc(aStartAngle) * aRadius) - 5; … … 316 313 var yEnd = aY + (ms(aEndAngle) * aRadius) - 5; 317 314 318 this.currentPath_.push({type: "arc",315 this.currentPath_.push({type: arcType, 319 316 x: aX, 320 317 y: aY, … … 508 505 mr(c2.x), ",", mr(c2.y), ",", 509 506 mr(c.x), ",", mr(c.y)); 510 } else if (p.type == "a rc") {511 lineStr.push(" ar");507 } else if (p.type == "at" || p.type == "wa") { 508 lineStr.push(" ", p.type, " "); 512 509 var c = this.getCoords_(p.x, p.y); 513 510 var cStart = this.getCoords_(p.xStart, p.yStart); 514 511 var cEnd = this.getCoords_(p.xEnd, p.yEnd); 515 512 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), " ", 526 517 mr(cStart.x), ",", mr(cStart.y), " ", 527 518 mr(cEnd.x), ",", mr(cEnd.y)); … … 682 673 683 674 contextPrototype.scale = function(aX, aY) { 675 this.arcScaleX_ *= aX; 676 this.arcScaleY_ *= aY; 684 677 var m1 = [ 685 678 [aX, 0, 0],




Atom Feed for the Blog Entries