MapImageOverlay.withAnchor constructor

MapImageOverlay.withAnchor(
  1. Point2D viewCoordinates,
  2. MapImage image,
  3. Anchor2D anchor
)

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

The anchor is a way of specifying position offset relative to image's dimensions on the view. For example, (0, 0) places the top-left corner of the image at the overlay's view coordinates. (1, 1) would place the bottom-right corner of the image at the overlay's view coordinates. (0.5, 0.5) which is the default value would center the image at the overlay's view 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 overlay's view coordinates at the distance in pixels that is equal to the height of the image.

  • viewCoordinates The overlay's view coordinates in pixels.

  • image The image to draw on the map.

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

Implementation

factory MapImageOverlay.withAnchor(Point2D viewCoordinates, MapImage image, Anchor2D anchor) => $prototype.withAnchor(viewCoordinates, image, anchor);