[FIX] web_editor: increase precision of number-string conversion

Previously, when converting a number to a string we only kept 3
decimals, it turns out that when converting back and forth between rem
and pixels, we were losing enough precision that we had inexact pixel
values shown to the end user for odd number of pixels, even with the
default rem value of 16px.

This commit increases the precision to 5 to work around this issue and
allow us to convert exactly between rem and pixels at the default
16px/rem.

task-2248360

closes odoo/odoo#50881

X-original-commit: fdce273f4fe72a9e2555acecad3c2989110dac1a
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
Samuel Degueldre
2020-05-07 16:15:07 +00:00
parent f0afe7420a
commit e09120a1d6
@@ -863,7 +863,7 @@ const InputUserValueWidget = UserValueWidget.extend({
* @returns {string}
*/
_floatToStr: function (value) {
return `${parseFloat(value.toFixed(3))}`;
return `${parseFloat(value.toFixed(5))}`;
},
//--------------------------------------------------------------------------