Skip to content
Snippets Groups Projects
Commit fd4c485c authored by Benoit Socias's avatar Benoit Socias
Browse files

[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: 1fc45be924e904dc595af61e0845b91cc5d24a49
Part-of: odoo/odoo#124608
parent 9e23d160
No related branches found
No related tags found
No related merge requests found
......@@ -203,6 +203,8 @@ options.registry.gallery = options.Class.extend({
_.each(cols, function (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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment