Google 在顶部映射路线多边形
Google maps route polygon on top
接上一个问题
我有很多多边形,它们相互交叉或相互重叠。
我想将当前活动路线放在所有其他路线的顶部,所以多边形的颜色在顶部显示为绿色。
如果您检查下图,则活动多边形位于其他多边形下方。
这将在活动路线上设置颜色变化。
directionsRenderer2.setOptions({
polylineOptions: {
strokeColor: 'green'
},
map:map
});
Z-Index
The order in which this polygon is drawn with respect to other overlays, including Polylines, Circles, GroundOverlays and TileOverlays, but not Markers. An overlay with a larger z-index
is drawn over overlays with smaller z-indices. The order of overlays with the same z-index value is arbitrary. The default is 0.
所以你可以使用 setZIndex()
来实现,看看 Polygon Public Methods Documentation.
希望对您有所帮助。
接上一个问题
我有很多多边形,它们相互交叉或相互重叠。
我想将当前活动路线放在所有其他路线的顶部,所以多边形的颜色在顶部显示为绿色。
如果您检查下图,则活动多边形位于其他多边形下方。
这将在活动路线上设置颜色变化。
directionsRenderer2.setOptions({
polylineOptions: {
strokeColor: 'green'
},
map:map
});
Z-Index
The order in which this polygon is drawn with respect to other overlays, including Polylines, Circles, GroundOverlays and TileOverlays, but not Markers. An overlay with a largerz-index
is drawn over overlays with smaller z-indices. The order of overlays with the same z-index value is arbitrary. The default is 0.
所以你可以使用 setZIndex()
来实现,看看 Polygon Public Methods Documentation.
希望对您有所帮助。