diff --git a/CHANGES.md b/CHANGES.md index 58e10a364..3edd75555 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/frontend/src/app/util/geom/grid.cljs b/frontend/src/app/util/geom/grid.cljs index 29aece801..dea9569ad 100644 --- a/frontend/src/app/util/geom/grid.cljs +++ b/frontend/src/app/util/geom/grid.cljs @@ -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]