mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Improve auto-width to fixed conversion logic in layout contexts
Signed-off-by: Brian Mwenda <brian@nathandigital.com>
This commit is contained in:
committed by
Andrey Antukh
parent
de5ff227d2
commit
e6c418eb9c
@@ -199,8 +199,18 @@
|
|||||||
changed-width? (> (mth/abs (- (:width shape) (:width old-shape))) 0.1)
|
changed-width? (> (mth/abs (- (:width shape) (:width old-shape))) 0.1)
|
||||||
changed-height? (> (mth/abs (- (:height shape) (:height old-shape))) 0.1)
|
changed-height? (> (mth/abs (- (:height shape) (:height old-shape))) 0.1)
|
||||||
|
|
||||||
change-to-fixed? (or (and auto-width? (or changed-height? changed-width?))
|
;; Check if the shape is in a flex layout context that might cause layout-driven changes
|
||||||
(and auto-height? changed-height?))]
|
;; We should be more conservative about converting auto-width to fixed when the shape
|
||||||
|
;; is part of a layout system that could cause automatic resizing
|
||||||
|
has-layout-item-sizing? (or (:layout-item-h-sizing shape) (:layout-item-v-sizing shape))
|
||||||
|
|
||||||
|
;; Only convert auto-width to fixed if:
|
||||||
|
;; 1. For auto-width: both width AND height changed (indicating user manipulation, not layout)
|
||||||
|
;; 2. For auto-height: only height changed
|
||||||
|
;; 3. The shape is not in a layout context where automatic sizing changes are expected
|
||||||
|
change-to-fixed? (and (not has-layout-item-sizing?)
|
||||||
|
(or (and auto-width? changed-width? changed-height?)
|
||||||
|
(and auto-height? changed-height?)))]
|
||||||
(cond-> shape
|
(cond-> shape
|
||||||
change-to-fixed?
|
change-to-fixed?
|
||||||
(assoc :grow-type :fixed))))
|
(assoc :grow-type :fixed))))
|
||||||
|
|||||||
Reference in New Issue
Block a user