error = maps_view_object_marker_get_size(object, &markerWidth, &markerHeight);
if (error != MAPS_ERROR_NONE) { break; }
- if (markerWidth == 0 || markerHeight == 0) {
+ /*
+ * - Sets the marker dimension to be image dimension if both the specified marker dimensions are zero
+ * - Sets the marker dimension such that aspect ratio is maintained when one of the marker dimensions is
+ * zero
+ */
+ if (markerWidth == 0 && markerHeight == 0) {
markerWidth = imgWidth;
markerHeight = imgHeight;
+ } else if (markerWidth == 0 && markerHeight > 0) {
+ markerWidth = (float)markerHeight * (float)imgWidth / (float)imgHeight;
+ } else if (markerWidth > 0 && markerHeight == 0) {
+ markerHeight = (float)markerWidth * (float)imgHeight / (float)imgWidth;
}
float scaledWidth = scaleFactor * markerWidth;