scmJS docs

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

clip

clip(): Clip | null;

What is on the clipboard, or null.

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.

parts

parts(): ClipParts;

setParts

setParts(patch: Partial<ClipParts>): void;

mode

mode(): PasteMode;

setMode

setMode(mode: PasteMode): void;

pasting

pasting(): boolean;

Whether the clipboard layer is armed: the next click on the map pastes.

setPasting

setPasting(on: boolean): void;

Arm pasting (switches to the clipboard layer) or stop.

summary

summary(clip: Clip): string;

One line for a clip: 12 × 8 tiles · 3 units · 2 doodads.

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.

Seen in

scmJS 0.7.3 + main@e2d8ba5 · Generated from the repository. The source is under the MIT license, which does not cover what ATTRIBUTION.md lists. StarCraft and Brood War are trademarks of Blizzard Entertainment; this project ships none of their data.