宣传单张JS(反应式传单)-装满透明色的边框 [英] Leaflet JS (react-leaflet) - Bounds Box Filled With Transparent Color

查看:132
本文介绍了宣传单张JS(反应式传单)-装满透明色的边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用react-leaflet软件包,但是,如果您可以用普通传单回答问题,那也会有所帮助.

I'm working with react-leaflet package, however, if you can answer the question in plain leaflet that would be helpful as well.

我已成功平移到我提供的多边形的边界,如下所示:

I am successfully panning to the bounds of a polygon that I supply like so:

<Map center={position}
                 zoom={13}
                 bounds={this.state.bounds}
                 className="campaignimagery-map">
                 <TileLayer
                    url="http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
                    attribution=""
                 />

但是,我希望整个多边形边界框为某种透明颜色,以便他们可以准确看到边界框在地图上的位置.这可能吗?

However, I would like the entire polygon boundary box to be some transparent color so they can see exactly where the boundary box lies on the map. Is this possible?

推荐答案

简短答案

使用边界绘制一个像L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);这样的彩色矩形.有关更多信息,请参见相关的文档.

Use the bounds to draw a colored rectangle like this L.rectangle(bounds, {color: "#ff7800", weight: 1}).addTo(map);. See related documentation for more information.

说明

我认为无法按原样为边界着色,但是您可以使用边界绘制多边形.然后可以根据需要对多边形本身进行着色和管理.

I don't think it's possible to color bounds as is, but you can use bounds for drawing a polygon. Then the polygon itself can be colored and managed as you wish.

这篇关于宣传单张JS(反应式传单)-装满透明色的边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆