标记不会出现在传单中的连续世界上 [英] Markers do not appear on continuous world in Leaflet
问题描述
当我设置选项continuousWorld=true
时,标记不会显示在克隆的图块上,而只会显示在主要世界上.它是设计行为吗?显示这些标记是否可能是我没有注意到的其他选择?
When I set option continuousWorld=true
markers are not shown on the cloned tiles, only on the main world. Is it designed behavior? May be other option, which I haven't noticed, to show these markers exists?
UPD :我的目标是在每个世界上都重复标记,如下图所示.
我调查了continuousWorld
和worldcopyjump
不适用于此情况.那么这有可能使传单像图片一样工作吗?
UPD: My aim to repeat markers on every world like on the picture below.
I investigated that continuousWorld
and worldcopyjump
are not suitable for this. So is this possible to make leaflet work as on the picture?
推荐答案
不幸的是,据我所知,没有自动和开箱即用的解决方案可以将相邻的所有内容(标记,向量等)复制传单中的世界副本.
Unfortunately there is no automatic and out-of-the-box solution that I know of that would copy all content (markers, vectors, etc.) on adjacent copies of the world in Leaflet.
Tomislav提出的最简单的技巧是手动生成内容的额外副本,以360度经度的倍数偏移.我认为continuousWorld
tileLayer选项必须留在false
上.结合worldCopyJump
映射选项,您可以达到预期的效果,但必须多次克隆内容.
The easiest trick as proposed by Tomislav would be to manually generate extra copies of your content, offset by multiples of 360 degrees longitude. I think the continuousWorld
tileLayer option must be left at false
for that. In conjunction with worldCopyJump
map option, you could achieve the desired effect, at the expense of having to clone your content several times.
话虽这么说,这可能只是您实现目标的一种可能的解决方案,而您尚未真正露面?
That being said, this may be just 1 possible solution for your objective, which you have not really explicited?
如果要避免用户看到一个空白的世界,也许您根本无法显示该世界的相邻副本.您可以通过多种方式实现这一目标,并且可以将它们结合使用:
If you want to avoid the user from seeing an empty world, maybe you could simply not show the adjacent copies of the world. You have several ways of achieving that, and you can use them in conjunction:
-
noWrap
tileLayer选项不显示相邻副本. -
maxBounds
地图选项可将平移限制在1个世界边界(或任何其他边界)上指定范围). -
minZoom
地图选项,以防止缩小得太多,以至于没有视口中的房间,可以看到世界的多个副本.
noWrap
tileLayer option to not display adjacent copies.maxBounds
map option to clamp panning to 1 world boundaries (or any other specified bounds).minZoom
map option to prevent zooming out too much so that there is no room in the view port for several copies of the world.
演示: http://jsfiddle.net/ve2huzxw/20/
注意:如果minZoom
设置得足够高,则使用 worldCopyJump
地图选项的效果与Google Maps非常相似,也就是说,您认为自己正在世界各地滚动浏览并重新找到内容.只是您永远不会有机会在同一屏幕上两次看到完全相同的位置,并且地图会自动回滚360度以保留在内容上.在-180/+180度经度边界处,这仍然很明显,因为您在左侧或右侧都具有内容,但是永远不会同时出现.
Note: if minZoom
is set high enough, the use of worldCopyJump
map option renders a very similar effect as in Google Maps, i.e. you think you are rolling all around the world and find your content again. It is just that you never have a chance to see the exact same location twice on the same screen, and that the map automatically rolls back 360 degrees to remain on the content. This is still noticeable at the -180 / +180 degrees longitude border, as you have either content on the left or on the right, but never both simultaneously.
演示: http://jsfiddle.net/ve2huzxw/21/
这篇关于标记不会出现在传单中的连续世界上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!