Skip to content

Commit 67a045e

Browse files
marklundinCopilot
andauthored
useAssetViewer Hook (#182)
* Enhance Splat Viewer by adding useAssetViewer hook and updating documentation - Imported and exported the useAssetViewer hook from the splat-viewer-context to provide imperative access to the asset viewer. - Updated documentation to include details about the useAssetViewer hook, explaining its purpose and usage for triggering downloads, toggling fullscreen mode, and accessing loading progress. * Add changeset for useAssetViewer hook in Splat Viewer - Introduced the `useAssetViewer` hook to enhance the Splat Viewer functionality. - Updated documentation to reflect the new hook and its usage. * Update packages/docs/content/blocks/splat-viewer.mdx Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 4511df7 commit 67a045e

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.changeset/orange-bikes-give.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@playcanvas/blocks": minor
3+
"docs": patch
4+
---
5+
6+
We now expose the `useAssetViewer` hook which provides API and context to the Splat Viewer

packages/blocks/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
// Splat Viewer
22
import * as Viewer from "./splat-viewer/index.ts"
3-
export { Viewer };
3+
import { useAssetViewer } from "./splat-viewer/splat-viewer-context.ts";
4+
export { Viewer, useAssetViewer };

packages/docs/content/blocks/splat-viewer.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,18 @@ A responsive and composable component for displaying **Gaussian splats**.
168168
`}
169169
/>
170170

171+
#### useAssetViewer
172+
173+
A hook that provides the context for the asset viewer. This is handy if you need an imperative handle for the viewer. Use this if you need to trigger a download, or toggle the fullscreen mode, or access the loading progress.
174+
175+
<TSDoc
176+
code={`
177+
import { useAssetViewer } from '@playcanvas/blocks';
178+
type $ = ReturnType<typeof useAssetViewer>;
179+
export default $;
180+
`}
181+
/>
182+
171183
#### Controls
172184

173185
A simple container for UI controls that creates a sensible layout and optionally auto hides when the user is interacting.

0 commit comments

Comments
 (0)