This class encapsulates map behavior functionality. It uses map events and adds functionality such as panning and zooming to the map.
By default the behavior will use H.util.animation.ease.EASE_OUT_QUAD animation with
600ms duration during interactions with the map.
This can be modified by specifying options.
| Name | Type | Description |
|---|---|---|
mapEvents |
H.mapevents.MapEvents |
An object representing a previously initialized map events instance |
options |
H.mapevents.Behavior.Options |
optional
An object defining additional options (kinetics) |
Throws:
-
if behavior is already instantiated with the specified
mapEvents
Example
// Add map events functionality to the map
var mapEvents = new H.mapevents.MapEvents(mapInstance);
// Add behavior to the map: panning, zooming, dragging.
var behavior = new H.mapevents.Behavior(mapEvents);
Extends
Members
-
The feature types that can be enabled or disabled. See also
H.mapevents.Behavior#enable,H.mapevents.Behavior#disableand theenableproperty in theH.mapevents.Behavior.Options.Properties:
Name Description PANNINGPan the map in response to user dragging via pointer device or touch
PINCH_ZOOMZoom the map in or out in response to pinch gestures
WHEEL_ZOOMZoom the map in or out in response to wheel events
DBL_TAP_ZOOMZoom the map in or out in response to double click or double tap
FRACTIONAL_ZOOMthe map zooming can end up to a fractional level
TILTThe tilt angle changes in response to active modifier key and vertical user dragging via pointer device or touch
HEADINGThe heading angle changes in response to active modifier key and horizontal user dragging via pointer device or touch
Methods
-
addOnDisposeCallback (callback, opt_scope) inherited
-
This method adds a callback which to be triggered when an object is disposed.
Name Type Description callbackfunction A callback function to add
opt_scopeObject optional An object representing the scope
-
To disable the specified behavior feature(s) for the map.
Name Type Description opt_featuresH.math.BitMask.<!H.mapevents.Behavior.Feature> optional The feature(s) to disable. If omitted all behavior features are disabled. To disable multiple features combine them with bitwise OR operator
|(e.g.H.mapevents.Behavior.Feature.PANNING | H.mapevents.Behavior.Feature.HEADING). -
To discontinue the handling of all map interaction. It should be used when the behavior functionality is disposed of. The
Behaviorobject is disposed of (this function is called) when the attachedH.mapevents.MapEventsobject is disposed of. -
disposeInternal () inherited
-
Performs appropriate cleanup.
-
This method enables the specified behavior feature(s) for the map.
Name Type Description opt_featuresH.math.BitMask.<!H.mapevents.Behavior.Feature> optional The feature(s) to enable. If omitted all behavior features are enabled. To enable multiple features combine them with bitwise OR operator
|(e.g.H.mapevents.Behavior.Feature.PANNING | H.mapevents.Behavior.Feature.HEADING). -
This method checks if certain behavior feature(s) are enabled.
Name Type Description featuresH.math.BitMask.<!H.mapevents.Behavior.Feature> The feature(s) to check. To check against multiple features combine them with bitwise OR operator
|(e.g.H.mapevents.Behavior.Feature.PANNING | H.mapevents.Behavior.Feature.HEADING).Throws:
-
if features value is invalid
Returns:
Type Description boolean trueif the specified features are enabled, otherwisefalse -
Type Definitions
-
This typedef defines configuration (initialization) properties for the
Behaviorclass.Properties:
Name Type Argument Description kineticsH.util.kinetics.IKinetics <optional>
The parameters for the kinetic movement.
modifierKeystring <optional>
The name of the modifier key to activate alternative behaviour feature (like heading or tilt operation). (e.g.
"Alt","Shift","Meta","Control"). If omitted the"Alt"key is used.enabledH.math.BitMask.<H.mapevents.Behavior.Feature> <optional>
The behavior feature(s) to enable. If omitted, all features are enabled. See
H.mapevents.Behavior.Featurefor more details about the supported features. To enable multiple features combine them with bitwise OR operator|(e.g.H.mapevents.Behavior.Feature.PANNING | H.mapevents.Behavior.Feature.HEADING).