Commit 5d9eb590 authored by olau@iola.dk's avatar olau@iola.dk

Update excanvas to latest release instead of SVN checkout and add hack to make...

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
parent 5144848c
...@@ -91,9 +91,9 @@ Bug fixes: ...@@ -91,9 +91,9 @@ Bug fixes:
prevent it from overlapping the plot itself. This also fixes a prevent it from overlapping the plot itself. This also fixes a
problem with anti-aliasing when the width is 1 pixel (reported by problem with anti-aliasing when the width is 1 pixel (reported by
Anthony Ettinger). 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 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 - Changed the shadow code for lines to hopefully look a bit better
with vertical lines. with vertical lines.
- Round tick positions to avoid possible problems with fractions - Round tick positions to avoid possible problems with fractions
......
...@@ -797,6 +797,33 @@ if (!document.createElement('canvas').getContext) { ...@@ -797,6 +797,33 @@ if (!document.createElement('canvas').getContext) {
this.m_ = this.mStack_.pop(); 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) { contextPrototype.translate = function(aX, aY) {
var m1 = [ var m1 = [
[1, 0, 0], [1, 0, 0],
...@@ -804,7 +831,7 @@ if (!document.createElement('canvas').getContext) { ...@@ -804,7 +831,7 @@ if (!document.createElement('canvas').getContext) {
[aX, aY, 1] [aX, aY, 1]
]; ];
this.m_ = matrixMultiply(m1, this.m_); setM(this, matrixMultiply(m1, this.m_), false);
}; };
contextPrototype.rotate = function(aRot) { contextPrototype.rotate = function(aRot) {
...@@ -817,7 +844,7 @@ if (!document.createElement('canvas').getContext) { ...@@ -817,7 +844,7 @@ if (!document.createElement('canvas').getContext) {
[0, 0, 1] [0, 0, 1]
]; ];
this.m_ = matrixMultiply(m1, this.m_); setM(this, matrixMultiply(m1, this.m_), false);
}; };
contextPrototype.scale = function(aX, aY) { contextPrototype.scale = function(aX, aY) {
...@@ -829,14 +856,27 @@ if (!document.createElement('canvas').getContext) { ...@@ -829,14 +856,27 @@ if (!document.createElement('canvas').getContext) {
[0, 0, 1] [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. setM(this, m, true);
// 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));
}; };
/******** STUBS ********/ /******** STUBS ********/
......
This diff is collapsed.
...@@ -481,6 +481,9 @@ ...@@ -481,6 +481,9 @@
if (canvasWidth <= 0 || canvasHeight <= 0) if (canvasWidth <= 0 || canvasHeight <= 0)
throw "Invalid dimensions for plot, width = " + canvasWidth + ", height = " + canvasHeight; 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 // the canvas
canvas = $(makeCanvas(canvasWidth, canvasHeight)).appendTo(target).get(0); canvas = $(makeCanvas(canvasWidth, canvasHeight)).appendTo(target).get(0);
ctx = canvas.getContext("2d"); ctx = canvas.getContext("2d");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment