Merge pull request #6526 from penpot/superalex-improve-zoom-performance-and-behaviour

🐛 Fix zoom performance and behaviour
This commit is contained in:
Aitor Moreno 2025-05-22 12:15:38 +02:00 committed by GitHub
commit d54a7d0401
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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
@ -662,7 +664,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"))