【发布时间】:2021-03-16 07:25:44
【问题描述】:
我正在实施 google-maps-react。如果用户当前位置在多边形中,我需要功能,我需要启用一个按钮。我搜索了 containslocation() 但没有得到适当的答案。这是我的代码:
import { Map, GoogleApiWrapper, InfoWindow, Marker, Polygon } from 'google-maps-react';
...
...
<CurrentLocation
centerAroundCurrentLocation
google={this.props.google}
>
<Polygon
paths={triangleCoords}
strokeColor="#0000FF"
strokeOpacity={0.8}
strokeWeight={2}
fillColor="#0000FF"
fillOpacity={0.35} />
<Marker
position={{ lat: this.state.currentPosition.lat, lng: this.state.currentPosition.lng }}
onClick={this.onMarkerClick}
name={'Current Location'}
/>
<InfoWindow
marker={this.state.activeMarker}
visible={this.state.showingInfoWindow}
onClose={this.onClose}
>
<div>
<h4>{this.state.selectedPlace.name}</h4>
</div>
</InfoWindow>
</CurrentLocation>
【问题讨论】:
标签: reactjs google-maps google-maps-react