On occasion, you want to cancel all your changes while you are creating a shape or editing a shape in LuciadRIA. In either case, you don’t want to update the data underlying the shapes.

While editing a shape, you want to discard all your current changes and revert back to the initial shape. The same goes for creation. If you’re not happy with the shape you’re drawing, you want to abort the creation process.

Besides discarding all changes, users can also undo/redo a few steps. Check out Adding undo/redo support to your application.

You can stop the interaction without saving changes, simply by deactivating the controller:

map.controller = null; // or swap to a different controller

You can restart the interaction by calling the restart() method on EditController and CreateController.

Restart editing, by use of a UI button

editRestart

In LuciadRIA samples, pressing the Escape key while editing or creating a shape, restarts the interaction. If you were already at the start, it will deactivate the controller.

For more information, see the reference documentation of EditController.restart() and CreateController.restart().