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.
pull/1/head
David Schnur 13 years ago
parent a6414cac60
commit d7c58b59f3

@ -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

Loading…
Cancel
Save