Ok,
I have taken a look at that link and see how the use of the trigger
method is used to simulate a click on the map which may help me out.
My map initialisation code can be found below, I tried adding in the
GEvent.trigger code used in the sample link you sent me but it makes
no difference, any thoughts??
_initMap: function() {
try {
this._map = new GMap2(document.getElementById("myMap"));
} catch (e) {
this._map = null;
}
if (this._map != null) {
try {
//Positioning of map controls below
var topLeft= new
GControlPosition(G_ANCHOR_TOP_LEFT, new
GSize(80,10));
var topLeftb= new
GControlPosition(G_ANCHOR_TOP_LEFT, new
GSize(10,10));
GEvent.bind(this._map, "load", this,
this._mapLoadCallback);
this._map.addControl(new
GLargeMapControl3D(),topLeftb);
this._map.addControl(new GScaleControl());
this._map.addControl(new
GMapTypeControl(),topLeft);
this._map.enableScrollWheelZoom();
this._map.enableContinuousZoom();
this._svOverlay = new GStreetviewOverlay();
this._panoClient = new GStreetviewClient();
var trafficOptions = {incidents:true};
this._trafficInfo = new
GTrafficOverlay(trafficOptions);
new GKeyboardHandler(this._map);
this._map.enableKeyDragZoom({
key:'ctrl',
boxStyle:
{backgroundColor:'#FF0000',opacity:0.2}
});
var centreLat=(_mapRect[0] + _mapRect[2]) / 2;
var centreLon=(_mapRect[1] + _mapRect[3]) / 2;
_defaultMapCentre=new GLatLng(centreLat,
centreLon);
this._map.setCenter(_defaultMapCentre,5);
this._resizeMap();
var
event = {srcElement: mapContainer, target: mapContainer, nodeType:
1};
GEvent.trigger(document, "click", event);
} catch (e) {
this._map = null;
this._mapIsLoaded = false;
}
}
if (this._map == null) {
// map creation failed for some reason, try again after a
delay
window.setTimeout(Function.createDelegate(this,
this._initMap), 2000);
}
}
On Feb 16, 11:09 am, Andrew Leach <[email protected]>
wrote:
> On Feb 16, 10:27 am, parky128 <[email protected]> wrote:
>
> > Has anyone come across this before? Could it be a timing issue with
> > scripts loading on the page? I tried instantiating these on the load
> > event of the map object but it makes no difference.
>
> Not sure how anyone can answer the questions without seeing your app.
> However, I do think you need to trigger a click on the map.
> Seehttp://acleach.me.uk/gmaps/keyboardhandler.htm(which sets the
> language as German for some reason). Code there courtesy of Pamela.
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.