iidioter / earth-api-samples

Automatically exported from code.google.com/p/earth-api-samples
0 stars 0 forks source link

gwt demo for Google Earth does not work properly with IE or FF #272

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a GWT project using the GwtEarth example code from 
(http://code.google.com/apis/earth/documentation/examples.html). SVN url: 
http://earth-api-samples.googlecode.com/svn/trunk/demos/gwt-earth

2. The project will not display the GE Plugin in GWT hosted mode, or IE 7.  
It will display in FF, but only  1/4 height.  It does display correctly in 
Chrome.

Which plugin version are you using?
5.0.11738.1858

Which browsers and operating systems are affected?
IE 7, FF, Hosted GWT

Please provide any additional information (code snippets/links) below.
The code is straight from the gwt GE API example.

Original issue reported on code.google.com by curtis.jensen on 24 Jun 2009 at 3:45

GoogleCodeExporter commented 9 years ago

Original comment by api.roman.public@gmail.com on 1 Aug 2009 at 12:12

GoogleCodeExporter commented 9 years ago
Hey,

I feel your pain.  It seems in firefox that you need to set the height of the 
map3d explicitly.

In my GoogleEarthWidget, I got around this by overriding the setHeight method 
to become

 public void setHeight(String height) {
        super.setHeight(height);
        //super.setHeight only sets the height on the outer GWT HTML element that wraps
        //the map3d div.  This seems to resize the map in chrome but not firefox 4.
        //Firefox 4 requires the size to be set on the map3d div itself
        Element e = DOM.getElementById(mapDivId + instanceId);
        if (e != null) {
            DOM.setStyleAttribute(e, "height", height);
        }
    }

Where instanceId is the id of the plugin, so usually 0, you need to copy the 
static one that is there, if that confuses you just let me know and i'll 
explain it better, and mapDivId is just 'map3d'.

My html element is configured like so :

 final String div = "<div class='" + mapDivId + "' border=1 id='" + mapDivId + id + "'></div>";
        instanceId = id;
        html = new HTML(div);
        setElement(html.getElement());

Hope this helps.

Original comment by john.d.r...@gmail.com on 5 Apr 2011 at 8:49