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

// Given some editor...

// Find all elements intersecting the rectangle with top left (0,0) and
// (width,height)=(100,100).
const elems = editor.image.getComponentsIntersecting(
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);

Hierarchy (View Summary)

Constructors

Properties

empty: (Anonymous class) = ...

Methods

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

    Parameters

    • commandTypeId: string
    • deserialize: DeserializationCallback

    Returns void

OpenSource licenses