CameraRecordType

See source code

Record type definition for TLCamera with validation and default properties. Configures cameras as session-scoped records that don't persist across sessions.

CameraRecordType: import("@tldraw/store").RecordType<TLCamera, never>;

Example

// Create a new camera record with defaults
const cameraRecord = CameraRecordType.create({
  id: "camera:main",
  // x: 0, y: 0, z: 1, meta: {} are applied as defaults
});

// Create with custom position and zoom
const customCamera = CameraRecordType.create({
  id: "camera:user1",
  x: -100,
  y: -50,
  z: 1.5,
  meta: { userId: "user123" },
});

// Store the camera
store.put([cameraRecord]);
Prev
boxModelValidator
Next
canvasUiColorTypeValidator