Constructs a new ShapeTranslateHandle.
Protected
activeIndicates whether the handle is active.
Protected
endProtected
eventedThe EventedSupport used to emit events.
Typically, handles use emitEditShapeEvent to emit "EditShape" events. This is only used in advanced cases, for example when compositing multiple handles.
Protected
startCalled when handle goes from inactive to active state.
The event that triggered the activation
The edit context
Called when the handle leaves the active state.
The event that triggered the deactivation
The edit context
Protected
emitEmits an "EditShape"
event.
Typically, a handle emits this right after changing the shape.
The shape to emit an edit event for
The status of the edit. Typically, this is IN_PROGRESS while the handle is being dragged / changed, and EditShapeStatus.FINISHED when the drag ends.
Returns the cursor for this handle.
the "move"
cursor while the mouse interacts with the shape,
or the handle is active.
Checks if the handle interacts with the given gesture event.
The gesture event to check
The edit context
Populates a context menu with entries.
For example, a handle for a point in a polyline might add a "Delete point" context menu entry.
the input event that triggered opening the context menu.
the edit context
the context menu to add entries to.
a callback that needs to be called when a menu action is performed. Call this at the end of the ContextMenuItem.action implementation.
This method allows the handle to draw shapes on the map.
For example, a point handle draws an icon at its point using EditHandleStyles.handleIconStyle.
A handle can also draw "helper" shapes. These are shapes that are not interactive, but help the user while editing. For example, the base shape of an extruded shape, draped over terrain. Or lines showing how a point can move.
For consistency with built-in handles, it's recommended to draw helper shapes using EditHandleStyles.handleIconStyle.
The default implementation draws nothing.
The GeoCanvas to draw on.
The editing context.
This method allows the handle to draw labels on the map.
For example, you can use this to show coordinates of points, or the current radius of a circle on top of an edit handle.
The default implementation draws nothing.
The label canvas to draw labels on
The editing context.
Handles the given context.
The editing handle can modify the feature (or its shape) based on the type and state of the input event. For example, a drag event that moves a circle.
The default implementation ignores the event.
the gesture event.
the edit context.
Processes an event.
This is typically where you change a shape. For example move a point to where the mouse is dragged, like a PointDragHandle does.
The event to process
The edit context
Returns true
for DOWN events that interact with
the point handle.
Returns true
on DRAG_END or
CONTEXT_MENU events.
Returns true
for GestureEventType.DRAG events.
Called when the shape should be translated (moved).
The default implementation calls Shape.translate2D.
The gesture event that triggered the translation
The edit context
The X offset to apply (in the shape's reference)
The Y offset to apply (in the shape's reference)
Called when (another) handle changes the feature or shape, as indicated by the "EditShape" event.
This handle can update its own state, based on the changed shape.
For example, a PointListInsertHandle just inserted a point in a polyline. The PointListTranslateHandle uses the update to recalculate new sub-handles, based on the new polyline (with the extra point).
The default implementation does nothing.
An event that is emitted whenever this handle changes the shape of a feature.
EditShape
A handle used to translate (move) a Shape.
The user can move the shape by dragging its fill or stroke. This works for both mouse and touch events.
Typically, this is the type of handle that Editor.createTranslateHandle returns.
For PointTranslateHandle instead. PointTranslateHandle adds point snapping capabilities.
Since
2022.1