From b66b39735aa998b3c4859f2c5100617578c74934 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 14 Apr 2026 19:38:56 +0000 Subject: [PATCH] :bug: Fix three flex layout bugs in drop-area, positions and layout-data drop_area.cljc: v-end? was guarded by row? instead of col?, making vertical-end alignment check fire under horizontal layout conditions. Aligned with v-center? which correctly uses col?. positions.cljc: In get-base-line, the col? around? branch passed 2 as a third argument to max instead of as a divisor in (/ free-width num-lines 2). This made the offset clamp to at least 2 pixels rather than computing half the per-line free space. Fixed parenthesization. layout_data.cljc: The second cond branch (and col? space-evenly? auto-height?) was permanently unreachable because the preceding branch (and col? space-evenly?) is a strict superset. Removed the dead branch. Signed-off-by: Andrey Antukh --- common/src/app/common/geom/shapes/flex_layout/drop_area.cljc | 2 +- common/src/app/common/geom/shapes/flex_layout/layout_data.cljc | 3 --- common/src/app/common/geom/shapes/flex_layout/positions.cljc | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/common/src/app/common/geom/shapes/flex_layout/drop_area.cljc b/common/src/app/common/geom/shapes/flex_layout/drop_area.cljc index e9a5fa4915..bbc350712c 100644 --- a/common/src/app/common/geom/shapes/flex_layout/drop_area.cljc +++ b/common/src/app/common/geom/shapes/flex_layout/drop_area.cljc @@ -81,7 +81,7 @@ h-center? (and row? (ctl/h-center? frame)) h-end? (and row? (ctl/h-end? frame)) v-center? (and col? (ctl/v-center? frame)) - v-end? (and row? (ctl/v-end? frame)) + v-end? (and col? (ctl/v-end? frame)) center (gco/shape->center frame) start-p (gmt/transform-point-center start-p center transform-inverse) diff --git a/common/src/app/common/geom/shapes/flex_layout/layout_data.cljc b/common/src/app/common/geom/shapes/flex_layout/layout_data.cljc index c9e4f7c57e..6d91a25707 100644 --- a/common/src/app/common/geom/shapes/flex_layout/layout_data.cljc +++ b/common/src/app/common/geom/shapes/flex_layout/layout_data.cljc @@ -369,9 +369,6 @@ (cond (and col? space-evenly?) 0 - (and col? space-evenly? auto-height?) - 0 - (and col? space-around?) (/ (max layout-gap-row (/ (- height line-height) num-children)) 2) diff --git a/common/src/app/common/geom/shapes/flex_layout/positions.cljc b/common/src/app/common/geom/shapes/flex_layout/positions.cljc index 48b49d7c06..675a090c6b 100644 --- a/common/src/app/common/geom/shapes/flex_layout/positions.cljc +++ b/common/src/app/common/geom/shapes/flex_layout/positions.cljc @@ -61,7 +61,7 @@ (gpt/add (hv free-width-gap)) around? - (gpt/add (hv (max lines-gap-col (/ free-width num-lines) 2))) + (gpt/add (hv (max lines-gap-col (/ free-width num-lines 2)))) evenly? (gpt/add (hv (max lines-gap-col (/ free-width (inc num-lines)))))))))