Powered by Zoomin Software. For more details please contactZoomin

HERE Maps API for JavaScript - API Reference

Product category
Technology
Doc type
Version
Product lifecycle
This publication

HERE Maps API for JavaScript - API Reference: Class: ViewPort

Table of Contents

Class: ViewPort

H.map.ViewPort

new H.map.ViewPort (element, opt_options)

A viewport object holds information about the HTML element in which the map is rendered. It contains the information regarding the view port size and triggers events when the size changes.

Name Type Description
element HTMLElement

The HTML element where the map is to be rendered

opt_options H.map.ViewPort.Options optional

Optional configuration parameters

Extends

Implements

Members

center H.math.Point non-null

This property holds a value indicating the current center point of the viewport.

element HTMLElement non-null

This property holds the HTML element that defines the viewport.

height number

This property holds a value indicating the height of the viewport.

margin number

This property holds a value indicating the current margin of the viewport.

padding H.map.ViewPort.Padding non-null

This property holds a value indicating the current padding of the viewport.

width number

This property holds a value indicating the width of the viewport.

Methods

addEventListener (type, handler, opt_capture, opt_scope) inherited

This method adds a listener for a specific event.

Note that to prevent potential memory leaks, you must either call removeEventListener or dispose on the given object when you no longer need it.

addOnDisposeCallback (callback, opt_scope) inherited

This method adds a callback which is triggered when the EventTarget object is being disposed.

Name Type Description
callback function

The callback function.

opt_scope Object optional

An optional scope for the callback function

dispatchEvent (evt) inherited

This method dispatches an event on the EventTarget object.

Name Type Description
evt H.util.Event | string

An object representing the event or a string with the event name

dispose () inherited

This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

endInteraction (opt_preventKinetics)

This method ends an interaction and applies a kinetic movement if it was specified in a call to startInteraction()

Name Type Description
opt_preventKinetics boolean optional

A value indicating a kinetic movement at the end of the interaction is to be prevented (true or not false)

interaction (x, y, opt_bx, opt_by, opt_timestamp)

This method resolves direct screen (view port) interaction. This function modifies the current view according to values passed in by the caller.

removeEventListener (type, handler, opt_capture, opt_scope) inherited

This method removes a previously added listener from the EventTarget instance.

resize ()

This method updates the size of the viewport to match the container size. It must be called whenever the HTML element changes size in order to update the map's viewport values.

setMargin (margin)

This method sets the margin on the viewport.

Name Type Description
margin number

A value indicating the margin used to fetch map data

Fires:
  • H.map.ViewPort#event:marginchange

setPadding (top, right, bottom, left)

This method sets a value indicating the padding of the viewport. Padding results in a shifted map center which is the visual center of the padded area.

Fires:
  • H.map.ViewPort#event:paddingchange

startInteraction (modifiers, opt_kinetics)

This method starts the interaction with the view port. It should be called every time a new interaction is started, for example on mouse grab or touch start.

Name Type Description
modifiers H.math.BitMask.<!H.map.render.RenderEngine.InteractionModifiers>

Specifies what operations should performed during every interaction.

opt_kinetics H.util.kinetics.IKinetics optional

Specifies a kinetic move at the end of interaction

Type Definitions

H.map.ViewPort.Options Object

Viewport initialization options.

Properties:
Name Type Argument Description
margin number <optional>

The size in pixel of the supplemental area to render for each side of the map

padding H.map.ViewPort.Padding <optional>

The padding in pixels for each side of the map

H.map.ViewPort.Padding Object

This variable defines viewport padding.

Properties:

Events

sync

Event fired when the rendered map is synchronized with the properties of the viewport.

Type:

update

Event fired when the properties of the view-port, such as padding, margin or size, change.

Type:
Was this article helpful?
TitleResults for “How to create a CRG?”Also Available inAlert