import type { AddNodeCommand } from '../../core/commands/graphCommands'; import type { GraphAsset } from '../../core/model/Asset'; import type { Box } from '../framing'; import type { EditorState } from '../state'; import type { NodeView } from './NodeView'; import type { PaletteEntry } from './paletteEntries'; import type { Point } from './transitions'; /** What the graph canvas lends the gestures that work inside it. */ export interface GraphCanvasHost { readonly state: EditorState; /** The asset on the canvas; empty when there is none. */ assetId(): string; asset(): GraphAsset | null; views(): ReadonlyMap; /** Views in stacking order, topmost first – a node drawn over another one wins the pointer. */ topDownViews(): Iterable; nodeUnder(global: Point): string | null; /** Each node as the rectangle it is actually drawn as. */ nodeBoxes(): Box[]; /** The graph point under a global pointer position. */ toGraph(global: Point): Point; /** Screen pixels per graph unit. */ zoom(): number; snapping(): boolean; /** What the palette offers for this graph. */ entries(): PaletteEntry[]; /** The command that adds a node from the palette at a graph point. */ newNode(entry: PaletteEntry, at: Point): AddNodeCommand; redraw(): void; }