🐛 Fix zoom performance and behaviour

This commit is contained in:
Alejandro Alonso 2025-05-21 14:41:12 +02:00
parent ec29c4f5fe
commit 3597e5bb54
4 changed files with 60 additions and 30 deletions

View file

@ -30,8 +30,8 @@
[app.render-wasm.serializers.fills :as sr-fills]
[app.render-wasm.wasm :as wasm]
[app.util.debug :as dbg]
[app.util.functions :as fns]
[app.util.http :as http]
[app.util.perf :as uperf]
[app.util.webapi :as wapi]
[beicon.v2.core :as rx]
[promesa.core :as p]
@ -101,6 +101,8 @@
(h/call wasm/internal-module "_render" timestamp)
(set! wasm/internal-frame-id nil))
(def debounce-render (fns/debounce render 100))
(defn cancel-render
[_]
(when wasm/internal-frame-id
@ -661,7 +663,8 @@
(defn set-view-box
[zoom vbox]
(h/call wasm/internal-module "_set_view" zoom (- (:x vbox)) (- (:y vbox)))
(render (uperf/now)))
(h/call wasm/internal-module "_render_from_cache")
(debounce-render))
(defn clear-drawing-cache []
(h/call wasm/internal-module "_clear_drawing_cache"))