mirror of
https://github.com/penpot/penpot.git
synced 2025-05-15 20:56:39 +02:00
🐛 Fix real time blend mode rendering
This commit is contained in:
parent
aa07a8046b
commit
b4e9f9e28c
2 changed files with 36 additions and 15 deletions
|
@ -11,10 +11,13 @@
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.main.data.workspace :as dw]
|
[app.main.data.workspace :as dw]
|
||||||
[app.main.data.workspace.shapes :as dwsh]
|
[app.main.data.workspace.shapes :as dwsh]
|
||||||
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
|
[app.main.features :as features]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.numeric-input :refer [numeric-input*]]
|
[app.main.ui.components.numeric-input :refer [numeric-input*]]
|
||||||
[app.main.ui.components.select :refer [select]]
|
[app.main.ui.components.select :refer [select]]
|
||||||
[app.main.ui.ds.buttons.icon-button :refer [icon-button*]]
|
[app.main.ui.ds.buttons.icon-button :refer [icon-button*]]
|
||||||
|
[app.render-wasm.api :as wasm.api]
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
|
@ -50,6 +53,12 @@
|
||||||
selected-blend-mode (get state :selected-blend-mode)
|
selected-blend-mode (get state :selected-blend-mode)
|
||||||
option-highlighted? (get state :option-highlighted?)
|
option-highlighted? (get state :option-highlighted?)
|
||||||
preview-complete? (get state :preview-complete?)
|
preview-complete? (get state :preview-complete?)
|
||||||
|
wasm-renderer-enabled? (features/use-feature "render-wasm/v1")
|
||||||
|
|
||||||
|
shapes (->
|
||||||
|
(wsh/lookup-page-objects @st/state)
|
||||||
|
(select-keys ids)
|
||||||
|
vals)
|
||||||
|
|
||||||
on-change
|
on-change
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -75,6 +84,12 @@
|
||||||
(swap! state* assoc
|
(swap! state* assoc
|
||||||
:preview-complete? false
|
:preview-complete? false
|
||||||
:option-highlighted? true)
|
:option-highlighted? true)
|
||||||
|
|
||||||
|
(when wasm-renderer-enabled?
|
||||||
|
(doseq [shape shapes]
|
||||||
|
(wasm.api/use-shape (:id shape))
|
||||||
|
(wasm.api/set-shape-blend-mode value)))
|
||||||
|
|
||||||
(st/emit! (dw/set-preview-blend-mode ids value))))
|
(st/emit! (dw/set-preview-blend-mode ids value))))
|
||||||
|
|
||||||
handle-blend-mode-leave
|
handle-blend-mode-leave
|
||||||
|
|
|
@ -271,7 +271,9 @@
|
||||||
(:y first-shape)
|
(:y first-shape)
|
||||||
(:y selected-frame))
|
(:y selected-frame))
|
||||||
|
|
||||||
rule-area-size (/ rulers/ruler-area-size zoom)]
|
rule-area-size (/ rulers/ruler-area-size zoom)
|
||||||
|
preview-blend (-> refs/workspace-preview-blend
|
||||||
|
(mf/deref))]
|
||||||
|
|
||||||
(mf/with-effect []
|
(mf/with-effect []
|
||||||
(when-let [canvas (mf/ref-val canvas-ref)]
|
(when-let [canvas (mf/ref-val canvas-ref)]
|
||||||
|
@ -287,6 +289,10 @@
|
||||||
(when @canvas-init?
|
(when @canvas-init?
|
||||||
(wasm.api/set-objects base-objects)))
|
(wasm.api/set-objects base-objects)))
|
||||||
|
|
||||||
|
(mf/with-effect [preview-blend canvas-init?]
|
||||||
|
(when (and @canvas-init? preview-blend)
|
||||||
|
(wasm.api/request-render)))
|
||||||
|
|
||||||
(mf/with-effect [vbox canvas-init?]
|
(mf/with-effect [vbox canvas-init?]
|
||||||
(when @canvas-init?
|
(when @canvas-init?
|
||||||
(wasm.api/set-view zoom vbox)))
|
(wasm.api/set-view zoom vbox)))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue