TLCameraId

See source code

Branded string type for camera record identifiers. Prevents mixing camera IDs with other types of record IDs at compile time.

type TLCameraId = RecordId<TLCamera>

Example

import { CameraRecordType } from '@tldraw/tlschema'

// Create a camera ID (typically one per user/session)
const cameraId: TLCameraId = CameraRecordType.createId()

// Use in camera records
const camera: TLCamera = {
  id: cameraId,
  typeName: 'camera',
  x: 0,
  y: 0,
  z: 1,
  meta: {},
}

// Get camera from store
const currentCamera = store.get(cameraId)
Prev
TLBookmarkShape
Next
TLCanvasUiColor