mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
🐛 Fix problem with dashboard thumbnails images
This commit is contained in:
parent
b74d920d03
commit
bfa1ae051f
@ -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
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user