diff --git a/source/Ox.UI/js/Map/Map.js b/source/Ox.UI/js/Map/Map.js index 160a150a..c731984e 100644 --- a/source/Ox.UI/js/Map/Map.js +++ b/source/Ox.UI/js/Map/Map.js @@ -1033,8 +1033,15 @@ Ox.Map = function(options, self) { }; function panToPlace() { - var place = getSelectedPlace(); - place && self.map.panTo(place.center); + var place; + if (!self.loaded) { + setTimeout(function() { + panToPlace(); + }, 100); + } else { + place = getSelectedPlace(); + place && self.map.panTo(place.center); + } } function parseGeodata(data) { @@ -1172,12 +1179,13 @@ Ox.Map = function(options, self) { function selectPlace(id, zoom) { // id can be null (deselect) - var place, selected = getSelectedMarker(); + var place, selected; if (!self.loaded) { setTimeout(function() { - selectPlace(id, zoom) - }, 1000); + selectPlace(id, zoom); + }, 100); } else { + selected = getSelectedMarker(); Ox.Log('Map', 'Ox.Map selectPlace()', id, selected); if (id != selected) { place = getPlaceById(selected); @@ -1222,7 +1230,7 @@ Ox.Map = function(options, self) { self.options.selected = id; setPlaceControls(place); setStatus(); - that.triggerEvent('selectplace', place); // DEPRECATED + that.triggerEvent('selectplace', place); // FIXME: DEPRECATED that.triggerEvent('select', {place: place}); } }; @@ -1429,8 +1437,15 @@ Ox.Map = function(options, self) { } function zoomToPlace() { - var place = getSelectedPlace(); - place && self.map.fitBounds(place.bounds); + var place; + if (!self.loaded) { + setTimeout(function() { + zoomToPlace(); + }, 100); + } else { + place = getSelectedPlace(); + place && self.map.fitBounds(place.bounds); + } } /*@