In map development, we need to change the labels to a variety of images to highlight the personality.
Under high-resolution phones, the picture size needs to be compressed to half to keep the picture clear. Let's take a look at how it should be done.
In order to change the size of the picture, a developer directly wrote
ImageSize: (64, 64)
Or
ImageSize: "64px 64px"
Is there a problem?
First look at the ImageSize class reference and see the type is size.
size is the type of the German API customization , not Num. Therefore, it is wrong to write the numbers directly.
Then the correct wording should be:
New Amap.size (64,64)
On high-resolution displays, you should compress the dimensions in half. Compared to the film size is 128*128, then imagesize need to compress the picture half, should be 64*64. The code is as follows:
// add point markers and use your own icon New Amap.marker ({ map:map, position: [116.47395,39.986058], new Amap.icon ({ "marker128.png", new amap.size (+), // icon size New Amap.size (64,64)}) ;
Demo Address: http://zhaoziang.com/amap/imageSize.htm
All sample code:
<!doctype html>//Initialize map object, load Map varMap =NewAmap.map ("Container", {resizeenable:true, Zoom:11 }); //add point markers and use your own icon NewAmap.marker ({map:map, Position: [116.47395,39.986058], Icon:NewAmap.icon ({image:"Marker128.png", Size:NewAmap.size (128, 128),//icon SizeImageSize:NewAmap.size (64,64) }) }); //add point markers and use your own icon NewAmap.marker ({map:map, Position: [116.321514,39.91289], Icon:NewAmap.icon ({image:"Marker128.png", Size:NewAmap.size (128, 128),//icon SizeImageSize:NewAmap.size (128,128) }) });</script></body>How does the "Gold Map API" Set the icon's imagesize?