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 (via the mouse wheel) to the map.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

static DRAGGING : {number}

This property indicates if the map responds to user dragging via mouse or touch.

static WHEELZOOM : {number}

This property indicates if the map zooms in or out in response to mouse wheel events.

static DBLTAPZOOM : {number}

This property indicates if the map zooms in or out in response to double click or double tap. For double tap, multiple touches on the screen cause the map to zoom out.

Method Summary

Table 2. Methods
Methods

dispose ()

This method destroys 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.

disable (opt_behavior)

This method disables the behavior functionality for the map.

enable (opt_behavior)

This method re-enables the behavior functionality for the map.

isEnabled (behavior) : {boolean}

This method checks if certain behavior functionality is enabled.

Class Description

This class encapsulates map behavior functionality. It uses map events and adds functionality such as panning and zooming (via the mouse wheel) to the map.

By default 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

Property Details

static DRAGGING: {number}

This property indicates if the map responds to user dragging via mouse or touch.

static WHEELZOOM: {number}

This property indicates if the map zooms in or out in response to mouse wheel events.

static DBLTAPZOOM: {number}

This property indicates if the map zooms in or out in response to double click or double tap. For double tap, multiple touches on the screen cause the map to zoom out.

Method Details

dispose ()

This method destroys 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.

disable (opt_behavior)

This method disables the behavior functionality for the map.

Parameters:
 
opt_behavior:
{number=} [optional]
 
A bitmask indicating behaviors to disable. If no bits are set in the bitmask, all behaviors will be disabled.

enable (opt_behavior)

This method re-enables the behavior functionality for the map.

Parameters:
 
opt_behavior:
{number=} [optional]
 
The bitmask of behaviors to enable. If no bits are set in the bitmask, all behaviors will be enabled.

isEnabled (behavior) : {boolean}

This method checks if certain behavior functionality is enabled.

Parameters:
 
behavior:
{number}
 
A value indicating the functionality to check, for example H.mapevents.Behavior.DRAGGING
Returns:
 
{boolean}
true if the specified behavior is enabled, otherwise false