switch(type) {
case MAPS_VIEW_OBJECT_MARKER:
{
- // TODO: distinguish between MAPS_VIEW_MARKER_PIN and MAPS_VIEW_MARKER_STICKER (pin vs billboard?)
// TODO: use image passed with the view object, not available in tangram yet!
+ maps_view_marker_type_e markerType;
+ error = maps_view_object_marker_get_type(object, &markerType);
+ if (error != MAPS_ERROR_NONE || markerType < MAPS_VIEW_MARKER_PIN || markerType > MAPS_VIEW_MARKER_STICKER) { break; }
+
maps_coordinates_h mapsCoord = nullptr;
double lat = 0.0, lng = 0.0;
int markerWidth = 0, markerHeight = 0;
- const char* styleFormat = "{ style: 'ux-icons-overlay', sprite: 'ux-search-active', size: [%dpx, %dpx], collide: false, anchor: top, transition: { [show, hide]: { time: 0s } } }";
+ const char* styleFormat = "{ style: 'ux-icons-overlay', sprite: 'ux-search-active', size: [%dpx, %dpx], collide: false, anchor: %s, transition: { [show, hide]: { time: 0s } } }";
+ static std::string anchor;
+
+ anchor = "center";
+ if (markerType == MAPS_VIEW_MARKER_PIN) {
+ anchor = "top";
+ }
error = maps_view_object_marker_get_size(object, &markerWidth, &markerHeight);
if (error != MAPS_ERROR_NONE) { break; }
- int sz = std::snprintf(nullptr, 0, styleFormat, markerWidth, markerHeight);
+ int sz = std::snprintf(nullptr, 0, styleFormat, markerWidth, markerHeight, anchor.c_str());
styleString.resize(sz+1);
- std::snprintf(&styleString[0], styleString.size(), styleFormat, markerWidth, markerHeight);
+ std::snprintf(&styleString[0], styleString.size(), styleFormat, markerWidth, markerHeight, anchor.c_str());
m_map->markerSetStyling(tvMarker, styleString.c_str());