瓷砖上的事件开始载入Google Maps v3 [英] Event on tiles start loading in Google Maps v3
问题描述
我正在寻找一种方法来检测是否加载了谷歌地图v3的瓦片,以及当瓷砖开始加载时触发的事件。
I am looking for a way to detect if tiles of google maps v3 are loading or and event which triggers when tiles start loading.
我的用户界面如下构建:
My UI is build as follows:
背景图层上有一张地图。
在前台有一个用户输入位置的表单。
他点击enter后,地图正在平移并缩放到指定的位置。
There is a map on background layer. On the foreground there is a form in which user enters location. After he hits enter, map is panning and zooming to specified location.
我想做的是隐藏前景层AFTER:
1。地图放大
2.地图是panned
3.所有的瓷砖都被加载
All I want to do is hide foreground layer AFTER: 1. Map is zoomed 2. Map is panned 3. All tiles are loaded
问题是当打字的位置非常接近起始位置,没有tileloaded事件触发,因为地图只能移动几个像素。所以我不能依赖于tileloaded事件。
The problem is that when typed location is very close to starting location, there is no "tilesloaded" event triggered because map panned only few pixels. So I can't depend on "tilesloaded" event.
我不能依赖于bounds_changed或idle事件,因为它们在所有的tile加载之前触发。
I can't also depend on "bounds_changed" or "idle" event because they trigger BEFORE all tiles loads.
你有什么想法吗?
推荐答案
你可以: / p>
You may:
- 收听
tileloaded
-event并在窗体触发时隐藏窗体 - ,以捕获
tileloaded
没有在变量中存储边界(打开表单时)的情况。观察bounds_changed
-event,并检查存储边界的东北/西南与当前边界之间的差异(屏幕像素)是否小于256(即大小的瓷砖)。当您可以假设没有要加载的图块时,立即触发tileloaded
-event。
- listen for the
tilesloaded
-event and hide the form when it fires - to catch the case where
tilesloaded
didn't fire store the bounds(when opening the form) in a variable. Observe thebounds_changed
-event and check if the difference(in screen-pixels) between the northeast/southwest of the stored bounds and the current bounds is less than 256(that's the size of a tile). When it does you may assume that there are no tiles to load, trigger thetilesloaded
-event immediately.
这篇关于瓷砖上的事件开始载入Google Maps v3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!