new FeatureDragNDropHandler(map)
Parameters:
| Name | Type | Description |
|---|---|---|
map |
Map | The Mapbox GL JS map to add the handler to. |
Methods
-
private _fireEvent(type, e) → {Map}
-
Fire the event on the map.
The event is wrapped in a object providing the following fields:
originalEventthe browser eventstartPointthe point where the drag startspointthe current pointfeaturethe feature on which the drag startshandlerthis handler instance
Parameters:
Name Type Description typestring event type
eEvent browser event
Returns:
Map -the map instance
-
private _ignoreEvent(e) → {boolean}
-
Tells if the event is processed by this handler or not.
Parameters:
Name Type Description eEvent any browser event but probably on MouseEvent or TouchEvent.
Returns:
boolean -trueis event ignored -
private _onDown(e)
-
Triggered when a mouse button is pressed on the canvas.
Parameters:
Name Type Description eMouseEvent | TouchEvent mouse or touch browser event
-
private _onMouseUp(e)
-
Triggered when a mouse button is released or the mouse leave the window.
Parameters:
Name Type Description eMouseEvent | FocusEvent mouse browser event
-
private _onMove(e)
-
Triggered when the mouse move on the document.
Parameters:
Name Type Description eMouseEvent | TouchEvent mouse or touch browser event
-
private _onTouchEnd(e)
-
Triggered when the touch event ends.
Parameters:
Name Type Description eFocusEvent touch browser event
-
private _onUp(e)
-
Triggered when a mouse button is released or the touch event ends.
Parameters:
Name Type Description eMouseEvent | TouchEvent | FocusEvent mouse or touch browser event
-
_pointToArray(point) → {Array}
-
Convert a local
Pointinstance into a[x, y]Array.Parameters:
Name Type Description pointPoint local
PointinstanceReturns:
Array -
disable()
-
Disables this handler
-
enable()
-
Enables this handler
-
featureNotDraggable()
-
Call by external code when a
feature-is-draggableevent is triggered and the feature should not be draggable -
getFeature() → {Object}
-
Returns the feature on which the drag starts.
Returns:
Object -the feature on which the drag starts.
-
isActive() → {boolean}
-
Returns a boolean indicating whether this handler is in a dragging state or not.
Returns:
boolean -trueif dragging. -
isEnabled() → {boolean}
-
Returns a boolean indicating whether this handler is enabled or not.
Returns:
boolean -trueif the drag and drop enabled.