Cordova 谷歌地图原生离子2标记像素化
当我放置一个带有大图标的标记时,我无法调整它的大小,当我放置一个小图像时,它会被像素化Cordova 谷歌地图原生离子2标记像素化,cordova,google-maps,ionic2,Cordova,Google Maps,Ionic2,当我放置一个带有大图标的标记时,我无法调整它的大小,当我放置一个小图像时,它会被像素化 let icon = 'www/assets/images/car3.png'; let position: GoogleMapsLatLng = new GoogleMapsLatLng(0,0); let markerOptions: GoogleMapsMarkerOptions = { position: position, icon:icon
let icon = 'www/assets/images/car3.png';
let position: GoogleMapsLatLng = new GoogleMapsLatLng(0,0);
let markerOptions: GoogleMapsMarkerOptions = {
position: position,
icon:icon
};
您可以为标记器提供选项
let marker;
//example
let icon = {
size: new google.maps.Size(46, 70),
origin: new google.maps.Point(0, 0),
anchor: new google.maps.Point(22, 70),
scaledSize: new google.maps.Size(46, 70),
icon: [URL]
};
marker = new google.maps.Marker({
map: this.map,
animation: google.maps.Animation.DROP,
position: new google.maps.LatLng(
position.lat,
position.lng),
icon: icon
});
marker.setMap(this.map);
请注意,我使用的是typescript和非传统javascript,而google.maps.Point和google.maps.Size方法在原生google maps pluginit的typescript中不可用,您需要在index.html上导入google maps并在@Component declare let google上声明google;这很有道理,我试试看