gpt4 book ai didi

How can i change gradient Color of polygon using google-maps-react(如何使用谷歌地图更改多边形的渐变颜色react)

转载 作者:bug小助手 更新时间:2023-10-22 18:05:11 26 4
gpt4 key购买 nike



I am using google-maps-react in my current application to show the map, here I have a requirement to display gradient Polygon, but i am unable to do so.
Currently these below attributes i can see from documentation.

我在我当前的应用程序中使用谷歌地图react来显示地图,这里我有一个显示梯度多边形的要求,但我无法做到。目前,我可以从文档中看到以下这些属性。



  • fillColor

  • fillOpacity

  • strokeColor

  • strokeOpacity

  • strokePosition

  • strokeWeight


I have also tried to add an an image url using below code but unable to do so, Can anyone please suggest me how can I achieve it?

我也尝试使用下面的代码添加一个图像url,但无法做到,有人能建议我如何实现吗?


import React, { Component } from 'react';
import { Map, GoogleApiWrapper, Polygon } from 'google-maps-react';

class MapContainer extends Component {
render() {
const triangleCoords = [
{ lat: 25.774, lng: -80.19 },
{ lat: 18.466, lng: -66.118 },
{ lat: 32.321, lng: -64.757 }
];

const polygonOptions = {
paths: triangleCoords,
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 2,
// Use the gradient image as the fillPattern
fillPattern: 'URL_TO_YOUR_GRADIENT_IMAGE',
};

return (
<Map
google={this.props.google}
zoom={10}
initialCenter={{ lat: 25.774, lng: -80.19 }}
>
<Polygon
paths={triangleCoords}
options={polygonOptions}
/>
</Map>
);
}
}

export default GoogleApiWrapper({
apiKey: 'YOUR_API_KEY'
})(MapContainer);

更多回答

There's no gradient option as of now, but you can file a feature request for it. Just make sure to put your use case. developers.google.com/maps/support#issue_tracker

目前还没有渐变选项,但你可以为它提交一个功能请求。只需确保放上你的用例。developers.google.com/maps/support#issue_tracker

I have raised a feature request they may provide some solution. issuetracker.google.com/issues/300128121

我提出了一个功能请求,他们可能会提供一些解决方案。issuetracker.google.com/issues/300128121

优秀答案推荐
更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com