From 4053ff4caac797f06ad35cddef94134a784bc9e3 Mon Sep 17 00:00:00 2001 From: Benoit Socias Date: Wed, 19 Apr 2023 08:12:34 +0000 Subject: [PATCH] [FIX] website: neutralize sub-pixel height difference in images wall Inside the Images Wall snippet, images are dispatched to columns depending on the height already reached by each column. This computation relies on a sub-pixel height which leads to a confusing behavior. This commit rounds the sub-pixel height to a visible pixel height to avoid the confusion. Steps to reproduce: In the default images of the Images Wall snippet, the third image (sign) is one pixel taller than the other ones. - Drop an Images Wall snippet. - Select the "sign" image. - Move it to the first position. (Because of another bug involving a race condition with the loading of images, you might observe a different behavior. Move to first position again to recompute the layout several times.) => The compass image moved to the first column. task-2990053 X-original-commit: d0c15abd17e151a8861cc950116b11111d694bb3 Part-of: odoo/odoo#125758 --- addons/website/static/src/snippets/s_image_gallery/options.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/website/static/src/snippets/s_image_gallery/options.js b/addons/website/static/src/snippets/s_image_gallery/options.js index 96dd8a988fe..54fbf819ba8 100644 --- a/addons/website/static/src/snippets/s_image_gallery/options.js +++ b/addons/website/static/src/snippets/s_image_gallery/options.js @@ -202,6 +202,8 @@ options.registry.gallery = options.registry.CarouselHandler.extend({ cols.forEach((col) => { var $col = $(col); var height = $col.is(':empty') ? 0 : $col.find('img').last().offset().top + $col.find('img').last().height() - self.$target.offset().top; + // Neutralize invisible sub-pixel height differences. + height = Math.round(height); if (height < min) { min = height; $lowest = $col;