所以,我一直在尝试减小我在谷歌地图中使用的自定义标记的大小。我确实找到了一些与减小大小相关的属性,即https://developers.google.com/maps/documentation/javascript/reference/marker#Icon
但是,尽管我尝试它不会反映。那么,你能帮我确定我在哪里做错了吗?
import React, { Component } from 'react';
import { Map, Marker, GoogleApiWrapper } from 'google-maps-react';
import logo from './pins/Minigrid_RMS_Absent.png'
const mapStyles = {
width: '100%',
height: '100%'
};
export class MapContainer extends Component {
constructor(props){
super(props)
this.onMarkerClick=this.onMarkerClick.bind(this)
}
onMarkerClick(){
console.log('called:')
}
render() {
return (
<Map
google={this.props.google}
zoom={5}
style={mapStyles}
initialCenter={{
lat: 21.5937,
lng: 78.9629
}}
>
<Marker key='0' icon={{
url: logo,
scaledSize: this.props.google.maps.Size(15,25)
}} position={{lat: 21.5937, lng: 78.9629}} onClick={this.onMarkerClick}
/>
</Map>
);
}
}
export default GoogleApiWrapper({
apiKey: 'MYKEY'
})(MapContainer);
因此,希望能在指出错误方面提供一些帮助。谢谢。