mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 05:26:11 +02:00
Merge pull request #643 from penpot/fix/problem-handoff-artboard
Fix problem width handoff code generation
This commit is contained in:
commit
fcda3b557e
4 changed files with 47 additions and 33 deletions
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
- Properly handle errors on github, gitlab and ldap auth backends.
|
- Properly handle errors on github, gitlab and ldap auth backends.
|
||||||
- Properly mark profile auth backend (on first register/ auth with 3rd party auth provider).
|
- Properly mark profile auth backend (on first register/ auth with 3rd party auth provider).
|
||||||
|
- Fix problem width handoff code generation [Taiga #1204](https://tree.taiga.io/project/penpot/issue/1204)
|
||||||
|
|
||||||
|
|
||||||
## 1.2.0-alpha
|
## 1.2.0-alpha
|
||||||
|
|
|
@ -124,12 +124,13 @@
|
||||||
(defn get-filters-bounds
|
(defn get-filters-bounds
|
||||||
[shape filters blur-value]
|
[shape filters blur-value]
|
||||||
|
|
||||||
(if (and (= :svg-raw (:type shape))
|
(let [svg-root? (and (= :svg-raw (:type shape)) (not= :svg (get-in shape [:content :tag])))
|
||||||
(not= :svg (get-in shape [:content :tag])))
|
frame? (= :frame (:type shape))
|
||||||
|
{:keys [x y width height]} (:selrect shape)]
|
||||||
|
(if svg-root?
|
||||||
;; When is a raw-svg but not the root we use the whole svg as bound for the filter. Is the maximum
|
;; When is a raw-svg but not the root we use the whole svg as bound for the filter. Is the maximum
|
||||||
;; we're allowed to display
|
;; we're allowed to display
|
||||||
{:x 0 :y 0 :width (get-in shape [:selrect :width]) :height (get-in shape [:selrect :height])}
|
{:x 0 :y 0 :width width :height height}
|
||||||
|
|
||||||
;; Otherwise we calculate the bound
|
;; Otherwise we calculate the bound
|
||||||
(let [filter-bounds (->> filters
|
(let [filter-bounds (->> filters
|
||||||
|
@ -147,10 +148,12 @@
|
||||||
y1 (- y1 (* blur-value 2))
|
y1 (- y1 (* blur-value 2))
|
||||||
y2 (+ y2 (* blur-value 2))]
|
y2 (+ y2 (* blur-value 2))]
|
||||||
|
|
||||||
{:x x1
|
;; We should move the frame filter coordinates because they should be
|
||||||
:y y1
|
;; relative with the frame. By default they come as absolute
|
||||||
|
{:x (if frame? (- x1 x) x1)
|
||||||
|
:y (if frame? (- y1 y) y1)
|
||||||
:width (- x2 x1)
|
:width (- x2 x1)
|
||||||
:height (- y2 y1)})))
|
:height (- y2 y1)}))))
|
||||||
|
|
||||||
(defn blur-filters [type value]
|
(defn blur-filters [type value]
|
||||||
(->> [value]
|
(->> [value]
|
||||||
|
|
|
@ -32,11 +32,10 @@
|
||||||
#js {:x 0
|
#js {:x 0
|
||||||
:y 0
|
:y 0
|
||||||
:width width
|
:width width
|
||||||
:height height}))]
|
:height height
|
||||||
[:svg {:x x :y y :width width :height height
|
:className "frame-background"}))]
|
||||||
:xmlnsXlink "http://www.w3.org/1999/xlink"
|
[:*
|
||||||
:xmlns "http://www.w3.org/2000/svg"}
|
[:> :rect props]
|
||||||
[:> "rect" props]
|
|
||||||
(for [[i item] (d/enumerate childs)]
|
(for [[i item] (d/enumerate childs)]
|
||||||
[:& shape-wrapper {:frame shape
|
[:& shape-wrapper {:frame shape
|
||||||
:shape item
|
:shape item
|
||||||
|
|
|
@ -27,14 +27,26 @@
|
||||||
filter-id (str "filter_" render-id)
|
filter-id (str "filter_" render-id)
|
||||||
styles (cond-> (obj/new)
|
styles (cond-> (obj/new)
|
||||||
(:blocked shape) (obj/set! "pointerEvents" "none"))
|
(:blocked shape) (obj/set! "pointerEvents" "none"))
|
||||||
|
|
||||||
|
{:keys [x y width height type]} shape
|
||||||
|
frame? (= :frame type)
|
||||||
group-props (-> (obj/clone props)
|
group-props (-> (obj/clone props)
|
||||||
(obj/without ["shape" "children"])
|
(obj/without ["shape" "children"])
|
||||||
(obj/set! "id" (str "shape-" (:id shape)))
|
(obj/set! "id" (str "shape-" (:id shape)))
|
||||||
(obj/set! "className" (str "shape " (:type shape)))
|
|
||||||
(obj/set! "filter" (filters/filter-str filter-id shape))
|
(obj/set! "filter" (filters/filter-str filter-id shape))
|
||||||
(obj/set! "style" styles))]
|
(obj/set! "style" styles)
|
||||||
|
|
||||||
|
(cond-> frame?
|
||||||
|
(-> (obj/set! "x" x)
|
||||||
|
(obj/set! "y" y)
|
||||||
|
(obj/set! "width" width)
|
||||||
|
(obj/set! "height" height)
|
||||||
|
(obj/set! "xmlnsXlink" "http://www.w3.org/1999/xlink")
|
||||||
|
(obj/set! "xmlns" "http://www.w3.org/2000/svg"))))
|
||||||
|
|
||||||
|
wrapper-tag (if frame? "svg" "g")]
|
||||||
[:& (mf/provider muc/render-ctx) {:value render-id}
|
[:& (mf/provider muc/render-ctx) {:value render-id}
|
||||||
[:> :g group-props
|
[:> wrapper-tag group-props
|
||||||
[:defs
|
[:defs
|
||||||
[:& filters/filters {:shape shape :filter-id filter-id}]
|
[:& filters/filters {:shape shape :filter-id filter-id}]
|
||||||
[:& grad/gradient {:shape shape :attr :fill-color-gradient}]
|
[:& grad/gradient {:shape shape :attr :fill-color-gradient}]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue