mirror of
https://github.com/penpot/penpot.git
synced 2026-09-10 14:09:17 +00:00
Merge pull request #9036 from penpot/alotor-fix-thumbnail-images
🐛 Fix problem with dashboard thumbnails images
This commit is contained in:
commit
3f0d103cb3
@ -492,7 +492,9 @@
|
|||||||
(try
|
(try
|
||||||
(when (wasm.api/init-canvas-context os-canvas)
|
(when (wasm.api/init-canvas-context os-canvas)
|
||||||
(wasm.api/initialize-viewport
|
(wasm.api/initialize-viewport
|
||||||
objects scale bounds "#000000" 0
|
objects scale bounds
|
||||||
|
:background-opacity 0
|
||||||
|
:on-render
|
||||||
(fn []
|
(fn []
|
||||||
(wasm.api/render-sync-shape object-id)
|
(wasm.api/render-sync-shape object-id)
|
||||||
(ts/raf
|
(ts/raf
|
||||||
|
|||||||
@ -408,7 +408,7 @@
|
|||||||
(mf/set-ref-val! last-file-version-id-ref file-version-id))
|
(mf/set-ref-val! last-file-version-id-ref file-version-id))
|
||||||
(when (and (some? file-version-id)
|
(when (and (some? file-version-id)
|
||||||
(not= file-version-id (mf/ref-val last-file-version-id-ref)))
|
(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/set-ref-val! last-file-version-id-ref file-version-id)))))
|
||||||
|
|
||||||
(mf/with-effect [focus]
|
(mf/with-effect [focus]
|
||||||
|
|||||||
@ -1398,14 +1398,14 @@
|
|||||||
loading begins, allowing callers to reveal the page content during
|
loading begins, allowing callers to reveal the page content during
|
||||||
transitions."
|
transitions."
|
||||||
([objects]
|
([objects]
|
||||||
(set-objects objects nil nil))
|
(set-objects objects nil nil false))
|
||||||
([objects render-callback]
|
([objects render-callback]
|
||||||
(set-objects objects render-callback nil))
|
(set-objects objects render-callback nil false))
|
||||||
([objects render-callback on-shapes-ready]
|
([objects render-callback on-shapes-ready force-sync]
|
||||||
(perf/begin-measure "set-objects")
|
(perf/begin-measure "set-objects")
|
||||||
(let [shapes (shapes-in-tree-order objects)
|
(let [shapes (shapes-in-tree-order objects)
|
||||||
total-shapes (count shapes)]
|
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)
|
(set-objects-sync shapes render-callback on-shapes-ready)
|
||||||
(do
|
(do
|
||||||
(begin-shapes-loading!)
|
(begin-shapes-loading!)
|
||||||
@ -1554,19 +1554,16 @@
|
|||||||
(request-render "set-modifiers")))))
|
(request-render "set-modifiers")))))
|
||||||
|
|
||||||
(defn initialize-viewport
|
(defn initialize-viewport
|
||||||
([base-objects zoom vbox background]
|
[base-objects zoom vbox &
|
||||||
(initialize-viewport base-objects zoom vbox background 1 nil nil))
|
{:keys [background background-opacity on-render on-shapes-ready force-sync]
|
||||||
([base-objects zoom vbox background callback]
|
:or {background-opacity 1}}]
|
||||||
(initialize-viewport base-objects zoom vbox background 1 callback nil))
|
(let [rgba (when background (sr-clr/hex->u32argb background background-opacity))
|
||||||
([base-objects zoom vbox background background-opacity callback]
|
total-shapes (count (vals base-objects))]
|
||||||
(initialize-viewport base-objects zoom vbox background background-opacity callback nil))
|
|
||||||
([base-objects zoom vbox background background-opacity callback on-shapes-ready]
|
(when rgba (h/call wasm/internal-module "_set_canvas_background" rgba))
|
||||||
(let [rgba (sr-clr/hex->u32argb background background-opacity)
|
(h/call wasm/internal-module "_set_view" zoom (- (:x vbox)) (- (:y vbox)))
|
||||||
total-shapes (count (vals base-objects))]
|
(h/call wasm/internal-module "_init_shapes_pool" total-shapes)
|
||||||
(h/call wasm/internal-module "_set_canvas_background" rgba)
|
(set-objects base-objects on-render on-shapes-ready force-sync)))
|
||||||
(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))))
|
|
||||||
|
|
||||||
(def ^:private default-context-options
|
(def ^:private default-context-options
|
||||||
#js {:antialias false
|
#js {:antialias false
|
||||||
|
|||||||
@ -171,7 +171,10 @@
|
|||||||
zoom (/ width (:width vbox))]
|
zoom (/ width (:width vbox))]
|
||||||
|
|
||||||
(wasm.api/initialize-viewport
|
(wasm.api/initialize-viewport
|
||||||
objects zoom vbox bgcolor
|
objects zoom vbox
|
||||||
|
:background bgcolor
|
||||||
|
:force-sync true
|
||||||
|
:on-render
|
||||||
(fn []
|
(fn []
|
||||||
(if frame
|
(if frame
|
||||||
(wasm.api/render-sync-shape (:id frame))
|
(wasm.api/render-sync-shape (:id frame))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user