TLCamera
See source codeExtends BaseRecord<'camera', TLCameraId>.
A camera record representing the viewport's position and zoom level. The camera defines what portion of the infinite canvas is visible to the user.
interface TLCamera extends BaseRecord<'camera', TLCameraId> {}Example
const camera: TLCamera = {
id: 'camera:user1',
typeName: 'camera',
x: 100, // Camera x position (negative values pan right)
y: 50, // Camera y position (negative values pan down)
z: 0.5, // Zoom level (1 = 100%, 0.5 = 50%, 2 = 200%)
meta: {
userId: 'user123',
lastUpdated: Date.now(),
},
}
// Set camera position and zoom
editor.setCamera({ x: -200, y: -100, z: 1.5 })Properties
id
readonly
from BaseRecord
readonly id: Idmeta
User-defined metadata for the camera
meta: JsonObjecttypeName
readonly
from BaseRecord
readonly typeName: TypeNamex
Camera x position. Negative values move the viewport right
x: numbery
Camera y position. Negative values move the viewport down
y: numberz
Zoom level. 1 = 100%, 0.5 = 50% zoom, 2 = 200% zoom
z: numberPrev
TLBookmarkShapePropsNext
TLCursor