传单层 Z

编程入门 行业动态 更新时间:2024-10-23 13:22:54
本文介绍了传单层 Z-index的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要在传单层之间设置 z-index(控制前景中的内容).

I need to set z-index (control what is in foreground) between leaflet layers.

有可能,例如在 2 个(或更多)geoJson 层之间或在 2 个(或更多)ImageOverlay 层之间进行控制,具有bringToFront、bringToBack 功能.

It is possible to e.g. control between 2 (or more) geoJson layers or between 2 (or more) ImageOverlay layers, with bringToFront, bringToBack functions.

L.geoJson 层总是在 L.imageOverlay 层之上,我需要将 imageOverlay 设置在 GeojJson 之上.

L.geoJson layer is always over L.imageOverlay layer and I need to set imageOverlay to be over GeojJson.

这在 Leaflet 中可行吗?

推荐答案

可以,但不使用 bringToFront 和 bringToBack.您需要在 1.0.0 版本中使用自定义窗格.请参阅 GIS.SE 上的 这篇文章 和 本教程 在 Leaflet 网站上.总而言之,您需要为图像叠加创建一个新窗格,设置其 z-index,然后在创建图层时设置 pane 选项.以下将在您的 GeoJSON 图层上方添加图像叠加层:

Yes, but not using bringToFront and bringToBack. You need to use custom panes in the 1.0.0 version. See this post on GIS.SE and this tutorial on the Leaflet site. To summarize, you need to create a new pane for your image overlay, set its z-index, and then set the pane option when you create the layer. The following will add an image overlay above your GeoJSON layers:

map.createPane('imagePane'); map.getPane('imagePane').style.zIndex = 401; var imageLayer = L.imageOverlay(imageUrl, imageBounds, { pane: 'imagePane' }).addTo(map);

当然,您也可以将 GeoJSON 图层放置在它们自己的窗格中并操作它们的 z-indexing.

Of course, you can also place GeoJSON layers in their own pane(s) and manipulate their z-indexing as well.

更多推荐

传单层 Z

本文发布于:2023-06-11 17:27:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/639747.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:传单

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!