MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / getNextCameraHashUpdate

Function getNextCameraHashUpdate

src/hooks/urlStateHashPolicy.ts:21–35  ·  view source on GitHub ↗
({
  href,
  encodedState,
  lastEncodedState,
}: CameraHashUpdateOptions)

Source from the content-addressed store, hash-verified

19}
20
21export function getNextCameraHashUpdate({
22 href,
23 encodedState,
24 lastEncodedState,
25}: CameraHashUpdateOptions): CameraHashUpdate | null {
26 if (encodedState === lastEncodedState) return null;
27
28 const url = new URL(href);
29 url.hash = encodedState;
30
31 return {
32 encodedState,
33 url: url.toString(),
34 };
35}
36
37export async function decodeCameraStateFromHash(hash: string): Promise<CameraViewState | null> {
38 const hashContent = hash.startsWith('#') ? hash.slice(1) : hash;

Callers 2

useUrlStateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected