Transform Modes
An existing geometry can be modified with a variety of modes.
ModifyMode
User can move existing points, add intermediate points along lines, and remove points.
The following options can be provided in the modeConfig
object for ModifyMode:
lockRectangles
(optional):<boolean>
- If
true
, features withproperties.shape === 'Rectangle'
will preserve rectangular shape.
- If
Callbacks:
editContext
argument to the onEdit
callback contains the following properties:
-
positionIndexes
(Array): An array of numbers representing the indexes of the edited position within the feature'scoordinates
array -
position
(Array): An array containing the ground coordinates (i.e. [lng, lat]) of the edited position
ExtrudeMode
User can move edge. Click and drag from anywhere between 2 points in edge.
ScaleMode
User can scale a feature about its centroid by clicking and dragging (inward or outward) the selected geometry. This mode supports multiple selections.
RotateMode
User can rotate a feature about its centroid by clicking and dragging the selected geometry. This mode supports multiple selections.
TranslateMode
The user can move a feature by selecting one or more features and dragging anywhere within the screen.
Additionally, the user can initiate snapping by clicking and dragging the selected feature's vertex handles. If the vertex handle is close enough to another feature's vertex, the two features will snap together.
The following options can be provided in the modeConfig
object for TranslateMode:
screenSpace
(optional):<boolean>
- If
true
, the features will be translated without distortion in screen space.
- If
TransformMode
A single mode that provides translating, rotating, and scaling capabilities. Translation can be performed by clicking and dragging the selected feature itself. Rotating can be performed by clicking and dragging the top-most edit handle around a centroid pivot. Scaling can be performed by clicking and dragging one of the corner edit handles. Just like the individual modes, this mode supports multiple selections and feature snapping.