🐛 Fix problem with dashboard thumbnails images

This commit is contained in:
alonso.torres 2026-04-16 16:07:49 +02:00
parent b74d920d03
commit bfa1ae051f
4 changed files with 22 additions and 20 deletions

View File

@ -492,7 +492,9 @@
(try
(when (wasm.api/init-canvas-context os-canvas)
(wasm.api/initialize-viewport
objects scale bounds "#000000" 0
objects scale bounds
:background-opacity 0
:on-render
(fn []
(wasm.api/render-sync-shape object-id)
(ts/raf

View File

@ -408,7 +408,7 @@
(mf/set-ref-val! last-file-version-id-ref file-version-id))
(when (and (some? file-version-id)
(not= file-version-id (mf/ref-val last-file-version-id-ref)))
(wasm.api/initialize-viewport base-objects zoom vbox background)
(wasm.api/initialize-viewport base-objects zoom vbox :background background)
(mf/set-ref-val! last-file-version-id-ref file-version-id)))))
(mf/with-effect [focus]

View File

@ -1398,14 +1398,14 @@
loading begins, allowing callers to reveal the page content during
transitions."
([objects]
(set-objects objects nil nil))
(set-objects objects nil nil false))
([objects render-callback]
(set-objects objects render-callback nil))
([objects render-callback on-shapes-ready]
(set-objects objects render-callback nil false))
([objects render-callback on-shapes-ready force-sync]
(perf/begin-measure "set-objects")
(let [shapes (shapes-in-tree-order objects)
total-shapes (count shapes)]
(if (< total-shapes ASYNC_THRESHOLD)
(if (or force-sync (< total-shapes ASYNC_THRESHOLD))
(set-objects-sync shapes render-callback on-shapes-ready)
(do
(begin-shapes-loading!)
@ -1554,19 +1554,16 @@
(request-render "set-modifiers")))))
(defn initialize-viewport
([base-objects zoom vbox background]
(initialize-viewport base-objects zoom vbox background 1 nil nil))
([base-objects zoom vbox background callback]
(initialize-viewport base-objects zoom vbox background 1 callback nil))
([base-objects zoom vbox background background-opacity callback]
(initialize-viewport base-objects zoom vbox background background-opacity callback nil))
([base-objects zoom vbox background background-opacity callback on-shapes-ready]
(let [rgba (sr-clr/hex->u32argb background background-opacity)
total-shapes (count (vals base-objects))]
(h/call wasm/internal-module "_set_canvas_background" rgba)
(h/call wasm/internal-module "_set_view" zoom (- (:x vbox)) (- (:y vbox)))
(h/call wasm/internal-module "_init_shapes_pool" total-shapes)
(set-objects base-objects callback on-shapes-ready))))
[base-objects zoom vbox &
{:keys [background background-opacity on-render on-shapes-ready force-sync]
:or {background-opacity 1}}]
(let [rgba (when background (sr-clr/hex->u32argb background background-opacity))
total-shapes (count (vals base-objects))]
(when rgba (h/call wasm/internal-module "_set_canvas_background" rgba))
(h/call wasm/internal-module "_set_view" zoom (- (:x vbox)) (- (:y vbox)))
(h/call wasm/internal-module "_init_shapes_pool" total-shapes)
(set-objects base-objects on-render on-shapes-ready force-sync)))
(def ^:private default-context-options
#js {:antialias false

View File

@ -171,7 +171,10 @@
zoom (/ width (:width vbox))]
(wasm.api/initialize-viewport
objects zoom vbox bgcolor
objects zoom vbox
:background bgcolor
:force-sync true
:on-render
(fn []
(if frame
(wasm.api/render-sync-shape (:id frame))