mirror of
https://github.com/penpot/penpot.git
synced 2025-05-28 01:46:12 +02:00
✨ Reflow flex on grow text height
This commit is contained in:
parent
15e9d92094
commit
eb04fa19e1
3 changed files with 44 additions and 13 deletions
|
@ -217,11 +217,14 @@
|
|||
|
||||
;; When the horizontal/vertical scale a flex children with auto/fill
|
||||
;; we change it too fixed
|
||||
set-fix-width?
|
||||
change-width?
|
||||
(not (mth/close? (dm/get-prop scalev :x) 1))
|
||||
|
||||
set-fix-height?
|
||||
(not (mth/close? (dm/get-prop scalev :y) 1))]
|
||||
change-height?
|
||||
(not (mth/close? (dm/get-prop scalev :y) 1))
|
||||
|
||||
auto-width-text? (and (cfh/text-shape? shape) (= :auto-width (dm/get-prop shape :grow-type)))
|
||||
auto-height-text? (and (cfh/text-shape? shape) (= :auto-height (dm/get-prop shape :grow-type)))]
|
||||
|
||||
(cond-> (ctm/empty)
|
||||
(some? displacement)
|
||||
|
@ -230,12 +233,18 @@
|
|||
:always
|
||||
(ctm/resize scalev resize-origin shape-transform shape-transform-inverse)
|
||||
|
||||
^boolean set-fix-width?
|
||||
^boolean change-width?
|
||||
(ctm/change-property :layout-item-h-sizing :fix)
|
||||
|
||||
^boolean set-fix-height?
|
||||
^boolean change-height?
|
||||
(ctm/change-property :layout-item-v-sizing :fix)
|
||||
|
||||
(and auto-width-text? (or change-width? change-height?))
|
||||
(ctm/change-property :grow-type :fixed)
|
||||
|
||||
(and auto-height-text? change-height?)
|
||||
(ctm/change-property :grow-type :fixed)
|
||||
|
||||
^boolean scale-text
|
||||
(ctm/scale-content (dm/get-prop scalev :x)))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue