mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -05:00
Merge pull request #2900 from penpot/alotor-fix-space-around-bounds
🐛 Fix problem with space-around
This commit is contained in:
commit
2e5e772392
2 changed files with 12 additions and 4 deletions
|
@ -28,6 +28,8 @@
|
||||||
h-center? (ctl/h-center? parent)
|
h-center? (ctl/h-center? parent)
|
||||||
h-end? (ctl/h-end? parent)
|
h-end? (ctl/h-end? parent)
|
||||||
|
|
||||||
|
around? (ctl/space-around? parent)
|
||||||
|
between? (ctl/space-between? parent)
|
||||||
fill-w? (ctl/fill-width? child)
|
fill-w? (ctl/fill-width? child)
|
||||||
fill-h? (ctl/fill-height? child)
|
fill-h? (ctl/fill-height? child)
|
||||||
|
|
||||||
|
@ -64,8 +66,11 @@
|
||||||
min-width (max min-width 0.01)
|
min-width (max min-width 0.01)
|
||||||
min-height (max min-height 0.01)]
|
min-height (max min-height 0.01)]
|
||||||
|
|
||||||
(cond-> [base-p]
|
(cond-> [base-p
|
||||||
(or col? h-start?)
|
(gpt/add base-p (hv 0.01))
|
||||||
|
(gpt/add base-p (vv 0.01))]
|
||||||
|
|
||||||
|
(or col? h-start? around? between?)
|
||||||
(conj (gpt/add base-p (hv min-width)))
|
(conj (gpt/add base-p (hv min-width)))
|
||||||
|
|
||||||
(and col? h-center?)
|
(and col? h-center?)
|
||||||
|
@ -74,7 +79,7 @@
|
||||||
(and col? h-center?)
|
(and col? h-center?)
|
||||||
(conj (gpt/subtract base-p (hv min-width)))
|
(conj (gpt/subtract base-p (hv min-width)))
|
||||||
|
|
||||||
(or row? v-start?)
|
(or row? v-start? around? between?)
|
||||||
(conj (gpt/add base-p (vv min-height)))
|
(conj (gpt/add base-p (vv min-height)))
|
||||||
|
|
||||||
(and row? v-center?)
|
(and row? v-center?)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
(ns app.common.geom.shapes.points
|
(ns app.common.geom.shapes.points
|
||||||
(:require
|
(:require
|
||||||
|
[app.common.data :as d]
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
[app.common.geom.shapes.common :as gco]
|
[app.common.geom.shapes.common :as gco]
|
||||||
[app.common.geom.shapes.intersect :as gsi]
|
[app.common.geom.shapes.intersect :as gsi]
|
||||||
|
@ -115,7 +116,9 @@
|
||||||
(max tv-max ctv)]))
|
(max tv-max ctv)]))
|
||||||
|
|
||||||
[th-min th-max tv-min tv-max]
|
[th-min th-max tv-min tv-max]
|
||||||
(->> child-bounds (reduce find-boundary-ts [##Inf ##-Inf ##Inf ##-Inf]))
|
(->> child-bounds
|
||||||
|
(filter #(and (d/num? (:x %)) (d/num? (:y %))))
|
||||||
|
(reduce find-boundary-ts [##Inf ##-Inf ##Inf ##-Inf]))
|
||||||
|
|
||||||
minv-start (pv tv-min)
|
minv-start (pv tv-min)
|
||||||
minv-end (gpt/add minv-start hv)
|
minv-end (gpt/add minv-start hv)
|
||||||
|
|
Loading…
Reference in a new issue