0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-28 15:41:25 -05:00

🐛 Fix border radius values with decimals

This commit is contained in:
Eva 2023-07-11 11:26:31 +02:00
parent 3dcd640a99
commit 52545692df
2 changed files with 13 additions and 4 deletions

View file

@ -61,7 +61,8 @@
- Fix text decoration on button [Taiga #5301](https://tree.taiga.io/project/penpot/issue/5301)
- Fix menu order on design tab [Taiga #5195](https://tree.taiga.io/project/penpot/issue/5195)
- Fix search bar width on layer tab [Taiga #5445](https://tree.taiga.io/project/penpot/issue/5445)
- Fix border radius values with decimals [Taiga #5283](https://tree.taiga.io/project/penpot/issue/5283)
### :arrow_up: Deps updates
- Update google fonts catalog (at 2023/07/06) [Taiga #5592](https://tree.taiga.io/project/penpot/issue/5592)

View file

@ -75,6 +75,14 @@
(fmt/format-size :width value values)
(fmt/format-size :heigth value values))))
(defn format-border-radius
[values]
(and (coll? values) (d/not-empty? values))
(->> values
(map fmt/format-pixels)
(str/join " ")))
(defn styles-data
[shape]
{:position {:props [:type]
@ -90,7 +98,7 @@
:rx "border-radius"
:r1 "border-radius"}
:format {:rotation #(str/fmt "rotate(%sdeg)" %)
:r1 #(apply str/fmt "%spx %spx %spx %spx" %)
:r1 format-border-radius
:width #(get-size :width %)
:height #(get-size :height %)}
:multi {:r1 [:r1 :r2 :r3 :r4]}}
@ -236,9 +244,9 @@
(str/join "\n")))))
(defn shape->properties [shape]
(let [;; This property is added in an earlier step (code.cljs),
(let [;; This property is added in an earlier step (code.cljs),
;; it will come with a vector of flex-items if any.
;; If there are none it will continue as usual.
;; If there are none it will continue as usual.
flex-items (:flex-items shape)
props (->> (styles-data shape) vals (mapcat :props))
to-prop (->> (styles-data shape) vals (map :to-prop) (reduce merge))