From b3482c1d6aee28732a37191b9862bf9c18fe00a4 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Tue, 20 Jun 2023 15:48:08 +0200 Subject: [PATCH] :bug: Fix problem with space-between and only one track --- .../geom/shapes/grid_layout/layout_data.cljc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/common/src/app/common/geom/shapes/grid_layout/layout_data.cljc b/common/src/app/common/geom/shapes/grid_layout/layout_data.cljc index 8871045f6f..29335b86a8 100644 --- a/common/src/app/common/geom/shapes/grid_layout/layout_data.cljc +++ b/common/src/app/common/geom/shapes/grid_layout/layout_data.cljc @@ -475,35 +475,37 @@ column-total-size (tracks-total-size column-tracks) row-total-size (tracks-total-size row-tracks) + num-columns (count column-tracks) column-gap (case (:layout-align-content parent) auto-width? column-gap :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 - (max column-gap (/ (- bound-width column-total-size) (count column-tracks))) + (max column-gap (/ (- bound-width column-total-size) num-columns)) :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) + num-rows (count row-tracks) row-gap (case (:layout-justify-content parent) auto-height? row-gap :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 - (max row-gap (/ (- bound-height row-total-size) (count row-tracks))) + (max row-gap (/ (- bound-height row-total-size) num-rows)) :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)