Skip to content

Commit

Permalink
Type rando3D package definition
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrucs committed Apr 9, 2024
1 parent 6f28853 commit 40085b6
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 8 deletions.
10 changes: 2 additions & 8 deletions frontend/src/components/3D/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@ import { DetailsAdvice } from 'components/pages/details/components/DetailsAdvice
import { LoaderOverlay, Poi, PoiSide, Wrapper } from './3D.style';
import Interface from './Interface';

declare global {
interface Window {
Rando3D?: any;
}
}

interface ThreeDProps {
demURL: string;
profileURL: string;
onRequestClose: () => void | undefined;
onRequestClose: () => void;
title: string;
trekId: number;
}
Expand Down Expand Up @@ -114,7 +108,7 @@ export const ThreeD: React.FC<ThreeDProps> = ({
scene.current = null;
}

const app3D = new window.Rando3D();
const app3D = window.Rando3D();
scene.current = app3D.init(customSettings, canvasRef.current, 'examine');
scene.current?.init(() => setLoading(false));
}, [
Expand Down
45 changes: 45 additions & 0 deletions frontend/src/types/rando3d.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
declare module 'rando3d' {
interface Rando3DSettings {
IMAGES_FOLDER: string;
DEM_URL: string;
PROFILE_URL: string;
POI_URL: string;
TILE_TEX_URL: string | null;
SIDE_TEX_URL: string;
CAM_SPEED_F: number;
PICTO_PREFIX: string;
TREK_COLOR: {
R: number;
V: number;
B: number;
};
NO_DESCRIPTION_MESSAGE: string | MessageFormatElement[];
CAMERA_MESSAGES: {
bird: string | MessageFormatElement[];
examine: string | MessageFormatElement[];
hiker: string | MessageFormatElement[];
};
MODE: {
bird: {
enabled: boolean;
};
hiker: {
enabled: boolean;
};
};
}
declare global {
interface Window {
Rando3D?: () => {
init: (
settings: Rando3DSettings,
element: HTMLElement | null,
view: string,
) => {
init: () => void;
deinit: () => void;
};
};
}
}
}

0 comments on commit 40085b6

Please sign in to comment.