From e09120a1d65629ec2d7c8b15bcedeaf8cbd7a33b Mon Sep 17 00:00:00 2001 From: Samuel Degueldre Date: Wed, 29 Apr 2020 09:35:59 +0000 Subject: [PATCH] [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) --- addons/web_editor/static/src/js/editor/snippets.options.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js index 401665b8559..08b8c3d3519 100644 --- a/addons/web_editor/static/src/js/editor/snippets.options.js +++ b/addons/web_editor/static/src/js/editor/snippets.options.js @@ -863,7 +863,7 @@ const InputUserValueWidget = UserValueWidget.extend({ * @returns {string} */ _floatToStr: function (value) { - return `${parseFloat(value.toFixed(3))}`; + return `${parseFloat(value.toFixed(5))}`; }, //--------------------------------------------------------------------------