Skip to main content

resizability

One of the initialization properties of a Spatial Scene, resizability affects the constraints applied when a user drags the Spatial Scene to resize it after creation. It can provide separate min and max constraints for the width and height of the Spatial Scene.

Availability

ItemValue
Applies toAll resizable Spatial Scenes.
New scenesSet through initScene.
Start sceneSet through the Web App Manifest.
Default valueNone.

Type Signature

resizability type
{
minWidth?: number | string
minHeight?: number | string
maxWidth?: number | string
maxHeight?: number | string
}

Examples

Using initScene

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

initScene("newSceneName", defaultConfig => {
return {
...defaultConfig,
type: "volume",
resizability: {
minWidth: 100,
minHeight: "100px",
maxWidth: 200,
maxHeight: 200,
},
};
});
window.open(newSceneUrl, "newSceneName");

Using the Web App Manifest

Manifest key naming

In a Web App Manifest, convert camelCase keys such as minWidth to lowercase snake_case such as min_width.

Set resizability for the start scene
{
"name": "example app",
"start_url": "/",
"xr_main_scene": {
"resizability": {
"min_width": 100,
"min_height": "100px",
"max_width": 200,
"max_height": 200
}
}
}

Default Value

None.

Accepted Values

FieldAccepted value
minWidthA number with px as the default unit, or a string with a unit suffix such as "100px" or "2m".
minHeightA number with px as the default unit, or a string with a unit suffix such as "100px" or "2m".
maxWidthA number with px as the default unit, or a string with a unit suffix such as "100px" or "2m".
maxHeightA number with px as the default unit, or a string with a unit suffix such as "100px" or "2m".