Skip to main content

defaultSize

One of the initialization properties of a Spatial Scene, defaultSize affects the size of a Spatial Scene immediately after it is created. It does not necessarily match the values in defaultSize exactly, because the operating system's spatial computing logic still takes priority.

Availability​

ItemValue
Applies towindow scenes support width and height; volume scenes also support depth.
New scenesSet through initScene.
Start sceneSet through the Web App Manifest.
Default valueNone.

Type Signature​

defaultSize type
{
width?: number | string
height?: number | string
depth?: number | string
}

Examples​

Using initScene​

Set defaultSize for a new scene
import { initScene } from "@webspatial/react-sdk";

initScene("newSceneName", defaultConfig => {
return {
...defaultConfig,
type: "volume",
defaultSize: {
width: 500,
height: "1000px",
depth: "1m",
},
};
});
window.open(newSceneUrl, "newSceneName");

Using the Web App Manifest​

Manifest key naming

In a Web App Manifest, convert camelCase keys such as defaultSize to lowercase snake_case such as default_size.

Set default_size for the start scene
{
"name": "example app",
"start_url": "/",
"xr_main_scene": {
"default_size": {
"width": 500,
"height": "1000px"
}
}
}

Default Value​

None.

Accepted Values​

FieldAccepted value
widthA number with px as the default unit, or a string with a unit suffix such as "100px" or "2m".
heightA number with px as the default unit, or a string with a unit suffix such as "100px" or "2m".
depthA number with px as the default unit, or a string with a unit suffix such as "100px" or "2m".