mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 16:18:11 -05:00
🐛 Fix components assets blend mode not applied
This commit is contained in:
parent
e9ae4251ff
commit
fd43091d3a
2 changed files with 49 additions and 36 deletions
|
@ -152,7 +152,7 @@
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(l/dbg :hint "update thumbnail" :object-id object-id :tag tag)
|
(l/dbg :hint "update thumbnail" :object-id object-id :tag tag)
|
||||||
;; Send the update to the back-end
|
;; Send the update to the back-end
|
||||||
(->> (get-thumbnail state file-id page-id frame-id {:object-id object-id})
|
(->> (get-thumbnail state file-id page-id frame-id tag)
|
||||||
(rx/mapcat (fn [uri]
|
(rx/mapcat (fn [uri]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (assoc-thumbnail object-id uri))
|
(rx/of (assoc-thumbnail object-id uri))
|
||||||
|
|
|
@ -233,7 +233,7 @@
|
||||||
|
|
||||||
(mf/defc frame-imposter
|
(mf/defc frame-imposter
|
||||||
{::mf/wrap-props false}
|
{::mf/wrap-props false}
|
||||||
[{:keys [objects frame vbox width height]}]
|
[{:keys [objects frame vbox x y width height background]}]
|
||||||
(let [shape-wrapper (shape-wrapper-factory objects)]
|
(let [shape-wrapper (shape-wrapper-factory objects)]
|
||||||
[:& (mf/provider muc/render-thumbnails) {:value false}
|
[:& (mf/provider muc/render-thumbnails) {:value false}
|
||||||
[:svg {:view-box vbox
|
[:svg {:view-box vbox
|
||||||
|
@ -243,6 +243,8 @@
|
||||||
: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"
|
||||||
:fill "none"}
|
:fill "none"}
|
||||||
|
(when (some? background)
|
||||||
|
[:rect {:x x :y y :width width :height height :fill background}])
|
||||||
[:& shape-wrapper {:shape frame}]]]))
|
[:& shape-wrapper {:shape frame}]]]))
|
||||||
|
|
||||||
;; Component that serves for render frame thumbnails, mainly used in
|
;; Component that serves for render frame thumbnails, mainly used in
|
||||||
|
@ -527,17 +529,24 @@
|
||||||
(rx/map
|
(rx/map
|
||||||
(fn [data]
|
(fn [data]
|
||||||
(let [elem (mf/element components-svg
|
(let [elem (mf/element components-svg
|
||||||
#js {:data data :embed true :include-metadata true
|
#js {:data data
|
||||||
|
:embed true
|
||||||
|
:include-metadata true
|
||||||
:source (name source)})]
|
:source (name source)})]
|
||||||
(rds/renderToStaticMarkup elem))))))))
|
(rds/renderToStaticMarkup elem))))))))
|
||||||
|
|
||||||
(defn render-frame
|
(defn render-frame
|
||||||
[objects shape object-id]
|
([objects shape object-id]
|
||||||
|
(render-frame objects shape object-id nil))
|
||||||
|
([objects shape object-id options]
|
||||||
(if (some? shape)
|
(if (some? shape)
|
||||||
(let [fonts (ff/shape->fonts shape objects)
|
(let [fonts (ff/shape->fonts shape objects)
|
||||||
|
|
||||||
bounds (gsb/get-object-bounds objects shape)
|
bounds (gsb/get-object-bounds objects shape)
|
||||||
|
|
||||||
|
background (when (str/ends-with? object-id "component")
|
||||||
|
(or (:background options) "#aab5ba"))
|
||||||
|
|
||||||
x (dm/get-prop bounds :x)
|
x (dm/get-prop bounds :x)
|
||||||
y (dm/get-prop bounds :y)
|
y (dm/get-prop bounds :y)
|
||||||
width (dm/get-prop bounds :width)
|
width (dm/get-prop bounds :width)
|
||||||
|
@ -548,13 +557,15 @@
|
||||||
[fixed-width
|
[fixed-width
|
||||||
fixed-height] (th/get-relative-size width height)
|
fixed-height] (th/get-relative-size width height)
|
||||||
|
|
||||||
|
|
||||||
data (with-redefs [cfg/public-uri cfg/rasterizer-uri]
|
data (with-redefs [cfg/public-uri cfg/rasterizer-uri]
|
||||||
(rds/renderToStaticMarkup
|
(rds/renderToStaticMarkup
|
||||||
(mf/element frame-imposter
|
(mf/element frame-imposter
|
||||||
#js {:objects objects
|
#js {:objects objects
|
||||||
:frame shape
|
:frame shape
|
||||||
:vbox viewbox
|
:vbox viewbox
|
||||||
|
:background background
|
||||||
|
:x x
|
||||||
|
:y y
|
||||||
:width width
|
:width width
|
||||||
:height height})))]
|
:height height})))]
|
||||||
|
|
||||||
|
@ -570,5 +581,7 @@
|
||||||
:width fixed-width
|
:width fixed-width
|
||||||
:height fixed-height
|
:height fixed-height
|
||||||
:styles styles}))))
|
:styles styles}))))
|
||||||
(do (l/warn :msg "imposter shape is nil")
|
|
||||||
(rx/empty))))
|
(do
|
||||||
|
(l/warn :msg "imposter shape is nil")
|
||||||
|
(rx/empty)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue