0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-08 08:09:14 -05:00

🐛 Fix components assets blend mode not applied

This commit is contained in:
Aitor 2023-12-04 16:10:22 +01:00 committed by Andrey Antukh
parent e9ae4251ff
commit fd43091d3a
2 changed files with 49 additions and 36 deletions

View file

@ -152,7 +152,7 @@
(watch [_ state stream]
(l/dbg :hint "update thumbnail" :object-id object-id :tag tag)
;; 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/merge
(rx/of (assoc-thumbnail object-id uri))

View file

@ -233,7 +233,7 @@
(mf/defc frame-imposter
{::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)]
[:& (mf/provider muc/render-thumbnails) {:value false}
[:svg {:view-box vbox
@ -243,6 +243,8 @@
:xmlns "http://www.w3.org/2000/svg"
:xmlnsXlink "http://www.w3.org/1999/xlink"
:fill "none"}
(when (some? background)
[:rect {:x x :y y :width width :height height :fill background}])
[:& shape-wrapper {:shape frame}]]]))
;; Component that serves for render frame thumbnails, mainly used in
@ -527,17 +529,24 @@
(rx/map
(fn [data]
(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)})]
(rds/renderToStaticMarkup elem))))))))
(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)
(let [fonts (ff/shape->fonts shape objects)
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)
y (dm/get-prop bounds :y)
width (dm/get-prop bounds :width)
@ -548,13 +557,15 @@
[fixed-width
fixed-height] (th/get-relative-size width height)
data (with-redefs [cfg/public-uri cfg/rasterizer-uri]
(rds/renderToStaticMarkup
(mf/element frame-imposter
#js {:objects objects
:frame shape
:vbox viewbox
:background background
:x x
:y y
:width width
:height height})))]
@ -570,5 +581,7 @@
:width fixed-width
:height fixed-height
:styles styles}))))
(do (l/warn :msg "imposter shape is nil")
(rx/empty))))
(do
(l/warn :msg "imposter shape is nil")
(rx/empty)))))