diff --git a/CHANGES.md b/CHANGES.md index a222eeaaec..285051a25f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -35,6 +35,7 @@ - Misleading affordance in saved versions [Taiga #11887](https://tree.taiga.io/project/penpot/issue/11887) - Fix pasting RTF text crashes penpot [Taiga #11717](https://tree.taiga.io/project/penpot/issue/11717) - Fix navigation arrows in Libraries & Templates carousel [Taiga #10609](https://tree.taiga.io/project/penpot/issue/10609) +- Fix applying tokens with zero value to size [Taiga #11618](https://tree.taiga.io/project/penpot/issue/11618) ## 2.9.0 diff --git a/common/src/app/common/types/modifiers.cljc b/common/src/app/common/types/modifiers.cljc index 17aa9853a5..6e1d8c7ef9 100644 --- a/common/src/app/common/types/modifiers.cljc +++ b/common/src/app/common/types/modifiers.cljc @@ -466,7 +466,12 @@ (dm/assert! (#{:width :height} attr)) (dm/assert! (number? value)) - (let [{:keys [proportion proportion-lock]} shape + (let [;; Avoid havig shapes with zero size + value (if (< (mth/abs value) 0.01) + 0.01 + value) + + {:keys [proportion proportion-lock]} shape size (select-keys (:selrect shape) [:width :height]) new-size (if-not (and (not ignore-lock?) proportion-lock) (assoc size attr value)