Skip to content

API Type UICanvasCommand

github-actions[bot] edited this page Dec 2, 2026 · 1 revision

Type Alias: UICanvasCommand

type UICanvasCommand = 
  | {
  op: "fillStyle" | "strokeStyle" | "font";
  value: string;
}
  | {
  op: "textAlign";
  value: UICanvasTextAlign;
}
  | {
  op: "textBaseline";
  value: UICanvasTextBaseline;
}
  | {
  op: "lineWidth" | "globalAlpha";
  value: number;
}
  | {
  op: "save" | "restore" | "beginPath" | "closePath" | "fill" | "stroke";
}
  | {
  op: "translate" | "scale" | "moveTo" | "lineTo";
  x: number;
  y: number;
}
  | {
  angle: number;
  op: "rotate";
}
  | {
  matrix: UIAffine;
  op: "setTransform";
}
  | {
  height: number;
  op: "clearRect" | "fillRect" | "strokeRect" | "rect";
  width: number;
  x: number;
  y: number;
}
  | {
  counterclockwise: boolean;
  endAngle: number;
  op: "arc";
  radius: number;
  startAngle: number;
  x: number;
  y: number;
}
  | {
  maxWidth: number | null;
  op: "fillText";
  text: string;
  x: number;
  y: number;
}
  | {
  height: number | null;
  image: string;
  op: "drawImage";
  width: number | null;
  x: number;
  y: number;
};

Defined in: src/engine/ui/draw/contract.ts:569

ADR 0667: one call a <canvas> element's 2D context recorded, replayed in order onto a Canvas2D-like context in the drawing's own pixels (UIDrawingPaint.width × height, origin top-left). Colours and fonts are CSS text; angles are radians; drawImage's image is a project texture (asset:images/…), drawn at the picture's size when width is null.

Clone this wiki locally