javascript map in leaflet how to refresh

后端 未结 3 1754

i have a basic geoJson program in javascript by using leaflet API.






        
相关标签:
3条回答
  • 2021-02-05 15:39

    Last time I've used

    map._onResize(); 
    

    and that help me refresh map. Maybe a little hack, but, it work.

    In your code will be area._onResize()

    P.S: Maybe you should try change the way to set new opacity value - try change

    function clicked(){
        this.options.style.fillOpacity = 0.8;
     }
    

    to that

    function clicked(){
        this.setStyle({fillOpacity: 0.2});
     }
    
    0 讨论(0)
  • 2021-02-05 15:43
    map.invalidateSize();
    

    map._onResize() - it's a hack, and there is no guarantee that it won't be removed in future versions.

    0 讨论(0)
  • 2021-02-05 15:50

    area.fitBounds(area.getBounds());

    0 讨论(0)
提交回复
热议问题