A command that duplicates the AbstractComponents it's given. This command is the reverse of an Erase command.

Example

// Given some editor...

// Find all elements intersecting the rectangle with top left (0,0) and
// (width,height)=(100,100).
const elems = editor.image.getElementsIntersectingRegion(
new Rect2(0, 0, 100, 100)
);

// Create a command that, when applied, will duplicate the elements.
const duplicateElems = new Duplicate(elems);

// Apply the command (and make it undoable)
editor.dispatch(duplicateElems);

See

Editor.dispatch EditorImage.getElementsIntersectingRegion

Hierarchy (view full)

Constructors

Properties

empty: __class = ...

Methods

  • Convert this command to an object that can be passed to JSON.stringify.

    Do not rely on the stability of the optupt of this function — it can change form without a major version increase.

    Returns Record<string | symbol, any>

  • Register a deserialization callback. This must be called at least once for every subclass of SerializableCommand.

    Parameters

    • commandTypeId: string
    • deserialize: DeserializationCallback

    Returns void

Generated using TypeDoc

OpenSource licenses