From: Mikael C. <mik...@cl...> - 2010-03-02 11:29:22
|
I've tried implementing the Map.updateSize() method in GWT-OL, and it works. However, I had to call this method in my client code. For more transparency, we could call updateSize() in the MapWidget.getMap() method, which is responsible of the instanciation of Map : * public Map getMap() { //The preference here is lazy initalization if (map == null) { if (options == null) map = new Map(getElement()); else map = new Map(getElement(), options); map.updateSize(); } return map; }* What do you think ? 2010/3/2 dan twining <dan...@go...> > Poul pointed me at a conversation on Nabble that discusses this very issue<http://n2.nabble.com/GWt-Openlayers-problem-GOOGLE-layer-appears-in-left-corner-td4619582.html#a4619582>. > It suggests calling *map.updateSize()*. This *will *update the map, but *not > if you call it during the entry point method*, i.e. it won't work the > first time the map is drawn. > > I suspect that the problem is that the the entry point method is getting > called too early, and that GWT/the browser hasn't placed the map div on the > screen correctly at the time updateSize() is called. > > It is possible to fix this *for firefox only*, if you add <body > onload="map.updateSize()">, but this doesn't work in Safari, Chrome and IE, > and I need my map to work render correctly when opened in all browsers. > > Does anyone have any other ideas? > > Thanks > > > > On 1 March 2010 21:52, dan twining <dan...@go...> wrote: > >> If anyone's interested, I've put a couple of screenshots of the >> not-quite-fullscreen map here: >> >> http://dantwining.com/2010/03/01/gwt-openlayers-and-full-screen-maps/ >> >> >> On 1 March 2010 21:24, dan twining <dan...@go...> wrote: >> >>> You can give "100%" as the width/height args. It works, but there's a bug >>> in the way that the map initially renders. Or, at least, there's a bug when >>> I try. You can check out my attempt here: >>> >>> >>> https://code.google.com/p/dantwining/source/browse/#svn/trunk/FullScreenMap >>> >>> >>> On 1 March 2010 12:42, David R Robison < >>> drr...@op...> wrote: >>> >>>> I have attached the MapWidget to the center section of a >>>> DockLayoutPanel. The MapWidget takes two string arguments to define its >>>> height and width. What I would like to do is to automatically have the >>>> map expand to fill the available space in its section of the >>>> DockLayoutPanel. This way if the browser is resized the map will >>>> similarly resize. I'm sure this is not hard to do but I am new to >>>> gwt-openlayers. Any thoughts on how to do this? Thanks, David >>>> >>>> -- >>>> >>>> David R Robison >>>> Open Roads Consulting, Inc. >>>> 103 Watson Road, Chesapeake, VA 23320 >>>> phone: (757) 546-3401 >>>> e-mail: drr...@op... >>>> web: http://openroadsconsulting.com >>>> blog: http://therobe.blogspot.com >>>> book: >>>> http://www.xulonpress.com/bookstore/bookdetail.php?PB_ISBN=9781597816526 >>>> >>>> This e-mail communication (including any attachments) may contain >>>> confidential and/or privileged material intended solely for the individual >>>> or entity to which it is addressed. If you are not the intended recipient, >>>> you should immediately stop reading this message and delete it from all >>>> computers that it resides on. Any unauthorized reading, distribution, >>>> copying or other use of this communication (or its attachments) is strictly >>>> prohibited. If you have received this communication in error, please notify >>>> us immediately. >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Download Intel® Parallel Studio Eval >>>> Try the new software tools for yourself. Speed compiling, find bugs >>>> proactively, and fine-tune applications for parallel performance. >>>> See why Intel Parallel Studio got high marks during beta. >>>> http://p.sf.net/sfu/intel-sw-dev >>>> _______________________________________________ >>>> Gwt-openlayers-users mailing list >>>> Gwt...@li... >>>> https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users >>>> >>> >>> >> > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Gwt-openlayers-users mailing list > Gwt...@li... > https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users > > -- Mikael Couzic Pôle Business Intelligence Groupe Cliris |