0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-07 15:39:42 -05:00

🐛 Makes height priority for the rows/columns grids

This commit is contained in:
alonso.torres 2023-07-05 15:13:44 +02:00
parent cf9fb7face
commit 00450565c8
2 changed files with 13 additions and 10 deletions

View file

@ -43,7 +43,7 @@
- Fix validation on team name input [Taiga #5510](https://tree.taiga.io/project/penpot/issue/5510)
- Fix incorrect uri generation issues on share-link modal [Taiga #5564](https://tree.taiga.io/project/penpot/issue/5564)
- Fix cache issues with share-links [Taiga #5559](https://tree.taiga.io/project/penpot/issue/5559)
- Makes height priority for the rows/columns grids [#2774](https://github.com/penpot/penpot/issues/2774)
### :arrow_up: Deps updates

View file

@ -25,28 +25,31 @@
(mth/floor (/ frame-length-no-margins (+ item-length gutter)))))
(defn- calculate-generic-grid
[v width {:keys [size gutter margin item-length type]}]
[v total-length {:keys [size gutter margin item-length type]}]
(let [size (if (number? size)
size
(calculate-size width item-length margin gutter))
parts (/ width size)
(calculate-size total-length item-length margin gutter))
width' (min (or item-length ##Inf) (+ parts (- gutter) (/ gutter size) (- (/ (* margin 2) size))))
parts (/ total-length size)
item-length (if (number? item-length)
item-length
(+ parts (- gutter) (/ gutter size) (- (/ (* margin 2) size))))
offset (case type
:right (- width (* width' size) (* gutter (dec size)) margin)
:center (/ (- width (* width' size) (* gutter (dec size))) 2)
:right (- total-length (* item-length size) (* gutter (dec size)) margin)
:center (/ (- total-length (* item-length size) (* gutter (dec size))) 2)
margin)
gutter (if (= :stretch type)
(let [gutter (/ (- width (* width' size) (* margin 2)) (dec size))]
(let [gutter (max 0 gutter (/ (- total-length (* item-length size) (* margin 2)) (dec size)))]
(if (d/num? gutter) gutter 0))
gutter)
next-v (fn [cur-val]
(+ offset v (* (+ width' gutter) cur-val)))]
(+ offset v (* (+ item-length gutter) cur-val)))]
[size width' next-v gutter]))
[size item-length next-v gutter]))
(defn- calculate-column-grid
[{:keys [width height x y] :as frame} params]