Closed tomalec closed 9 years ago
I found a problem with our approach to flexible expandable layout, and fixed sizes.
We cannot set a column fixed size only if all cells in given track (row/col) are fixed size.
At least we cannot do so and keep gaps fixed size (so they don't resize when container resizes).
As you can see here, all those gaps created 5 cols in total, ad we need to keep them fixed size, to keep gaps fixed size, even though, each column contain elements that are not necessarily fixed size.
I see two solutions:
In both cases it would be hard to identify whether the empty space in grid cell is gap, or just empty space.
We can also think about more sophisticated logic and make columns that intersects fixed items flexible, in specific cases (it intersects, only middle part, or beginning of an item with size less than.. etc.) but it may lead to way more problems, and will require longer discussion. As even if we could reduce problem to two rows, and apply algorithm that ma be then extrapolated recursively (if there exist one that makes sense), there are around 54 combinations to consider
The only idea to address the problem of many fixed size cells/gaps braking proportions I could say that:
@Starcounter-Jack, @warpech WDYT? BTW, Can you recommend a good hardware for Mischief drawings? ;)
Another reason to make track fixed if at least one intersecting item is fixed, is that W3C's Track Sizing Algorithm does take size of spanning cell into consideration. Unless I missed somthing.
Here is jsfiddle for this - if grid item gets bigger than flexible column (fr
) - for example when grid container shrinks - column size does not change, as it would for non-spanning item and minmax(min-content,1fr)
As agreed with @warpech on today's meeting,
for now we will now go with
Track is fixed if it contains fixed size item, or gutter
:interrobang: How to identify track with gutter? Is "The track after grid line of item's end, and the track before grid line of item's beginning" enough?
Description of algorithm that translates packed tiles into CSS Grid is available in https://github.com/Juicy/juicy-tile-grid/blob/fractions/algorithm.md
I added a test suite for the results of this algorithm at /tests/?grep=grid_building_algorithm.html
As described at https://github.com/Juicy/juicy-tile-grid/wiki/How-to-create-responsive-design-with-Juicy-elements Output grid dimensions should use fractions (
fr
) as unit, and pixels (px
) only if all cells in given column/row are fixed size.Tile dimensions should be given in
px
only if tile is marked to be fixed size (notexpandableWidth
/-Height
), and100%
otherwise (fit entire grid cell)