Google 地图 v2 GGroundOverlay 在屏幕调整大小之前不会呈现
我正在使用 V2 开发基于谷歌地图的东西(我知道它已被弃用,它是遗留代码)。我有一个在多个地方调用的函数(选择现有的“图钉”,删除新的“图钉”),该函数将图像渲染为所选点周围的“范围”。
这里传入的“地图”是一个 GMap 对象。 centerPt 是一个 GLatLng,rangeValue 是一个 int,从 jQueryTools 滑块控件获取。
function drawCircle(map, centrePt, rangeValue) {
if (circle) {
map.removeOverlay(circle);
}
var boundaries = getBoundaries(centrePt, rangeValue);
circle = new GGroundOverlay("/images/map_range.png", boundaries);
map.addOverlay(circle);
}
我在很多页面上都运行了这个,并且在很多情况下它都运行得很好。
在某一特定页面中,/images/map_range.png
处的图像不显示。滑块滑动,其底层的值肯定会更新(我正在使用 Firebug 观察),此函数会触发(并写入控制台,当我在那里时),但没有圆圈......直到窗口调整大小。从字面上看,我可以在滑块上滑动,没有圆圈,将窗口大小调整几个像素,在滑块上滑动,然后得到圆圈。
为什么调整窗口大小会让这个突然起作用?有什么想法吗?因为我被难住了。
我尝试生成一个窗口调整大小,但显然我不允许弄乱我未启动的窗口的大小,我想总的来说我同意。
I'm working on a google map based thing using V2 (which I know is deprecated, it's legacy code). I have a function I call in several places (picking an existing "pin", dropping a new "pin") that renders an images as a "range" around the selected point.
the "map" that's passed in here is a GMap object. centrePt is a GLatLng, and rangeValue is an int, gotten from a jQueryTools slider control.
function drawCircle(map, centrePt, rangeValue) {
if (circle) {
map.removeOverlay(circle);
}
var boundaries = getBoundaries(centrePt, rangeValue);
circle = new GGroundOverlay("/images/map_range.png", boundaries);
map.addOverlay(circle);
}
I have this running on MANY pages, and in many contexts it works just great.
In one particular page, the image at /images/map_range.png
doesn't display. The slider slides, the values underlying it definitely update (I'm watching that with Firebug), this function fires (and writes to the console, when I had that in there), but no circle... UNTIL the window resizes. Literally I can slide on the slider, no circle, resize the window by a few pixels, slide on the slider, and get the circle.
WHY would a window resize make this suddenly work? Any thoughts? Cause I'm stumped.
I tried generating a window resize, but evidently I'm not allowed to mess with the size of a window I didn't launch, which I guess on the balance I approve of.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论