🐛 Fix problem with space-between and only one track

This commit is contained in:
alonso.torres 2023-06-20 15:48:08 +02:00
parent 34575b9413
commit b3482c1d6a

View file

@ -475,35 +475,37 @@
column-total-size (tracks-total-size column-tracks) column-total-size (tracks-total-size column-tracks)
row-total-size (tracks-total-size row-tracks) row-total-size (tracks-total-size row-tracks)
num-columns (count column-tracks)
column-gap column-gap
(case (:layout-align-content parent) (case (:layout-align-content parent)
auto-width? auto-width?
column-gap column-gap
:space-evenly :space-evenly
(max column-gap (/ (- bound-width column-total-size) (inc (count column-tracks)))) (max column-gap (/ (- bound-width column-total-size) (inc num-columns)))
:space-around :space-around
(max column-gap (/ (- bound-width column-total-size) (count column-tracks))) (max column-gap (/ (- bound-width column-total-size) num-columns))
:space-between :space-between
(max column-gap (/ (- bound-width column-total-size) (dec (count column-tracks)))) (max column-gap (if (= num-columns 1) column-gap (/ (- bound-width column-total-size) (dec num-columns))))
column-gap) column-gap)
num-rows (count row-tracks)
row-gap row-gap
(case (:layout-justify-content parent) (case (:layout-justify-content parent)
auto-height? auto-height?
row-gap row-gap
:space-evenly :space-evenly
(max row-gap (/ (- bound-height row-total-size) (inc (count row-tracks)))) (max row-gap (/ (- bound-height row-total-size) (inc num-rows)))
:space-around :space-around
(max row-gap (/ (- bound-height row-total-size) (count row-tracks))) (max row-gap (/ (- bound-height row-total-size) num-rows))
:space-between :space-between
(max row-gap (/ (- bound-height row-total-size) (dec (count row-tracks)))) (max row-gap (if (= num-rows 1) row-gap (/ (- bound-height row-total-size) (dec num-rows))))
row-gap) row-gap)