<legend id='uSp3T'><style id='uSp3T'><dir id='uSp3T'><q id='uSp3T'></q></dir></style></legend>

      • <bdo id='uSp3T'></bdo><ul id='uSp3T'></ul>
      <tfoot id='uSp3T'></tfoot>

    1. <i id='uSp3T'><tr id='uSp3T'><dt id='uSp3T'><q id='uSp3T'><span id='uSp3T'><b id='uSp3T'><form id='uSp3T'><ins id='uSp3T'></ins><ul id='uSp3T'></ul><sub id='uSp3T'></sub></form><legend id='uSp3T'></legend><bdo id='uSp3T'><pre id='uSp3T'><center id='uSp3T'></center></pre></bdo></b><th id='uSp3T'></th></span></q></dt></tr></i><div id='uSp3T'><tfoot id='uSp3T'></tfoot><dl id='uSp3T'><fieldset id='uSp3T'></fieldset></dl></div>
    2. <small id='uSp3T'></small><noframes id='uSp3T'>

      动态更改传单中多边形的颜色?

      时间:2023-08-09
    3. <legend id='dxBYc'><style id='dxBYc'><dir id='dxBYc'><q id='dxBYc'></q></dir></style></legend>

        <tbody id='dxBYc'></tbody>

      <tfoot id='dxBYc'></tfoot>

          <small id='dxBYc'></small><noframes id='dxBYc'>

          <i id='dxBYc'><tr id='dxBYc'><dt id='dxBYc'><q id='dxBYc'><span id='dxBYc'><b id='dxBYc'><form id='dxBYc'><ins id='dxBYc'></ins><ul id='dxBYc'></ul><sub id='dxBYc'></sub></form><legend id='dxBYc'></legend><bdo id='dxBYc'><pre id='dxBYc'><center id='dxBYc'></center></pre></bdo></b><th id='dxBYc'></th></span></q></dt></tr></i><div id='dxBYc'><tfoot id='dxBYc'></tfoot><dl id='dxBYc'><fieldset id='dxBYc'></fieldset></dl></div>
                <bdo id='dxBYc'></bdo><ul id='dxBYc'></ul>

                本文介绍了动态更改传单中多边形的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                对于熟悉 Leaflet 的人,您知道动态更改多边形颜色的方法吗?例如,以这样定义的圆为例:

                For anyone who is familiar with Leaflet, do you know a way to dynamically change a polygon's color? For example, take a circle defined like this:

                window.circle = L.circle([51.508, -0.11], 500, {
                color: 'red',
                fillColor: '#ffffff',
                    fillOpacity: 0.5
                }).addTo(map);
                

                然后,在用户单击界面上某处的按钮后(例如),我想像这样更改圆圈的颜色:

                Then later, after a user clicks a button somewhere on an interface (for example), I want to change the color of the circle like this:

                window.circle.options.fillColor = "#dddddd";
                

                代码更改了 window.circle.options.fillColor 的值,但更改不会反映在地图上多边形颜色的更改中.我四处寻找,但没有找到任何东西.有什么想法吗?

                The code changes the value for window.circle.options.fillColor, but the change is not reflected by a change to the color of the polygon on the map. I've searched around but haven't found anything. Any ideas?

                谢谢.

                推荐答案

                L.Circle extends L.Path (http://leafletjs.com/reference.html#path),有方法 setStyle( <Path options> object ),你可以将新样式应用为 window.circle.setStyle({fillColor: '#dddddd'});

                L.Circle extends L.Path (http://leafletjs.com/reference.html#path), that have method setStyle( <Path options> object ), and you can apply new style as window.circle.setStyle({fillColor: '#dddddd'});

                这篇关于动态更改传单中多边形的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:为传单中的标记分配 ID 下一篇:LeafletJS:如何删除缩放控件

                相关文章

                最新文章

                <tfoot id='Prdgf'></tfoot>

              • <small id='Prdgf'></small><noframes id='Prdgf'>

                  <bdo id='Prdgf'></bdo><ul id='Prdgf'></ul>

              • <legend id='Prdgf'><style id='Prdgf'><dir id='Prdgf'><q id='Prdgf'></q></dir></style></legend>
                    <i id='Prdgf'><tr id='Prdgf'><dt id='Prdgf'><q id='Prdgf'><span id='Prdgf'><b id='Prdgf'><form id='Prdgf'><ins id='Prdgf'></ins><ul id='Prdgf'></ul><sub id='Prdgf'></sub></form><legend id='Prdgf'></legend><bdo id='Prdgf'><pre id='Prdgf'><center id='Prdgf'></center></pre></bdo></b><th id='Prdgf'></th></span></q></dt></tr></i><div id='Prdgf'><tfoot id='Prdgf'></tfoot><dl id='Prdgf'><fieldset id='Prdgf'></fieldset></dl></div>