如何解决反应传单用图案填充多边形
这个任务有什么好的解决方案吗?
我尝试过 Leaflet.Pattern 库,但它没有在 React 应用程序中绘制任何内容。
代码太大,无法复制到这里,只是摘录了一些。
导入 StripePattern,定义它,然后像这样在 Polygon 中使用:
import {StripePattern} from 'leaflet';
import 'leaflet.pattern'
***
//inside the component or outside,doesn't matter. Had the same effect.
const stripePattern = new StripePattern()
***
//inside the return of component
<Polygon
fillPattern={stripePattern}
positions={points}
interactive={false}
color={LayerColor.Red}
weight={0}
fillOpacity={1.0}
/>
代码本身没有问题,因为所有其他多边形都画得很好。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。