Skip to content

Commit

Permalink
🐛 Fix problem with flex layout fit to content not positioning correct…
Browse files Browse the repository at this point in the history
…ly children
  • Loading branch information
Alotor committed Jun 7, 2024
1 parent 2c21a04 commit 3ad91d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Fix color palette default library [Taiga #8029](https://tree.taiga.io/project/penpot/issue/8029)
- Component Library is lost after exporting/importing in .zip format [Github #4672](https://github.com/penpot/penpot/issues/4672)
- Fix problem with moving+selection not working properly [Taiga #7943](https://tree.taiga.io/project/penpot/issue/7943)
- Fix problem with flex layout fit to content not positioning correctly children [Taiga #7537](https://tree.taiga.io/project/penpot/issue/7537)

## 2.0.3

Expand Down
9 changes: 8 additions & 1 deletion common/src/app/common/geom/modifiers.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@
(keep (mk-check-auto-layout objects))
shapes)))

(defn full-tree?
"Checks if we need to calculate the full tree or we can calculate just a partial tree. Partial
trees are more efficient but cannot be done when the layout is centered."
[objects layout-id]
(let [layout-justify-content (get-in objects [layout-id :layout-justify-content])]
(contains? #{:center :end :space-around :space-evenly :stretch} layout-justify-content)))

(defn sizing-auto-modifiers
"Recalculates the layouts to adjust the sizing: auto new sizes"
[modif-tree sizing-auto-layouts objects bounds ignore-constraints]
Expand All @@ -286,7 +293,7 @@
(d/seek sizing-auto-layouts))

shapes
(if from-layout
(if (and from-layout (not (full-tree? objects from-layout)))
(cgst/resolve-subtree from-layout layout-id objects)
(cgst/resolve-tree #{layout-id} objects))

Expand Down

0 comments on commit 3ad91d1

Please sign in to comment.