Table of contents

Extends 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
readonly id: Id

meta

User-defined metadata for the camera

meta: JsonObject

typeName

readonly
readonly typeName: TypeName

x

Camera x position. Negative values move the viewport right

x: number

y

Camera y position. Negative values move the viewport down

y: number

z

Zoom level. 1 = 100%, 0.5 = 50% zoom, 2 = 200% zoom

z: number

Prev
TLBookmarkShapeProps
Next
TLCursor