Skip to content

Commit

Permalink
fix: small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MrFlashAccount committed Jan 27, 2024
1 parent 76c3316 commit 7ee9fbe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
11 changes: 4 additions & 7 deletions src/components/earth/my-earth.wc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,21 +164,18 @@ export class MyEarth extends HTMLElement {

#loadTextures = () =>
new Promise<HTMLImageElement>((resolve, reject) => {
const img = this.querySelector("img") as HTMLImageElement;
const img = this.querySelector("img");

if (!img) {
reject(new Error("Image not found"));
return;
return reject(new Error("Image not found"));
}

if (img.complete) {
resolve(img);
return;
return resolve(img);
}

img.onload = () => resolve(img);
img.onerror = () =>
reject(new Error(`Failed to load image ${img.src}`));
img.onerror = () => reject(new Error(`Failed to load image ${img.src}`));
});

#handleResize = (width: number, height: number) => {
Expand Down
16 changes: 13 additions & 3 deletions src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
/// <reference types="@astrojs/image/client" />

declare module '*.png?url' {
const url: string;
export default url;
declare module "*.png?url" {
const url: string;
export default url;
}

declare module "*.webp?url" {
const url: string;
export default url;
}

declare module "*.glsl?raw" {
const content: string;
export default content;
}

0 comments on commit 7ee9fbe

Please # to comment.