mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
🐛 Fix problem with borders on shape export
This commit is contained in:
parent
2dfa4f9ec9
commit
1b6e6ec2e4
3 changed files with 29 additions and 8 deletions
|
@ -20,6 +20,7 @@
|
||||||
- Prevent adding numeric suffix to layer names when not needed [Taiga #1929](https://tree.taiga.io/project/penpot/us/1929).
|
- Prevent adding numeric suffix to layer names when not needed [Taiga #1929](https://tree.taiga.io/project/penpot/us/1929).
|
||||||
- Prevent deleting or moving the drafts project [Taiga #1935](https://tree.taiga.io/project/penpot/issue/1935).
|
- Prevent deleting or moving the drafts project [Taiga #1935](https://tree.taiga.io/project/penpot/issue/1935).
|
||||||
- Fix problem with zoom and selection [Taiga #1919](https://tree.taiga.io/project/penpot/issue/1919)
|
- Fix problem with zoom and selection [Taiga #1919](https://tree.taiga.io/project/penpot/issue/1919)
|
||||||
|
- Fix problem with borders on shape export [#1092](https://github.com/penpot/penpot/issues/1092)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
### :boom: Breaking changes
|
### :boom: Breaking changes
|
||||||
|
|
|
@ -55,7 +55,12 @@
|
||||||
width (* width zoom)
|
width (* width zoom)
|
||||||
height (* height zoom)
|
height (* height zoom)
|
||||||
|
|
||||||
vbox (str/join " " [x y width height])
|
padding (* (filters/calculate-padding object) zoom)
|
||||||
|
|
||||||
|
vbox (str/join " " [(- x padding)
|
||||||
|
(- y padding)
|
||||||
|
(+ width padding padding)
|
||||||
|
(+ height padding padding)])
|
||||||
|
|
||||||
frame-wrapper
|
frame-wrapper
|
||||||
(mf/use-memo
|
(mf/use-memo
|
||||||
|
@ -81,8 +86,8 @@
|
||||||
[:& (mf/provider embed/context) {:value true}
|
[:& (mf/provider embed/context) {:value true}
|
||||||
[:svg {:id "screenshot"
|
[:svg {:id "screenshot"
|
||||||
:view-box vbox
|
:view-box vbox
|
||||||
:width width
|
:width (+ width padding padding)
|
||||||
:height height
|
:height (+ height padding padding)
|
||||||
:version "1.1"
|
:version "1.1"
|
||||||
:xmlns "http://www.w3.org/2000/svg"
|
:xmlns "http://www.w3.org/2000/svg"
|
||||||
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
||||||
|
|
|
@ -201,6 +201,19 @@
|
||||||
:width (- x2 x1)
|
:width (- x2 x1)
|
||||||
:height (- y2 y1)})))))
|
: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)))
|
||||||
|
|
||||||
(mf/defc filters
|
(mf/defc filters
|
||||||
[{:keys [filter-id shape]}]
|
[{:keys [filter-id shape]}]
|
||||||
|
|
||||||
|
@ -209,15 +222,17 @@
|
||||||
;; Adds the previous filter as `filter-in` parameter
|
;; Adds the previous filter as `filter-in` parameter
|
||||||
filters (map #(assoc %1 :filter-in %2) filters (cons nil (map :id filters)))
|
filters (map #(assoc %1 :filter-in %2) filters (cons nil (map :id filters)))
|
||||||
|
|
||||||
bounds (get-filters-bounds shape filters (or (-> shape :blur :value) 0))]
|
bounds (get-filters-bounds shape filters (or (-> shape :blur :value) 0))
|
||||||
|
|
||||||
|
padding (calculate-padding shape)]
|
||||||
|
|
||||||
[:*
|
[:*
|
||||||
(when (> (count filters) 2)
|
(when (> (count filters) 2)
|
||||||
[:filter {:id filter-id
|
[:filter {:id filter-id
|
||||||
:x (:x bounds)
|
:x (- (:x bounds) padding)
|
||||||
:y (:y bounds)
|
:y (- (:y bounds) padding)
|
||||||
:width (:width bounds)
|
:width (+ (:width bounds) (* 2 padding))
|
||||||
:height (:height bounds)
|
:height (+ (:height bounds) (* 2 padding))
|
||||||
:filterUnits "userSpaceOnUse"
|
:filterUnits "userSpaceOnUse"
|
||||||
:color-interpolation-filters "sRGB"}
|
:color-interpolation-filters "sRGB"}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue