GWT中的Fire ResizeEvent(Google Web Toolkit)

编程入门 行业动态 更新时间:2024-10-23 06:31:04
本文介绍了GWT中的Fire ResizeEvent(Google Web Toolkit)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在我的网站上,我有一些Google Maps(v3),您可以通过TabPanel(每个选项卡一个)进行选择,但在切换选项卡时出现问题。当您选择标签时,它不会唤醒地图。要解决这个问题,我只需要使用ResizeEvent.fire( source ,Window.getClientWidth(),Window.getClientHight());这将在地图上激活调整大小的监听器并唤醒。我的问题是,我不能指向浏览器窗口的注册的resize处理程序(它是com.google.gwt.user.client.Window.handlers中的包保护),因此我不知道该用作我的源。如果有人对我的解决方案或另一种可能的解决方案有答案,那将是非常感谢。

On my site I have a number of Google Maps (v3) that you can select via a TabPanel (one per tab) but there is a problem when you switch tabs. When you select the tab it does not "wake up" the map. To fix this I simply need to use ResizeEvent.fire(source, Window.getClientWidth(), Window.getClientHight()); this will active the resize listener on the map and "wake it up." My problem is that I cant get a pointer to the registered resize handlers for the browser window (it is package protected in com.google.gwt.user.client.Window.handlers) therefore I don't know what to use as my source. If anyone has the answer to my solution or another possible solution it would be greatly appreciated.

谢谢,Tom

推荐答案

感谢您的回复,但我发现这三行: HasLatLng center = mapWidget.getMap()。getCenter(); Event.trigger(mapWidget.getMap(),resize); mapWidget.getMap()。setCenter(center); 做窍门。这基本上是当地图最初加载时会发生什么。在MapWidget的onLoad()方法中,调用super.onLoad()然后执行这三行唤醒地图并保留中心点。

Thanks for your reply but I figured out that these three lines: HasLatLng center = mapWidget.getMap().getCenter(); Event.trigger(mapWidget.getMap(), "resize"); mapWidget.getMap().setCenter(center); do the trick. This is basically what happens when the map loads initially. In the onLoad() method for MapWidget it makes a call to super.onLoad() then executes these three lines which "wakes up" the map and preserves the center point.

更多推荐

GWT中的Fire ResizeEvent(Google Web Toolkit)

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

发布评论

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

>www.elefans.com

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