api.clipboard
ClipboardApi
Cut / Copy / Paste: the clip, its parts, and pasting — what the clipboard layer does.
The Cut / Copy / Paste layer. The clip is self-contained (it outlives the map it came from and pastes into another) and shared with the user's own clipboard, so a plugin that copies here is copying for the user too.
Members
setClip
setClip(clip: Clip | null): void;
Put a clip on the clipboard (one from copy, or built elsewhere); null clears it.
copy
copy(source?: ClipSource): Clip | null;
Copy a source — the marked area when omitted (or, on an object layer, that layer's
selection, as Ctrl+C does) — with the parts ticked in parts(). Null when there is
nothing to copy.
capture
capture(source?: ClipSource, options?: { parts?: Partial<ClipParts>; }): Clip | null;
The clip copy would take, handed back instead of put on the clipboard — for a
plugin keeping clips of its own without disturbing the user's. parts overrides
parts() for this one capture. Null when there is nothing to take.
cut
cut(source?: ClipSource): Clip | null;
Copy, then remove the source's objects as one undo step (terrain and fog stay). Null when there was nothing.
paste
paste(tx: number, ty: number, options?: PasteOptionsSpec): PasteResult | null;
Stamp the clip with its top-left tile at (tx, ty), one undo step; the pasted area becomes the marked one. Null when there is no clip or no map.
Types
Declarations only this group names.
ClipSourcetype
type ClipSource = {
rect: Rect;
} | {
units?: number[];
sprites?: number[];
doodads?: number[];
locations?: number[];
};
What clipboard.copy / cut take: the marked area (or any tile rect), or objects by index.