Canvas plane
import { CanvasPlane } from "@arcadia/ui";Opening canvas…
CanvasPlane
canvasId- string | number
- The canvas's identity when the product reuses this plane for another canvas.
labelrequired- string
- Its name for assistive technology, in the product's words.
framesrequired- readonly CanvasFrameItem[]
sections- readonly CanvasSection[]
- Default:
[] marks- readonly CanvasMarkItem[]
- Each mark's body is
markToSvg's, from its box's corner. A mark that sits on a frame is drawn over it, moves with it and scrolls with its page; a mark on a removed frame, a mark on no frame and a bodymarkFromSvgrefuses are not drawn. pins- readonly CanvasPin[]
- The comments' pins. An element's pin stands at its element's top right corner, measured in a frame drawn from its source and at the box Crew keeps in one that shows its picture; a resolved pin draws nothing.
activePinId- string | null
- The pin whose thread is open: its element keeps its outline.
thread- CanvasPinnedThread | null
- The open pin's thread, in the kit's CommentThread, drawn beside that pin; the product owns its messages and its close.
peers- readonly CanvasPeer[]
- The people and agents on the canvas: a pointer with a name, a drag's outline, and an agent at work on a frame, an element or a comment thread.
frameSrc- string
- The address of the document that draws a frame, without a fragment.
loadSource- (frame: CanvasFrameItem) => Promise<string>
- A frame's source. The part asks only for frames it draws from source, and keeps each answer by its digest.
renderPage- (frame: CanvasFrameItem, interactive?: boolean) => ReactNode
onOpenPage- (frame: CanvasFrameItem) => boolean
loadFile- (name: string) => Promise<Blob>
- The bytes of a file a frame's files name. Successful reads are shared across the plane. A listed stylesheet is required and a rejected read is retried once. Images and fonts may be left out when unavailable or over the frame's bounds.
loadPicture- (frame: CanvasFrameItem) => Promise<Blob>
- The picture of a frame's page, as bytes. Only image/png, image/jpeg and image/webp are drawn; any other type is refused.
can- { readonly change?: boolean; readonly comment?: boolean }
- What this person may do: change the canvas, which moves, sizes and deletes frames and sections and draws lines on them, and comment on them. Default: neither, so a plane without it is read-only.
tools- readonly CanvasTool[]
- The tools the bar offers, in its order. Select is always there; Comment stands where this person may comment and the product takes a pick (
onPick), Draw where they may change the canvas and the product takes edits (onEdit), X-ray wherexrayis on, and Design mode wheredesignis on and the product takes the finish (onDesignFinish). A product that draws X-ray or Design mode itself names them here and leavesxrayanddesignunset; set to false, they stand nowhere. Default: Select, Comment and Draw, then X-ray and Design mode where the plane draws them. tool- "select" | "hand" | "comment" | "draw" | "xray" | "design"
- The plane's tools: the bar's choices, and the state a product keeps.
defaultTool- "select" | "hand" | "comment" | "draw" | "xray" | "design"
- Default:
"select" - The plane's tools: the bar's choices, and the state a product keeps.
onToolChange- (tool: CanvasTool) => void
selection- CanvasSelection
onSelectionChange- (selection: CanvasSelection) => void
view- CanvasView | "fit"
"fit": the plane shows the fit of its present room, and follows it as the room, the chrome or the frames change.defaultView- CanvasView | "fit"
- Where the view starts, the fit when not given.
"fit"is the view the fit button and the 0 key bring too: every frame and section in the room the plane's controls, its panel and its tray leave, a gap clear of them, with the titles' line above. The plane follows the fit until a gesture, a zoom key or the bar moves the view. onViewChange- (view: CanvasView, fit: boolean) => void
- The view as it changes, once the plane knows its size, with
fittrue while that view is the fit: a product that controlsviewkeeps following the fit by holding"fit"then. entered- number | null
- The frame the plane shows alone, with the view brought to it. Null: every frame in view.
defaultEntered- number | null
- Default:
null onEnteredChange- (frame: number | null) => void
device- "captured" | "desktop" | "tablet" | "phone"
- The width every page is drawn at. As captured: each page keeps the size it was captured at.
defaultDevice- "captured" | "desktop" | "tablet" | "phone"
- Default:
"captured" onDeviceChange- (device: CanvasDevice) => void
renderControls- (controls: CanvasPlaneControls) => ReactNode
renderToolbar- (toolbar: CanvasPlaneToolbar) => ReactNode
panel- { side: "left" | "right"; anchor: "top" | "bottom"; collapsed?: boolean }
- Where the side panel stands.
defaultPanel- { side: "left" | "right"; anchor: "top" | "bottom"; collapsed?: boolean }
- Default:
DEFAULT_PANEL onPanelChange- (place: CanvasPanelPlace) => void
panelBody- ReactNode
- The panel's body: a comment panel, Design mode's controls.
panelFill- boolean
- The panel's body fills it and scrolls on its own, as CanvasPanel's
fill: a thread's list with its field at its foot. dock- boolean
- Default:
false - The panel stands as the plane's dock: the tools alone, one row of icon buttons pinned at the bottom centre of the canvas with the panel's body above them, outside the canvas the view moves. No head, no fold and no sheet at any width. Default: the side panel, where the product keeps it.
liveFrame- number
- The frame a product draws itself, live, in the part's own place: the plane draws nothing in its box and keeps reporting it.
onLiveBoxes- (boxes: { readonly view: CanvasBox; readonly bar: CanvasBox } | null) => void
- While a frame is entered: the frame's box and the island's room, in CSS pixels of the part's own root, whole numbers.
onEdit- (edits: readonly CanvasEdit[]) => void
- What the person changed, when a gesture ends. The part shows it at once and holds it until frames or sections say the same.
onRenameFrame- (id: string, title: string) => void
- With can.change, saves a frame name. The ID is the frame number as text; pass the new title back in frames.
onDuplicate- (ids: readonly string[], offset: CanvasPoint) => void
onMotion- (motion: { readonly pointer?: { readonly x: number; readonly y: number }; readonly drag?: CanvasPeer["drag"] }) => void
- What moves and is not yet a change, for the others who have the canvas open.
onPick- (pick: CanvasPick) => void
- With the comment tool, for a person who may comment, the person asks to comment on what the tool holds: a press on an element of a frame drawn from its source, the end of a box dragged over one, words selected in an element after a double press, or Enter. A box on a frame drawn from its picture, or one that begins on the board and covers one frame whole, gives that frame with no elements. It opens nothing by itself.
onPickChange- (pick: CanvasPick | null) => void
- Every change of what the comment tool holds, by the pointer or by the keys, and null once it holds nothing.
onPinOpen- (id: string) => void
onPaste- (paste: CanvasPaste) => void
onFrameOpen- (frame: number) => void
- A frame was entered.
xray- boolean
- X-ray, drawn by the plane: over the frame under the pointer, the boxes, spacings and text lines of the element there, its parent and children, and the guides and readout of the one pressed; a drag across a frame surveys every element in its area until Escape or the next press. It reads the frame's survey: the frame's own answer while it is drawn from its source, else
xraySurvey's. Default: off. xraySurvey- (frame: CanvasFrameItem) => CanvasSurvey | null | undefined
- A frame's survey where the plane cannot ask the frame: one drawn from its picture or its title. Its boxes are in the page's pixels at the frame's viewport.
element- CanvasDesignAnchor | null
- The element X-ray and Design mode hold: the one last pressed, or stepped to by the arrows in an entered frame. It is held in one version of its frame, and a new version lets it go.
defaultElement- CanvasDesignAnchor | null
- Default:
null onElementChange- (element: CanvasDesignAnchor | null) => void
design- boolean
- Design mode, drawn by the plane: the element is held as in X-ray, and the panel shows its layout, spacing, type, surface and words, read from the survey where it has them, with the edits counted under them. Default: off.
designEdits- CanvasDesignSession
- Design mode's edits, where the product keeps them: the part stores none when the prop is given.
onDesignEdit- (edits: CanvasDesignSession) => void
- Every change of the edits: a value, an undo or a redo, a discard, a finish that cleared them, and a new version or the removal of a frame, which drops the edits and the values read of that frame.
onDesignPreview- (entries: readonly CanvasDesignPreview[]) => void
- The edits in force after every change. The plane already sends each frame drawn from its source the entries of its own elements, and the frame's document shows them, so a product only reads these.
onDesignFinish- (edits: CanvasDesignSession) => unknown
- Finish: the edits handed over. A promise holds Finish busy until it settles: fulfilled, the edits are cleared and the bar says they were applied; refused, they stay. Anything else clears them at once.
onDesignDiscard- () => void
- Discard: every pending edit dropped, and its steps with it.
designStatus- CanvasDesignStatus
- How the finish stands, where the product says so: it wins over the plane's own reading of the promise.
designProblem- string
- Why a finish failed, in the product's words.
rootStyle- CanvasPlaneStyle
ref- ReactRef<CanvasPlaneHandle>
- The comment tool's two steps and its letting go, for a composer's Select parent, Select children and Escape.