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
- MapModifier ⏏
- new MapModifier(options)
- .positionFrom(position)
- .rotateTowardsFrom(position)
- .zoomBaseFrom(zoomBase)
- .zoomScaleFrom(zoomScale)
- .offsetFrom(offset)
- .getPosition() ⇒
LatLng
- .getRotateTowards() ⇒
LatLng
- .getZoomBase() ⇒
Number
- .getZoomScale() ⇒
Number
|function
- .getOffset() ⇒
LatLng
- MapModifier ⏏
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. |
Set the geographical position of the renderables.
Kind: instance method of MapModifier
Param | Type | Description |
---|---|---|
position | LatLng | function | Object |
Position in geographical coordinates. |
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. |
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 |
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. |
Set the displacement offset in geographical coordinates.
Kind: instance method of MapModifier
Param | Type | Description |
---|---|---|
offset | LatLng |
Displacement offset in geographical coordinates. |
Get the current geographical position.
Kind: instance method of MapModifier
Returns: LatLng
- Position in geographical coordinates.
Get the geographical position towards which the renderables are rotated.
Kind: instance method of MapModifier
Returns: LatLng
- Geographical position towards which renderables are rotated.
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
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
Get the geographical displacement offset.
Kind: instance method of MapModifier
Returns: LatLng
- Offset in geographical coordinates.