mirror of
https://github.com/penpot/penpot.git
synced 2025-02-11 01:28:30 -05:00
🐛 Fix stroke cut on shapes export
This commit is contained in:
parent
5e6719e22e
commit
eed75bcbda
3 changed files with 16 additions and 14 deletions
|
@ -42,6 +42,7 @@
|
|||
- Fix bug with transformation operations [Taiga #2155](https://tree.taiga.io/project/penpot/issue/2155).
|
||||
- Fix bug in firefox when a text box is inside a mask [Taiga #2152](https://tree.taiga.io/project/penpot/issue/2152).
|
||||
- Fix paste in place in arboards [Taiga #2188](https://tree.taiga.io/project/penpot/issue/2188)
|
||||
- Fix stroke cut on shapes export [Taiga #2171](https://tree.taiga.io/project/penpot/issue/2171)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
[app.common.geom.shapes.intersect :as gin]
|
||||
[app.common.geom.shapes.path :as gsp]
|
||||
[app.common.geom.shapes.rect :as gpr]
|
||||
[app.common.geom.shapes.transforms :as gtr]))
|
||||
[app.common.geom.shapes.transforms :as gtr]
|
||||
[app.common.math :as mth]))
|
||||
|
||||
;; --- Setup (Initialize)
|
||||
;; FIXME: Is this the correct place for these functions?
|
||||
|
@ -127,6 +128,13 @@
|
|||
(assoc :selrect selrect
|
||||
:points points))))
|
||||
|
||||
(defn shape-stroke-margin
|
||||
[shape stroke-width]
|
||||
(if (= (:type shape) :path)
|
||||
;; TODO: Calculate with the stroke offset (not implemented yet
|
||||
(mth/sqrt (* 2 stroke-width stroke-width))
|
||||
(- (mth/sqrt (* 2 stroke-width stroke-width)) stroke-width)))
|
||||
|
||||
|
||||
;; EXPORTS
|
||||
(d/export gco/center-shape)
|
||||
|
|
|
@ -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)]
|
||||
|
||||
[:*
|
||||
|
|
Loading…
Add table
Reference in a new issue