ImageDelegate
An object you use to specify image URLs.
Declaration
interface ImageDelegateOverview
In addition to using a dictionary object that defines image URLs for ImageAnnotation or MarkerAnnotation, you can specify an image delegate that allows you to return a URL dynamically or asynchronously.
getImageUrl(scale, callback)MapKit JS calls this method with a pixel ratio value that your function uses to construct a URL to an appropriately scaled image, and returns it as the first argument of the callback, as in the following example:
const imageDelegate = {
getImageUrl(scale, callback) {
callback(`https://example.com/images/marker?scale=${scale}`);
}
};
const annotation = new mapkit.MarkerAnnotation(
new mapkit.Coordinate(10, 10),
{
glyphImage: imageDelegate
}
);