Skip to content
This repository has been archived by the owner on Nov 16, 2018. It is now read-only.

Latest commit

 

History

History
125 lines (100 loc) · 6.63 KB

MapModifier.md

File metadata and controls

125 lines (100 loc) · 6.63 KB

MapModifier

The MapModifier makes it possible to link renderables to a geopgraphical position on a MapView. Additionally it adds functionality for rotating and zooming renderables, and possibly all kinds of future map-related transformations. Use MapStateModifier if you want to use transitions, e.g. to animate a move from one geographical position to another.

MapModifier ⏏

Kind: Exported class

new MapModifier(options)

Param Type Description
options Object Options.
options.mapView MapView The MapView.
[options.position] LatLng Initial geographical coordinates.
[options.offset] LatLng Displacement offset in geographical coordinates from the position.
[options.rotateTowards] LatLng | object | function Position to rotate the renderables towards.
[options.zoomBase] number Base zoom-level at which the renderables are displayed in their true size.
[options.zoomScale] number | function Customer zoom-scaling factor or function.

mapModifier.positionFrom(position)

Set the geographical position of the renderables.

Kind: instance method of MapModifier

Param Type Description
position LatLng | function | Object Position in geographical coordinates.

mapModifier.rotateTowardsFrom(position)

Set the geographical position to rotate the renderables towards. The child renderables are assumed to be rotated to the right by default. To change the base rotation, add a rotation-transform to the renderable, like this: new Modifier({transform: Transform.rotateZ(Math.PI/2)})

Kind: instance method of MapModifier

Param Type Description
position LatLng Geographical position to rotate towards.

mapModifier.zoomBaseFrom(zoomBase)

Set the base zoom-level. When set, auto-zooming is effectively enabled. The renderables are then displayed in their true size when the map zoom-level equals zoomBase.

Kind: instance method of MapModifier

Param Type Description
zoomBase Number Map zoom-level

mapModifier.zoomScaleFrom(zoomScale)

Set the zoom-scale (ignored when zoomBase is not set). When set, the scale is increased when zooming in and decreased when zooming-out. The zoomScale can be either a Number or a Function which returns a scale-factor, with the following signature: function (zoomBase, zoomCurrent).

Kind: instance method of MapModifier

Param Type Description
zoomScale Number | function Zoom-scale factor or function.

mapModifier.offsetFrom(offset)

Set the displacement offset in geographical coordinates.

Kind: instance method of MapModifier

Param Type Description
offset LatLng Displacement offset in geographical coordinates.

mapModifier.getPosition() ⇒ LatLng

Get the current geographical position.

Kind: instance method of MapModifier
Returns: LatLng - Position in geographical coordinates.

mapModifier.getRotateTowards() ⇒ LatLng

Get the geographical position towards which the renderables are rotated.

Kind: instance method of MapModifier
Returns: LatLng - Geographical position towards which renderables are rotated.

mapModifier.getZoomBase() ⇒ Number

Get the base zoom-level. The zoomBase indicates the zoom-level at which renderables are displayed in their true size.

Kind: instance method of MapModifier
Returns: Number - Base zoom level

mapModifier.getZoomScale() ⇒ Number | function

Get the base zoom-scale. The zoomScale can be either a Number or a Function which returns a scale-factor.

Kind: instance method of MapModifier
Returns: Number | function - Zoom-scale

mapModifier.getOffset() ⇒ LatLng

Get the geographical displacement offset.

Kind: instance method of MapModifier
Returns: LatLng - Offset in geographical coordinates.