Class: Behavior
- Last UpdatedMay 21, 2025
- 3 minute read
H.mapevents.Behavior
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#disable
and theenable
property in theH.mapevents.Behavior.Options
.Properties:
Methods
-
addOnDisposeCallback (callback, opt_scope) inherited
-
This method adds a callback which to be triggered when an object is disposed.
Name Type Description callback
function A callback function to add
opt_scope
Object optional An object representing the scope
-
To disable the specified behavior feature(s) for the map.
Name Type Description opt_features
H.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
Behavior
object is disposed of (this function is called) when the attachedH.mapevents.MapEvents
object is disposed of. -
disposeInternal () inherited
-
Performs appropriate cleanup.
-
This method enables the specified behavior feature(s) for the map.
Name Type Description opt_features
H.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 features
H.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 true
if the specified features are enabled, otherwisefalse
-
Type Definitions
-
This typedef defines configuration (initialization) properties for the
Behavior
class.Properties: