new UWA.Controls.Map(options)
Display a Google Map.
Available Events
Event | Description |
---|---|
onPreInject |
Triggered before inject |
onPostInject |
Triggered after inject |
onResize |
Invoked when control needs to resize |
onLoad |
Invoked when the map is loaded |
Example
var onMapLoad = function() {
MyMap.setPosition({
coords: {
latitude: 42.123,
longitude: 42.123
}
});
};
var MyMap = new UWA.Controls.Map({
events: {
onLoad: onMapLoad
}
});
Parameters
Name | Type | Description | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Options hash or a option/value pair. Properties
|
Extends
- UWA.Controls.Abstract
Mixes In
- UWA.Classes.Timed
Index
Members
Methods
Members
-
<protected> id
-
Properties:
Name Type Description id
Number Instance unique id.
-
<protected> api
-
Properties:
Name Type Description api
Object The current google.maps object.
-
<protected> map
-
Properties:
Name Type Description map
Object The current google.maps.Map instance.
-
<protected> defaultOptions
-
Properties:
Name Type Description defaultOptions
Object The default controls options.
Methods
-
callApi(callback)
-
To be sure the google map api is loaded, you must wrap all your calls in this method if the api is not loaded, this method will try a bit later
Parameters
Name Type Description callback
Function Executed once the api is fully loaded
-
setPosition(position)
-
Set Center of the Map to a position.
Parameters
Name Type Description position
Object A position object with coords object attribute with longitude and latitude
-
setSize(size)
-
Change the size of the map.
Parameters
Name Type Description size
Object an object with
width
andheight
properties, matching the width and height style values. -
addMarker(position, title, content)
-
Add a marker on the Map to a position.
Parameters
Name Type Description position
Object A position object with coords object attribute with longitude and latitude
title
String Marker title
content
String Marker content (could contain HTML)
-
onApiReady()
-
Invoked when google Api is loaded
-
onLoad()
-
Triggered after google Api is loaded
-
onResize()
-
Invoked when control needs to resize