Merge pull request #5534 from penpot/superalex-render-wasm-blur-support

🎉 Render wasm blur support
This commit is contained in:
Belén Albeza 2025-01-13 09:42:53 +01:00 committed by GitHub
commit 10f2d5d09d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 117 additions and 11 deletions

View file

@ -346,7 +346,6 @@
[hidden]
(h/call internal-module "_set_shape_hidden" hidden))
(defn- translate-bool-type
[bool-type]
(case bool-type
@ -364,6 +363,19 @@
[content]
(set-shape-path-content content))
(defn- translate-blur-type
[blur-type]
(case blur-type
:layer-blur 1
0))
(defn set-shape-blur
[blur]
(let [type (-> blur :type translate-blur-type)
hidden (:hidden blur)
value (:value blur)]
(h/call internal-module "_set_shape_blur" type hidden value)))
(def debounce-render-without-cache (fns/debounce render-without-cache 100))
(defn set-view
@ -395,7 +407,8 @@
opacity (dm/get-prop shape :opacity)
hidden (dm/get-prop shape :hidden)
content (dm/get-prop shape :content)
bool-content (dm/get-prop shape :bool-content)]
bool-content (dm/get-prop shape :bool-content)
blur (dm/get-prop shape :blur)]
(use-shape id)
(set-shape-type type)
@ -407,6 +420,8 @@
(set-shape-children children)
(set-shape-opacity opacity)
(set-shape-hidden hidden)
(when (some? blur)
(set-shape-blur blur))
(when (and (some? content) (= type :path)) (set-shape-path-content content))
(when (some? bool-content) (set-shape-bool-content bool-content))
(let [pending' (concat (set-shape-fills fills) (set-shape-strokes strokes))]

View file

@ -106,7 +106,7 @@
;; --- SHAPE IMPL
(defn- impl-assoc
(defn- set-wasm-attrs
[self k v]
(when ^boolean shape/*wasm-sync*
(api/use-shape (:id self))
@ -125,11 +125,16 @@
:hidden (api/set-shape-hidden v)
:shapes (api/set-shape-children v)
:content (api/set-shape-path-content v)
:blur (api/set-shape-blur v)
nil)
;; when something synced with wasm
;; is modified, we need to request
;; a new render.
(api/request-render))
(api/request-render)))
(defn- impl-assoc
[self k v]
(set-wasm-attrs self k v)
(case k
:id
(ShapeProxy. v
@ -150,6 +155,7 @@
(defn- impl-dissoc
[self k]
(set-wasm-attrs self k nil)
(case k
:id
(ShapeProxy. nil