Browse Source

[完善]修改图标大小

master
邵佳豪 4 years ago
parent
commit
4f9f965c63
  1. 16
      src/app/ui/water-road/water-road.component.ts

16
src/app/ui/water-road/water-road.component.ts

@ -35,7 +35,7 @@ export class WaterRoadComponent implements OnInit {
creatMap(){
var satellite = new AMap.TileLayer.Satellite();
var roadNet = new AMap.TileLayer.RoadNet();
// 创建一个 icon
var startIcon = new AMap.Icon({
image: '../../../assets/images/fireHydrant.png',
@ -73,18 +73,22 @@ export class WaterRoadComponent implements OnInit {
Arr.push(viaMarker)
})
var marker = new AMap.Marker({
icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
// size: new AMap.Size(20, 20),
var markerIcon = new AMap.Icon({
image:"//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png",
size: new AMap.Size(52, 52), //图标大小
imageSize: new AMap.Size(26,36)
})
let marker1 = new AMap.Marker({
icon: markerIcon,
position: [108.377865, 22.763499],
offset: new AMap.Pixel(-25, -25)
offset: new AMap.Pixel(-4, -50)
});
this.map = new AMap.Map('map',{
center: [108.377865, 22.763499], //初始地图中心点
zoom: 16
});
marker.setMap(this.map);
marker1.setMap(this.map);
this.map.on('click', (e) => {
console.log(e.lnglat.getLng() + ',' + e.lnglat.getLat())
});

Loading…
Cancel
Save