0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-11 07:11:32 -05:00

🐛 Fix problem with inner strokes bounds

This commit is contained in:
alonso.torres 2024-10-15 12:28:23 +02:00
parent 1fb21d537c
commit 83d8bf37a6

View file

@ -10,6 +10,7 @@
[app.common.data.macros :as dm] [app.common.data.macros :as dm]
[app.common.files.helpers :as cfh] [app.common.files.helpers :as cfh]
[app.common.geom.rect :as grc] [app.common.geom.rect :as grc]
[app.common.geom.shapes :as gsh]
[app.common.math :as mth])) [app.common.math :as mth]))
(defn shape-stroke-margin (defn shape-stroke-margin
@ -97,12 +98,15 @@
([shape ignore-margin?] ([shape ignore-margin?]
(let [strokes (:strokes shape) (let [strokes (:strokes shape)
open-path? (and ^boolean (cfh/path-shape? shape)
^boolean (gsh/open-path? shape))
stroke-width stroke-width
(->> strokes (->> strokes
(map #(case (get % :stroke-alignment :center) (map #(case (get % :stroke-alignment :center)
:center (/ (:stroke-width % 0) 2) :center (/ (:stroke-width % 0) 2)
:outer (:stroke-width % 0) :outer (:stroke-width % 0)
(:stroke-width % 0))) (if open-path? (:stroke-width % 0) 0)))
(reduce d/max 0)) (reduce d/max 0))
stroke-margin stroke-margin