mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 12:48:33 +02:00
Merge pull request #6984 from penpot/superalex-fix-switching-theme-form-wasm-render
🐛 Fix switching theme for wasm render
This commit is contained in:
commit
ff7e34e308
2 changed files with 36 additions and 24 deletions
|
@ -1065,3 +1065,9 @@
|
|||
(js/console.error cause)
|
||||
(p/resolved false)))))
|
||||
(p/resolved false))))
|
||||
|
||||
(defn shape-in-current-page?
|
||||
"Check if a shape is in the current page by looking up the current page objects"
|
||||
[shape-id]
|
||||
(let [objects (deref refs/workspace-page-objects)]
|
||||
(contains? objects shape-id)))
|
||||
|
|
|
@ -208,6 +208,8 @@
|
|||
|
||||
(defn set-wasm-multi-attrs!
|
||||
[shape properties]
|
||||
;; Only call WASM API if the shape is in the current page
|
||||
(when (api/shape-in-current-page? (:id shape))
|
||||
(api/use-shape (:id shape))
|
||||
(let [result
|
||||
(->> properties
|
||||
|
@ -224,11 +226,13 @@
|
|||
(api/request-render "set-wasm-attrs-pending"))))
|
||||
(do
|
||||
(api/update-shape-tiles)
|
||||
(api/request-render "set-wasm-attrs")))))
|
||||
(api/request-render "set-wasm-attrs"))))))
|
||||
|
||||
(defn set-wasm-attrs!
|
||||
[shape k v]
|
||||
(let [shape (assoc shape k v)]
|
||||
;; Only call WASM API if the shape is in the current page
|
||||
(when (api/shape-in-current-page? (:id shape))
|
||||
(api/use-shape (:id shape))
|
||||
(let [result (set-wasm-single-attr! shape k)
|
||||
pending (-> (d/index-by :key :callback result) vals)]
|
||||
|
@ -244,7 +248,7 @@
|
|||
(api/request-render "set-wasm-attrs-pending"))))
|
||||
(do
|
||||
(api/update-shape-tiles)
|
||||
(api/request-render "set-wasm-attrs"))))))
|
||||
(api/request-render "set-wasm-attrs")))))))
|
||||
|
||||
(defn- impl-assoc
|
||||
[self k v]
|
||||
|
@ -274,7 +278,9 @@
|
|||
[self k]
|
||||
(when ^boolean shape/*wasm-sync*
|
||||
(binding [shape/*wasm-sync* false]
|
||||
(set-wasm-attrs! self k nil)))
|
||||
;; Only call WASM API if the shape is in the current page
|
||||
(when (api/shape-in-current-page? (.-id ^ShapeProxy self))
|
||||
(set-wasm-attrs! self k nil))))
|
||||
|
||||
(case k
|
||||
:id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue