[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
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user