* @event OverlayViewDraw
* Fires when OverlayView Draw
* @param {Roo.bootstrap.LocationPicker} this
- * @param {Roo.bootstrap.LocationPicker.OverlayView} overlayview
*/
OverlayViewDraw : true,
/**
* @event OverlayViewOnAdd
* Fires when OverlayView Draw
* @param {Roo.bootstrap.LocationPicker} this
- * @param {Roo.bootstrap.LocationPicker.OverlayView} overlayview
*/
OverlayViewOnAdd : true,
/**
* @event OverlayViewOnRemove
* Fires when OverlayView Draw
* @param {Roo.bootstrap.LocationPicker} this
- * @param {Roo.bootstrap.LocationPicker.OverlayView} overlayview
*/
OverlayViewOnRemove : true,
/**
* @event OverlayViewShow
* Fires when OverlayView Draw
* @param {Roo.bootstrap.LocationPicker} this
- * @param {Roo.bootstrap.LocationPicker.OverlayView} overlayview
+ * @param {Pixel} cpx
*/
OverlayViewShow : true,
/**
* @event OverlayViewHide
* Fires when OverlayView Draw
* @param {Roo.bootstrap.LocationPicker} this
- * @param {Roo.bootstrap.LocationPicker.OverlayView} overlayview
*/
- OverlayViewHide : true
+ OverlayViewHide : true,
+ /**
+ * @event loadexception
+ * Fires when load google lib failed.
+ * @param {Roo.bootstrap.LocationPicker} this
+ */
+ loadexception : true
});
};
},
initEvents: function(ct, position)
- {
- if(!this.mapTypeId){
- this.mapTypeId = google.maps.MapTypeId.ROADMAP;
- }
-
+ {
if(!this.el.getWidth() || this.isApplied()){
return;
}
initial: function()
{
+ if(typeof(google) == 'undefined' || typeof(google.maps) == 'undefined'){
+ this.fireEvent('loadexception', this);
+ return;
+ }
+
+ if(!this.mapTypeId){
+ this.mapTypeId = google.maps.MapTypeId.ROADMAP;
+ }
+
this.gMapContext = this.GMapContext();
this.initOverlayView();
_this.fireEvent('markerRightClick', this, event);
});
-
+
this.setPosition(this.gMapContext.location);
this.fireEvent('initial', this, this.gMapContext.location);
draw: function()
{
- Roo.log('OverlayView draw');
- _this.fireEvent('OverlayViewDraw', _this, this);
+ _this.fireEvent('OverlayViewDraw', _this);
},
onAdd: function()
{
- Roo.log('OverlayView onAdd');
- _this.fireEvent('OverlayViewOnAdd', _this, this);
+ _this.fireEvent('OverlayViewOnAdd', _this);
},
onRemove: function()
{
- Roo.log('OverlayView onRemove');
- _this.fireEvent('OverlayViewOnRemove', _this, this);
+ _this.fireEvent('OverlayViewOnRemove', _this);
},
show: function(cpx)
{
- Roo.log('OverlayView show');
- _this.fireEvent('OverlayViewShow', _this, this);
+ _this.fireEvent('OverlayViewShow', _this, cpx);
},
hide: function()
{
- Roo.log('OverlayView hide');
- _this.fireEvent('OverlayViewHide', _this, this);
+ _this.fireEvent('OverlayViewHide', _this);
}
});
getGmapContext: function()
{
- return this.gMapContext
+ return (typeof(this.gMapContext) == 'undefined') ? false : this.gMapContext;
},
GMapContext: function()
{
- var _map = new google.maps.Map(this.el.dom, this);
+ var position = new google.maps.LatLng(this.latitude, this.longitude);
+
+ var _map = new google.maps.Map(this.el.dom, {
+ center: position,
+ zoom: this.zoom,
+ mapTypeId: this.mapTypeId,
+ mapTypeControl: this.mapTypeControl,
+ disableDoubleClickZoom: this.disableDoubleClickZoom,
+ scrollwheel: this.scrollwheel,
+ streetViewControl: this.streetViewControl,
+ locationName: this.locationName,
+ draggable: this.draggable,
+ enableAutocomplete: this.enableAutocomplete,
+ enableReverseGeocode: this.enableReverseGeocode
+ });
+
var _marker = new google.maps.Marker({
- position: new google.maps.LatLng(this.latitude, this.longitude),
+ position: position,
map: _map,
title: this.markerTitle,
draggable: this.draggable
map: _map,
marker: _marker,
circle: null,
- location: _marker.position,
+ location: position,
radius: this.radius,
locationName: this.locationName,
addressComponents: {