Mutating shapes
To mutate an array of shapes, you can simply call editor.actions.update()
as below:
In the most cases, you can mutate shapes just using editor.actions.update()
. If not, you have to understand Action and Transaction.
Action
Action is a collection of transactions, which can be undone/redone as a whole. All functions in editor.actions
are actions.
You can create an action with one or more transaction as below:
Transaction
Transation is an operation consists of a set of mutations. A transaction provides a set of atomic mutations. You need to combine them to make the desired changes on shapes. A transaction is immediately applied and can be visually confirmed in the editor.
If making changes using only atomic mutations is too cumbersome, you can use macro
functions. These provide utility functions that allow you to easily handle the desired changes with multiple mutations.