🐛 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 <niwi@niwi.nz>
This commit is contained in:
Andrey Antukh 2026-04-14 19:38:56 +00:00
parent 7e9fac4f35
commit d13e464ed1
3 changed files with 2 additions and 5 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)))))))))