Skip to content

Commit

Permalink
fix: cross origin image requests
Browse files Browse the repository at this point in the history
  • Loading branch information
enijar committed Nov 1, 2023
1 parent 857e76c commit 74a0ae4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ function Layer({ optimizedRendering, zIndex = 0, resolution, visible = true, aut

const images = React.useMemo(() => {
const backgroundImage = new Image();
backgroundImage.crossOrigin = "Anonymous";
return { backgroundImage };
}, []);

Expand All @@ -226,6 +227,7 @@ function Layer({ optimizedRendering, zIndex = 0, resolution, visible = true, aut
if (!backgroundImage) return;
if (!CACHED_IMAGES.has(backgroundImage)) {
const image = new Image();
image.crossOrigin = "Anonymous";
image.onload = () => {
if (!mountedRef.current) return;
setShouldRenderKey((shouldRenderKey) => {
Expand Down

0 comments on commit 74a0ae4

Please sign in to comment.