Change marker size in Google maps V3

后端 未结 2 621
感情败类
感情败类 2020-11-30 00:26

I am using this explanation of how to color a google maps marker by setting the icon using a MarkerImage, and the coloring works well. But I can\'t make the scaledSize argu

2条回答
  •  [愿得一人]
    2020-11-30 01:13

    The size arguments are in pixels. So, to double your example's marker size the fifth argument to the MarkerImage constructor would be:

    new google.maps.Size(42,68)
    

    I find it easiest to let the map API figure out the other arguments, unless I need something other than the bottom/center of the image as the anchor. In your case you could do:

    var pinIcon = new google.maps.MarkerImage(
        "http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|" + pinColor,
        null, /* size is determined at runtime */
        null, /* origin is 0,0 */
        null, /* anchor is bottom center of the scaled image */
        new google.maps.Size(42, 68)
    );
    

提交回复
热议问题