Update excanvas to latest release instead of SVN checkout and add hack to make sure excanvas is initialized properly (issue 133)

git-svn-id: https://flot.googlecode.com/svn/trunk@151 1e0a6537-2640-0410-bfb7-f154510ff394
pull/1/head
olau@iola.dk 17 years ago
parent 5144848cc2
commit 5d9eb59065

@ -91,9 +91,9 @@ Bug fixes:
prevent it from overlapping the plot itself. This also fixes a
problem with anti-aliasing when the width is 1 pixel (reported by
Anthony Ettinger).
- Imported SVN version of excanvas and fixed an issue with the newer
- Imported version 3 of excanvas and fixed two issues with the newer
version. Hopefully, this will make Flot work with IE8 (nudge by
Fabien Menager).
Fabien Menager, further analysis by Booink, issue 133).
- Changed the shadow code for lines to hopefully look a bit better
with vertical lines.
- Round tick positions to avoid possible problems with fractions

@ -797,6 +797,33 @@ if (!document.createElement('canvas').getContext) {
this.m_ = this.mStack_.pop();
};
function matrixIsFinite(m) {
for (var j = 0; j < 3; j++) {
for (var k = 0; k < 2; k++) {
if (!isFinite(m[j][k]) || isNaN(m[j][k])) {
return false;
}
}
}
return true;
}
function setM(ctx, m, updateLineScale) {
if (!matrixIsFinite(m)) {
return;
}
ctx.m_ = m;
if (updateLineScale) {
// Get the line scale.
// Determinant of this.m_ means how much the area is enlarged by the
// transformation. So its square root can be used as a scale factor
// for width.
var det = m[0][0] * m[1][1] - m[0][1] * m[1][0];
ctx.lineScale_ = sqrt(abs(det));
}
}
contextPrototype.translate = function(aX, aY) {
var m1 = [
[1, 0, 0],
@ -804,7 +831,7 @@ if (!document.createElement('canvas').getContext) {
[aX, aY, 1]
];
this.m_ = matrixMultiply(m1, this.m_);
setM(this, matrixMultiply(m1, this.m_), false);
};
contextPrototype.rotate = function(aRot) {
@ -817,7 +844,7 @@ if (!document.createElement('canvas').getContext) {
[0, 0, 1]
];
this.m_ = matrixMultiply(m1, this.m_);
setM(this, matrixMultiply(m1, this.m_), false);
};
contextPrototype.scale = function(aX, aY) {
@ -829,14 +856,27 @@ if (!document.createElement('canvas').getContext) {
[0, 0, 1]
];
var m = this.m_ = matrixMultiply(m1, this.m_);
setM(this, matrixMultiply(m1, this.m_), true);
};
contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) {
var m1 = [
[m11, m12, 0],
[m21, m22, 0],
[dx, dy, 1]
];
setM(this, matrixMultiply(m1, this.m_), true);
};
contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) {
var m = [
[m11, m12, 0],
[m21, m22, 0],
[dx, dy, 1]
];
// Get the line scale.
// Determinant of this.m_ means how much the area is enlarged by the
// transformation. So its square root can be used as a scale factor
// for width.
var det = m[0][0] * m[1][1] - m[0][1] * m[1][0];
this.lineScale_ = sqrt(abs(det));
setM(this, m, true);
};
/******** STUBS ********/

2
excanvas.min.js vendored

File diff suppressed because one or more lines are too long

@ -481,6 +481,9 @@
if (canvasWidth <= 0 || canvasHeight <= 0)
throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight;
if ($.browser.msie) // excanvas hack
window.G_vmlCanvasManager.init_(document); // make sure everything is setup
// the canvas
canvas = $(makeCanvas(canvasWidth, canvasHeight)).appendTo(target).get(0);
ctx = canvas.getContext("2d");

Loading…
Cancel
Save