10up / maps-block-apple

An Apple Maps block for the WordPress block editor (Gutenberg).

Home Page:https://wordpress.org/plugins/maps-block-apple

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support custom marker icon

dinhtungdu opened this issue · comments

Is your enhancement related to a problem? Please describe.

MapKit support custom glyph image for marker annotation, our block should support that feature as well.

Original wp.org report: https://wordpress.org/support/topic/how-change-marker-icon/

For context this is the documentation from Apple about the custom glyph support: https://developer.apple.com/documentation/mapkitjs/mapkit/markerannotation

const portland = new mapkit.Coordinate(45.5231, -122.6765);
const customMarker = new MarkerAnnotation(portland, {
    color: "green",
    glyphColor: "brown",
    glyphImage: { 1: "glyphImage.png" },
    selectedGlyphImage: { 1: "detailedIcon.png", 2: "detailedIcon_2x.png", 3: "detailedIcon_3x.png" }
});

And this is where we define the markers in the AppleMap class:

https://github.com/10up/maps-block-apple/blob/develop/src/components/AppleMap.js#L108-L118