mirror of
https://github.com/penpot/penpot.git
synced 2025-05-24 01:56:10 +02:00
🎉 Non blocking render wasm (#5726)
This commit is contained in:
parent
f65f7d68e6
commit
8f11a925df
8 changed files with 210 additions and 174 deletions
|
@ -306,11 +306,7 @@
|
|||
(wasm.api/initialize base-objects zoom vbox background)
|
||||
(reset! initialized? true)))
|
||||
|
||||
(mf/with-effect [vbox]
|
||||
(when (and @canvas-init? initialized?)
|
||||
(wasm.api/set-view-zoom zoom vbox)))
|
||||
|
||||
(mf/with-effect [vbox]
|
||||
(mf/with-effect [vbox zoom]
|
||||
(when (and @canvas-init? initialized?)
|
||||
(wasm.api/set-view-box zoom vbox)))
|
||||
|
||||
|
|
|
@ -62,11 +62,6 @@
|
|||
(h/call internal-module "_render")
|
||||
(set! internal-frame-id nil))
|
||||
|
||||
(defn- render-without-cache
|
||||
[_]
|
||||
(h/call internal-module "_render_without_cache")
|
||||
(set! internal-frame-id nil))
|
||||
|
||||
(defn- rgba-from-hex
|
||||
"Takes a hex color in #rrggbb format, and an opacity value from 0 to 1 and returns its 32-bit rgba representation"
|
||||
[hex opacity]
|
||||
|
@ -495,18 +490,13 @@
|
|||
(h/call internal-module "_add_shape_shadow" rgba blur spread x y (translate-shadow-style style) hidden)
|
||||
(recur (inc index)))))))
|
||||
|
||||
(def debounce-render-without-cache (fns/debounce render-without-cache 100))
|
||||
(def debounce-render (fns/debounce render 100))
|
||||
|
||||
(defn set-view-box
|
||||
[zoom vbox]
|
||||
(h/call internal-module "_set_view" zoom (- (:x vbox)) (- (:y vbox)))
|
||||
(h/call internal-module "_pan"))
|
||||
|
||||
(defn set-view-zoom
|
||||
[zoom vbox]
|
||||
(h/call internal-module "_set_view" zoom (- (:x vbox)) (- (:y vbox)))
|
||||
(h/call internal-module "_zoom")
|
||||
(debounce-render-without-cache))
|
||||
(h/call internal-module "_render_from_cache")
|
||||
(debounce-render))
|
||||
|
||||
(defn set-objects
|
||||
[objects]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue