From d7c58b59f3be06ed1069e28fd1aa2776e6367eb6 Mon Sep 17 00:00:00 2001 From: David Schnur Date: Sat, 22 Dec 2012 13:24:15 -0500 Subject: [PATCH] Enforce left-to-right canvas layout orientation. When the placeholder has (or inherits) the HTML 'dir' attribute or CSS 'direction' we get unexpected results from text metrics, resulting in visual glitches on the axes. The suggested solution in #716 was to set ltr on the placeholder, but this introduces its own problems, since the user probably *does* expect rtl on items like the legend. So we'll instead set ltr only on the canvases. We should review this behavior at some point; rtl is something we need to handle, not work around. It also needs to be kept in mind as we move canvas-text into a plugin. But for now this solution at least ensures consistent behavior. --- jquery.flot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.flot.js b/jquery.flot.js index 94c8d11..605fce8 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -744,8 +744,8 @@ Licensed under the MIT license. var c = document.createElement('canvas'); c.className = cls; - $(c).css({ position: 'absolute', left: 0, top: 0 }) - .appendTo(placeholder); + $(c).css({ direction: "ltr", position: "absolute", left: 0, top: 0 }) + .appendTo(placeholder); // If HTML5 Canvas isn't available, fall back to Excanvas