<!--
{
  "availability" : [
    "MapKit JS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MapKitJS",
  "identifier" : "/documentation/MapKitJS/AnnotationCalloutDelegate/calloutAnchorOffsetForAnnotation",
  "metadataVersion" : "0.1.0",
  "role" : "Interface Method",
  "symbol" : {
    "kind" : "Interface Method",
    "modules" : [
      "MapKit JS"
    ],
    "preciseIdentifier" : "structm/mapkit.AnnotationCalloutDelegate/calloutAnchorOffsetForAnnotation"
  },
  "title" : "calloutAnchorOffsetForAnnotation(annotation, size)"
}
-->

# calloutAnchorOffsetForAnnotation(annotation, size)

Returns a point determining the callout’s anchor offset.

```
calloutAnchorOffsetForAnnotation?(
    annotation: Annotation,
    size: Size,
): DOMPoint;
```

## Parameters

`annotation`

The annotation for the callout.

`size`

The width and height of the callout element, which MapKit JS determines.

## Return Value

The method returns a `DOMPoint` that you set as the callout’s `anchorOffset` property.

## Discussion

MapKit JS calls this method after [`calloutElementForAnnotation(annotation)`](/documentation/MapKitJS/AnnotationCalloutDelegate/calloutElementForAnnotation) on the annotation’s callout delegate with `annotation` and `size` as parameters. The `size` parameter represents the size of the callout element, which MapKit JS determines. It’s an object with two number properties, `width` and `height`, and you can use them to compute the anchor offset.

Two offset values affect the position of the callout element:

- The [`calloutOffset`](/documentation/MapKitJS/Annotation/calloutOffset) property of the annotation, which is the offset of the callout element relative to the annotation element.
- The anchor offset, which is the offset of the callout relative to the annotation’s [`calloutOffset`](/documentation/MapKitJS/Annotation/calloutOffset).

The default value for the callout’s `anchorOffset` is `(0, 0)`, which means that the bottom center of the callout coincides with the callout offset of the selected annotation.

To choose a different offset, provide a `DOMPoint` where positive x-values move the element to the left, and positive y-values move the element up.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)