Round text coordinates consistently.

The core implementation used parseInt, which was originally to catch
text values, but really only stayed due to its side-effect of flooring
the values.  The canvas implementation has never rounded coordinates.
This led to various one-pixel rendering glitches between the two
implementations.  I've fixed the problem by consistently rounding
coordinates to the nearest whole number.
pull/1/head
David Schnur 13 years ago
parent 606c02b842
commit aefe4e729b

@ -140,7 +140,7 @@ browser, but needs to redraw with canvas text when exporting as an image.
y = Math.ceil(y - 2);
}
context.fillText(line.text, linex, y);
context.fillText(line.text, Math.round(linex), Math.round(y));
y += line.height;
}
}

@ -385,8 +385,8 @@ Licensed under the MIT license.
// Move the element to its final position within the container
info.element.css({
top: parseInt(y, 10),
left: parseInt(x, 10)
top: Math.round(y),
left: Math.round(x)
});
};

Loading…
Cancel
Save