From 8bd3ef717c08f8f9bb762c42cff4767d99eb746d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bel=C3=A9n=20Albeza?= Date: Wed, 14 Jan 2026 18:13:56 +0100 Subject: [PATCH] :tada: Apply blur to canvas when switching pages --- frontend/src/app/main/ui/workspace.cljs | 6 ++++- .../main/ui/workspace/sidebar/sitemap.cljs | 26 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace.cljs b/frontend/src/app/main/ui/workspace.cljs index 53a1dc2621..10c25578a4 100644 --- a/frontend/src/app/main/ui/workspace.cljs +++ b/frontend/src/app/main/ui/workspace.cljs @@ -275,7 +275,11 @@ :wglobal wglobal :layout layout}]) (when (or (not (and file-loaded? page-id)) - (and wasm-renderer-enabled? (not @first-frame-rendered?))) + ;; in wasm renderer, extend the pixel loader until the first frame is rendered + ;; but do not apply it when switching pages + (and wasm-renderer-enabled? + (not file-loaded?) + (not @first-frame-rendered?))) [:> workspace-loader*])]]]]]])) (mf/defc workspace-page* diff --git a/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs b/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs index 28fe1cee38..040b1055b4 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/sitemap.cljs @@ -13,6 +13,7 @@ [app.main.data.helpers :as dsh] [app.main.data.modal :as modal] [app.main.data.workspace :as dw] + [app.main.features :as features] [app.main.refs :as refs] [app.main.store :as st] [app.main.ui.components.title-bar :refer [title-bar*]] @@ -25,6 +26,7 @@ [app.util.dom :as dom] [app.util.i18n :as i18n :refer [tr]] [app.util.keyboard :as kbd] + [app.util.timers :as timers] [cuerdas.core :as str] [okulary.core :as l] [rumext.v2 :as mf])) @@ -52,6 +54,13 @@ refs/workspace-data =)) +(defn- apply-canvas-blur + "Apply blur filter to the viewport canvas element immediately. + This is used to provide visual feedback during page navigation." + [] + (when-let [canvas (dom/get-element "render")] + (dom/set-style! canvas "filter" "blur(8px)"))) + ;; --- Page Item (mf/defc page-item @@ -63,6 +72,21 @@ navigate-fn (mf/use-fn (mf/deps id) #(st/emit! :interrupt (dcm/go-to-workspace :page-id id))) read-only? (mf/use-ctx ctx/workspace-read-only?) + on-click + (mf/use-fn + (mf/deps id) + (fn [] + ;; when using the wasm renderer, apply a blur effect to the viewport canvas + (if (features/active-feature? @st/state "render-wasm/v1") + (do + (apply-canvas-blur) + ;; NOTE: it seems we need double RAF so the blur is actually applied and visible + ;; in the canvas :( + (timers/raf + (fn [] + (timers/raf navigate-fn)))) + (navigate-fn)))) + on-delete (mf/use-fn (mf/deps id) @@ -155,7 +179,7 @@ :selected selected?) :data-testid (dm/str "page-" id) :tab-index "0" - :on-click navigate-fn + :on-click on-click :on-double-click on-double-click :on-context-menu on-context-menu} [:div {:class (stl/css :page-icon)}