Commit 906b2f95 authored by David Schnur's avatar David Schnur

Merge pull request #77 from julthomas/makecanvas-ie8

Fix makeCanvas for IE, broken by Retina support introduced in 179d2e1d.
parents 7a229212 2e892074
......@@ -724,9 +724,11 @@
// therefore has a pixel ratio of 2, while most normal devices have a ratio of 1.
function getPixelRatio(cctx) {
if (window.devicePixelRatio > 1 && (cctx.webkitBackingStorePixelRatio === undefined || cctx.webkitBackingStorePixelRatio < 2)) {
if (window.devicePixelRatio > 1 &&
(cctx.webkitBackingStorePixelRatio === undefined ||
cctx.webkitBackingStorePixelRatio < 2))
return window.devicePixelRatio;
}
return 1;
}
......@@ -735,6 +737,11 @@
var c = document.createElement('canvas');
c.className = cls;
if (!skipPositioning)
$(c).css({ position: 'absolute', left: 0, top: 0 });
$(c).appendTo(placeholder);
if (!c.getContext) // excanvas hack
c = window.G_vmlCanvasManager.initElement(c);
......@@ -752,11 +759,6 @@
c.style.width = canvasWidth + "px";
c.style.height = canvasHeight + "px";
if (!skipPositioning)
$(c).css({ position: 'absolute', left: 0, top: 0 });
$(c).appendTo(placeholder);
// Save the context so we can reset in case we get replotted
cctx.save();
......@@ -780,7 +782,7 @@
function resizeCanvas(c) {
var cctx = c.getContext("2d");
var cctx = c.getContext("2d");
// Handle pixel ratios > 1 for retina displays, as explained in makeCanvas
......
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