MapMarker.withAnchor constructor

MapMarker.withAnchor(
  1. GeoCoordinates coordinates,
  2. MapImage image,
  3. Anchor2D anchor
)

Creates an instance of a marker at given coordinates, represented by specified image, with anchor point specifying how the image is positioned relative to the marker's coordinates.

The anchor is a way of specifying position offset relative to image's dimensions on the screen. For example, (0, 0) places the top-left corner of the image at the marker's coordinates. (1, 1) would place the bottom-right corner of the image at the marker's coordinates. (0.5, 0.5) which is the default value would center the image at the marker's coordinates. Values outside the 0..1 range are also allowed, for example (0.5, 2) would display the image centered horizontally with its bottom edge above the marker's coordinates at the distance in pixels that is equal to the height of the image.

  • coordinates The marker's geographical coordinates.

  • image The image to draw on the map.

  • anchor The anchor point for the marker image which specifies the position offset relative to the marker's coordinates.

Implementation

factory MapMarker.withAnchor(GeoCoordinates coordinates, MapImage image, Anchor2D anchor) => $prototype.withAnchor(coordinates, image, anchor);