Class: Behavior

H.mapevents.Behavior

new H.mapevents.Behavior (mapEvents, options)

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

Type
H.lang.InvalidArgumentError
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

H.mapevents.Behavior.Feature static

The feature types that can be enabled or disabled. See also H.mapevents.Behavior#enable, H.mapevents.Behavior#disable and the enable property in the H.mapevents.Behavior.Options.

Properties:
Name Description
PANNING

Pan the map in response to user dragging via pointer device or touch

PINCH_ZOOM

Zoom the map in or out in response to pinch gestures

WHEEL_ZOOM

Zoom the map in or out in response to wheel events

DBL_TAP_ZOOM

Zoom the map in or out in response to double click or double tap

FRACTIONAL_ZOOM

the map zooming can end up to a fractional level

TILT

The tilt angle changes in response to active modifier key and vertical user dragging via pointer device or touch

HEADING

The 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
callback function

A callback function to add

opt_scope Object optional

An object representing the scope

disable (opt_features)

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).

dispose () inherited overrides

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 attached H.mapevents.MapEvents object is disposed of.

disposeInternal () inherited

Performs appropriate cleanup.

enable (opt_features)

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).

isEnabled (features)boolean

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

Type
H.lang.InvalidArgumentError
Returns:
Type Description
boolean true if the specified features are enabled, otherwise false

Type Definitions

H.mapevents.Behavior.Options Object

This typedef defines configuration (initialization) properties for the Behavior class.

Properties:
Name Type Argument Description
kinetics H.util.kinetics.IKinetics <optional>

The parameters for the kinetic movement.

modifierKey string <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.

enabled H.math.BitMask.<H.mapevents.Behavior.Feature> <optional>

The behavior feature(s) to enable. If omitted, all features are enabled. See H.mapevents.Behavior.Feature for 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).