Commit 087fe0fa by Tomas Alabes

@bjouhier - fixed rounding issue in RGB formatter

parent dba301d0
......@@ -1002,7 +1002,8 @@
= (string) hex representation of the colour.
\*/
R.rgb = cacher(function (r, g, b) {
return "#" + (16777216 | b | (g << 8) | (r << 16)).toString(16).slice(1);
function round(x) { return (x + 0.5) | 0; }
return "#" + (16777216 | round(b) | (round(g) << 8) | (round(r) << 16)).toString(16).slice(1);
});
/*\
* Raphael.getColor
......
2.1.5 • WIP
------------------
* fixed rounding issue in RGB formatter
2.1.4 • 2015-03-09
------------------
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1381,7 +1381,8 @@
= (string) hex representation of the colour.
\*/
R.rgb = cacher(function (r, g, b) {
return "#" + (16777216 | b | (g << 8) | (r << 16)).toString(16).slice(1);
function round(x) { return (x + 0.5) | 0; }
return "#" + (16777216 | round(b) | (round(g) << 8) | (round(r) << 16)).toString(16).slice(1);
});
/*\
* Raphael.getColor
......
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 sign in to comment