[英]Polygon highlighting with Mapbox or Leaflet
I am trying to replicate polygon highlighting on mouseover event in mapbox.js or leaflet.js similar to the example below: 我正在尝试在mapbox.js或leaflet.js中的mouseover事件上复制多边形突出显示,类似于以下示例:
http://projects.nytimes.com/census/2010/explorer?view=raceethnicity&lat=40.6311&lng=-73.994&l=12 http://projects.nytimes.com/census/2010/explorer?view=raceethnicity&lat=40.6311&lng=-73.994&l=12
How does this work? 这是如何运作的?
Using Leaflet, you simply have to define a function to set the style of the polygon on mouseover event. 使用Leaflet,您只需定义一个函数即可在mouseover事件上设置多边形的样式。 For example: 例如:
polygonLayer.on('mouseover', function (this) {
this.setStyle({
fillOpacity: 0,
color: 'black'
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.