Search…

X3 Photo Gallery Support Forums

Search…
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13997
Joined: 30 Sep 2006, 03:37

Re: Justified layout still not flawless

09 Feb 2016, 01:47

Martin wrote:I don't know if it's important but in my very first post on page one in this thread I mentioned this:
"The strange thing is that within Firefox I notice patterns like this for a millisecond and then the layout rearranges itself and everything is neat and orderly. "
Perhaps interrelated, but does not offer much clues. I have this topic noted, will look into it soon.
 
User avatar
mjau-mjau
X3 Wizard
Posts: 13997
Joined: 30 Sep 2006, 03:37

Re: Justified layout still not flawless  Topic is solved

07 Sep 2016, 12:33

This issue is fixed in X3 release [0.19]Thanks to @sHagen for identifying the bug in this post. Feel free to test the justified layout in the new demo!

Bug Overview
I would like to note the technical reasons for why this bug could occur: As you may know, X3 is a Html5/ajax application, which loads and "injects" content when navigating from the menu.
  1. You are using a windows browser with scrollbars that appear/disappear based on necessity.
  2. You navigate from a page without scrollbar to a page with justified-layout.
  3. X3 injects the content into page, and scrollbar is added after the justified layout is rendered.
  4. Since appearance of the new scrollbar affects the available layout width, this then corrupts the justified layout.
Furthermore, I would like to note the following:
  • The bug would not occur on neither mobile/touchscreen or Mac's. Why? Because these devices employ a zero-width scrollbar that appears on-demand, and "overlays" the window instead of affecting the width.
  • The bug would not occur when loading the page directly (or refreshing the page), because the scrollbar will already be there (if required) before the justified layout renders.
  • The bug would only occur when navigating from a page without scrollbar to a justified-layout page with scrollbar. The only reason why the bug occurs in the first place, is because the layout container changes width once scrollbar is added. If you navigated from a page that already had a scrollbar, there would be no change in layout-width which would corrupt the justified-layout.
  • The bug would only occur when using the "wide" gallery layout, because this is the only layout where the width would get affected when scrollbar gets added.
Fix
To fix this bug, we run a timer function after the justified layout is rendered, to check if the width of the gallery module changes. If the width changes, it means a scrollbar must have been injected.  :kissing_heart: