diff --git a/NEWS.md b/NEWS.md index b47c8cb..90ad945 100644 --- a/NEWS.md +++ b/NEWS.md @@ -155,6 +155,9 @@ The base and overlay canvas are now using the CSS classes "flot-base" and - Prevented several local variables from becoming global. (patch by aaa707) + - Ensure that the overlay and primary canvases remain aligned. (issue #670, + pull request #901) + ## Flot 0.7 ## ### API changes ### diff --git a/jquery.flot.js b/jquery.flot.js index b82a2ad..6d5d3a7 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -738,15 +738,13 @@ Licensed under the MIT license. return devicePixelRatio / backingStoreRatio; } - function makeCanvas(skipPositioning, cls) { + function makeCanvas(cls) { var c = document.createElement('canvas'); c.className = cls; - if (!skipPositioning) - $(c).css({ position: 'absolute', left: 0, top: 0 }); - - $(c).appendTo(placeholder); + $(c).css({ position: 'absolute', left: 0, top: 0 }) + .appendTo(placeholder); // If HTML5 Canvas isn't available, fall back to Excanvas @@ -842,8 +840,8 @@ Licensed under the MIT license. getCanvasDimensions(); - canvas = makeCanvas(true, "flot-base"); - overlay = makeCanvas(false, "flot-overlay"); // overlay canvas for interactive features + canvas = makeCanvas("flot-base"); + overlay = makeCanvas("flot-overlay"); // overlay canvas for interactive features reused = false; }