Merge pull request #5435 from penpot/superalex-render-wasm-show-content-support

🎉 Suport for show-content in render wasm
This commit is contained in:
Belén Albeza 2024-12-10 13:11:46 +01:00 committed by GitHub
commit 8599c52fc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 23 deletions

View file

@ -80,6 +80,10 @@
(aget buffer 2)
(aget buffer 3))))
(defn set-shape-clip-content
[clip-content]
(h/call internal-module "_set_shape_clip_content" clip-content))
(defn set-shape-selrect
[selrect]
(h/call internal-module "_set_shape_selrect"
@ -247,21 +251,23 @@
pending
(loop [index 0 pending []]
(if (< index total-shapes)
(let [shape (nth shapes index)
type (dm/get-prop shape :type)
id (dm/get-prop shape :id)
selrect (dm/get-prop shape :selrect)
rotation (dm/get-prop shape :rotation)
transform (dm/get-prop shape :transform)
fills (if (= type :group)
[] (dm/get-prop shape :fills))
children (dm/get-prop shape :shapes)
blend-mode (dm/get-prop shape :blend-mode)
opacity (dm/get-prop shape :opacity)
hidden (dm/get-prop shape :hidden)
content (dm/get-prop shape :content)]
(let [shape (nth shapes index)
type (dm/get-prop shape :type)
id (dm/get-prop shape :id)
clip-content (not (dm/get-prop shape :show-content))
selrect (dm/get-prop shape :selrect)
rotation (dm/get-prop shape :rotation)
transform (dm/get-prop shape :transform)
fills (if (= type :group)
[] (dm/get-prop shape :fills))
children (dm/get-prop shape :shapes)
blend-mode (dm/get-prop shape :blend-mode)
opacity (dm/get-prop shape :opacity)
hidden (dm/get-prop shape :hidden)
content (dm/get-prop shape :content)]
(use-shape id)
(set-shape-clip-content clip-content)
(set-shape-selrect selrect)
(set-shape-rotation rotation)
(set-shape-transform transform)

View file

@ -111,15 +111,16 @@
(when ^boolean shape/*wasm-sync*
(api/use-shape (:id self))
(case k
:selrect (api/set-shape-selrect v)
:rotation (api/set-shape-rotation v)
:transform (api/set-shape-transform v)
:fills (api/set-shape-fills v)
:blend-mode (api/set-shape-blend-mode v)
:opacity (api/set-shape-opacity v)
:hidden (api/set-shape-hidden v)
:shapes (api/set-shape-children v)
:content (api/set-shape-path-content v)
:selrect (api/set-shape-selrect v)
:show-content (api/set-shape-clip-content (not v))
:rotation (api/set-shape-rotation v)
:transform (api/set-shape-transform v)
:fills (api/set-shape-fills v)
:blend-mode (api/set-shape-blend-mode v)
:opacity (api/set-shape-opacity v)
:hidden (api/set-shape-hidden v)
:shapes (api/set-shape-children v)
:content (api/set-shape-path-content v)
nil)
;; when something synced with wasm
;; is modified, we need to request