mirror of
https://github.com/penpot/penpot.git
synced 2026-08-05 04:18:41 +00:00
🎉 Apply blur to canvas when switching pages
This commit is contained in:
parent
6029f9bb51
commit
8bd3ef717c
@ -275,7 +275,11 @@
|
|||||||
:wglobal wglobal
|
:wglobal wglobal
|
||||||
:layout layout}])
|
:layout layout}])
|
||||||
(when (or (not (and file-loaded? page-id))
|
(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*])]]]]]]))
|
[:> workspace-loader*])]]]]]]))
|
||||||
|
|
||||||
(mf/defc workspace-page*
|
(mf/defc workspace-page*
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
[app.main.data.helpers :as dsh]
|
[app.main.data.helpers :as dsh]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
[app.main.data.workspace :as dw]
|
[app.main.data.workspace :as dw]
|
||||||
|
[app.main.features :as features]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.title-bar :refer [title-bar*]]
|
[app.main.ui.components.title-bar :refer [title-bar*]]
|
||||||
@ -25,6 +26,7 @@
|
|||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
[app.util.i18n :as i18n :refer [tr]]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
[app.util.keyboard :as kbd]
|
[app.util.keyboard :as kbd]
|
||||||
|
[app.util.timers :as timers]
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
[okulary.core :as l]
|
[okulary.core :as l]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
@ -52,6 +54,13 @@
|
|||||||
refs/workspace-data
|
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
|
;; --- Page Item
|
||||||
|
|
||||||
(mf/defc 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)))
|
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?)
|
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
|
on-delete
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps id)
|
(mf/deps id)
|
||||||
@ -155,7 +179,7 @@
|
|||||||
:selected selected?)
|
:selected selected?)
|
||||||
:data-testid (dm/str "page-" id)
|
:data-testid (dm/str "page-" id)
|
||||||
:tab-index "0"
|
:tab-index "0"
|
||||||
:on-click navigate-fn
|
:on-click on-click
|
||||||
:on-double-click on-double-click
|
:on-double-click on-double-click
|
||||||
:on-context-menu on-context-menu}
|
:on-context-menu on-context-menu}
|
||||||
[:div {:class (stl/css :page-icon)}
|
[:div {:class (stl/css :page-icon)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user