bookcover-3d-web 0.15.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/svg.js +5 -0
- package/package.json +1 -1
package/dist/svg.js
CHANGED
|
@@ -31,6 +31,11 @@ export async function svg_to_bitmap(svg, w_pt, h_pt) {
|
|
|
31
31
|
img.onerror = () => reject(new Error('[cover-3d] SVG failed to load as image'));
|
|
32
32
|
img.src = url;
|
|
33
33
|
});
|
|
34
|
+
// onload alone doesn't guarantee nested embedded rasters (e.g. a user's
|
|
35
|
+
// background photo embedded in the panel SVG) have finished decoding —
|
|
36
|
+
// notably on Safari, this can race and snapshot a blank background.
|
|
37
|
+
// decode() is spec-guaranteed to wait until the image is fully paintable.
|
|
38
|
+
await img.decode();
|
|
34
39
|
return createImageBitmap(img);
|
|
35
40
|
}
|
|
36
41
|
finally {
|