0
Fork 0
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:
Alejandro 2023-02-02 19:47:41 +01:00 committed by GitHub
commit 2e5e772392
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -28,6 +28,8 @@
h-center? (ctl/h-center? parent)
h-end? (ctl/h-end? parent)
around? (ctl/space-around? parent)
between? (ctl/space-between? parent)
fill-w? (ctl/fill-width? child)
fill-h? (ctl/fill-height? child)
@ -64,8 +66,11 @@
min-width (max min-width 0.01)
min-height (max min-height 0.01)]
(cond-> [base-p]
(or col? h-start?)
(cond-> [base-p
(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)))
(and col? h-center?)
@ -74,7 +79,7 @@
(and col? h-center?)
(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)))
(and row? v-center?)

View file

@ -6,6 +6,7 @@
(ns app.common.geom.shapes.points
(:require
[app.common.data :as d]
[app.common.geom.point :as gpt]
[app.common.geom.shapes.common :as gco]
[app.common.geom.shapes.intersect :as gsi]
@ -115,7 +116,9 @@
(max tv-max ctv)]))
[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-end (gpt/add minv-start hv)