Files
storyteller-bevy/studio-web/src/lib/url-params.ts
T
Brooks Palin 343919a9f5 Allow Skybox to take a Color (#57)
This PR Adds the ability to set the color of the skybox using the URL
parameters.

- Now you can pass a color's hexadecimal number (without the #) in the
  skybox parameter, and that will set the skybox to that color.
2024-02-28 00:11:37 -05:00

24 lines
901 B
TypeScript

import { StudioMode } from "@storyteller/studio";
import { match } from "@storyteller/utility";
export class StudioURLParams {
#_nativeParams?: URLSearchParams;
get #nativeParams() {
return this.#_nativeParams ??= new URLSearchParams(document.location.search);
}
get objectId() { return this.#nativeParams.get("objectId") ?? undefined; }
get bvh() { return this.#nativeParams.get("bvh") ?? undefined; }
get mixamo() { return this.#nativeParams.get("mixamo") ?? undefined; }
get sceneImport() { return this.#nativeParams.get("sceneImport") ?? undefined; }
get scene() { return this.#nativeParams.get("scene") ?? undefined; }
get skybox() { return this.#nativeParams.get("skybox") ?? undefined; }
get mode(): StudioMode {
return match(this.#nativeParams.get("mode"), {
"studio": () => StudioMode.Editor,
"viewer": () => StudioMode.Viewer,
_: () => StudioMode.Viewer,
});
}
}