Maps API for JavaScript Developer's Guide

H.mapevents.Behavior

Class Summary

Extends: H.util.Disposable

This class encapsulates map behavior functionality. It uses map events and adds functionality such as panning and zooming to the map.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

disable (opt_features)

To disable the specified behavior feature(s) for the map.

enable (opt_features)

This method enables the specified behavior feature(s) for the map.

isEnabled (features) : {boolean}

This method checks if certain behavior feature(s) are enabled.

dispose ()

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.

Class Description

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.

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

Constructor Details

H.mapevents.Behavior(mapEvents, opt_options)

Parameters:
 
mapEvents:
{H.mapevents.MapEvents}
 
An object representing a previously initialized map events instance
opt_options:
{H.mapevents.Behavior.Options=} [optional]
 
An object defining additional options (kinetics)
Throws:
 
{H.lang.InvalidArgumentError}
 
if behavior is already instantiated with the specified mapEvents

Method Details

disable (opt_features)

To disable the specified behavior feature(s) for the map.

Parameters:
 
opt_features:
{(H.mapevents.Behavior.Feature | H.math.BitMask)=} [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).

enable (opt_features)

This method enables the specified behavior feature(s) for the map.

Parameters:
 
opt_features:
{(H.mapevents.Behavior.Feature | H.math.BitMask)=} [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.

Parameters:
 
features:
{(H.mapevents.Behavior.Feature | H.math.BitMask)}
 
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).
Returns:
 
{boolean}
true if the specified features are enabled, otherwise false
Throws:
 
{H.lang.InvalidArgumentError}
 
if features value is invalid

dispose ()

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.