mirror of
https://github.com/penpot/penpot.git
synced 2025-02-01 20:09:04 -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]
|
||||
(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))
|
||||
|
|
|
@ -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,48 +529,59 @@
|
|||
(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]
|
||||
(if (some? shape)
|
||||
(let [fonts (ff/shape->fonts shape objects)
|
||||
([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)
|
||||
bounds (gsb/get-object-bounds objects shape)
|
||||
|
||||
x (dm/get-prop bounds :x)
|
||||
y (dm/get-prop bounds :y)
|
||||
width (dm/get-prop bounds :width)
|
||||
height (dm/get-prop bounds :height)
|
||||
background (when (str/ends-with? object-id "component")
|
||||
(or (:background options) "#aab5ba"))
|
||||
|
||||
viewbox (str/ffmt "% % % %" x y width height)
|
||||
x (dm/get-prop bounds :x)
|
||||
y (dm/get-prop bounds :y)
|
||||
width (dm/get-prop bounds :width)
|
||||
height (dm/get-prop bounds :height)
|
||||
|
||||
[fixed-width
|
||||
fixed-height] (th/get-relative-size width height)
|
||||
viewbox (str/ffmt "% % % %" x y width height)
|
||||
|
||||
[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
|
||||
:width width
|
||||
:height 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})))]
|
||||
|
||||
(->> (fonts/render-font-styles-cached fonts)
|
||||
(rx/catch (fn [cause]
|
||||
(l/err :hint "unexpected error on rendering imposter"
|
||||
:cause cause)
|
||||
(rx/empty)))
|
||||
(rx/map (fn [styles]
|
||||
{:id object-id
|
||||
:data data
|
||||
:viewbox viewbox
|
||||
:width fixed-width
|
||||
:height fixed-height
|
||||
:styles styles}))))
|
||||
(do (l/warn :msg "imposter shape is nil")
|
||||
(rx/empty))))
|
||||
(->> (fonts/render-font-styles-cached fonts)
|
||||
(rx/catch (fn [cause]
|
||||
(l/err :hint "unexpected error on rendering imposter"
|
||||
:cause cause)
|
||||
(rx/empty)))
|
||||
(rx/map (fn [styles]
|
||||
{:id object-id
|
||||
:data data
|
||||
:viewbox viewbox
|
||||
:width fixed-width
|
||||
:height fixed-height
|
||||
:styles styles}))))
|
||||
|
||||
(do
|
||||
(l/warn :msg "imposter shape is nil")
|
||||
(rx/empty)))))
|
||||
|
|
Loading…
Add table
Reference in a new issue