🐛 Fix stroke cut on shapes export

This commit is contained in:
alonso.torres 2021-10-20 14:25:08 +02:00
parent 5e6719e22e
commit eed75bcbda
3 changed files with 16 additions and 14 deletions

View file

@ -202,17 +202,12 @@
:height (- y2 y1)})))))
(defn calculate-padding [shape]
(let [{:keys [stroke-style stroke-alignment stroke-width]} shape]
(cond
(and (not= stroke-style :none)
(= stroke-alignment :outer))
stroke-width
(and (not= stroke-style :none)
(= stroke-alignment :center))
(mth/ceil (/ stroke-width 2))
:else 0)))
(let [stroke-width (case (:stroke-alignment shape :center)
:center (/ (:stroke-width shape 0) 2)
:outer (:stroke-width shape 0)
0)
margin (gsh/shape-stroke-margin shape stroke-width)]
(+ stroke-width margin)))
(mf/defc filters
[{:keys [filter-id shape]}]
@ -221,9 +216,7 @@
;; Adds the previous filter as `filter-in` parameter
filters (map #(assoc %1 :filter-in %2) filters (cons nil (map :id filters)))
bounds (get-filters-bounds shape filters (or (-> shape :blur :value) 0))
padding (calculate-padding shape)]
[:*