@snap/camera-kit
Version:
Camera Kit Web
60 lines (48 loc) • 1.19 kB
Markdown
[**CameraKit Web SDK v1.13.0**](../README.md)
***
[CameraKit Web SDK](../globals.md) / ScreenRegions
# Type Alias: ScreenRegions
> **ScreenRegions**: `{ [K in ScreenRegionType]?: ScreenRegion }`
Configuration for screen regions used by Lenses.
Screen regions help Lenses adapt their content placement based on the host
application's UI layout. All coordinates are normalized (0.0 to 1.0) relative
to the canvas dimensions.
Only the regions specified in this object will be active - any previously set
regions not included will be automatically removed.
## Example
```typescript
// Set initial safe rendering area
await session.setScreenRegions({
safeRender: {
x: 0.1,
y: 0.1,
width: 0.8,
height: 0.8
}
});
// When keyboard appears, update both regions
await session.setScreenRegions({
safeRender: {
x: 0.1,
y: 0.1,
width: 0.8,
height: 0.5
},
keyboard: {
x: 0,
y: 0.5,
width: 1.0,
height: 0.5
}
});
// When keyboard disappears, only specify safeRender
// (keyboard region will be automatically removed)
await session.setScreenRegions({
safeRender: {
x: 0.1,
y: 0.1,
width: 0.8,
height: 0.8
}
});
```