LocalContextMapView class
google.maps.localContext.LocalContextMapView
class
Shows a Local Context experience with aMap
.
This class implements
LocalContextMapViewOptions
.
Access by callingconst {LocalContextMapView} = await google.maps.importLibrary( "localContext" )
.SeeLibraries in the Maps JavaScript API.
Constructor | |
---|---|
LocalContextMapView |
LocalContextMapView(options) Parameters:
|
Properties | |
---|---|
directionsOptions |
Type:
MapDirectionsOptions|MapDirectionsOptionsLiteraloptional |
elementoptional |
Type:
HTMLElement|SVGElementoptional This Field is read-only. The DOM Element backing the view. |
isTransitioningMapBounds |
Type:
boolean Is set to true beforeLocalContextMapView begins changing the bounds of the innerMap ,and set tofalse afterLocalContextMapView finishes changing the bounds of the innerMap .(Not set when layout mode changes happen due to responsive resizing.) |
locationBias |
Type:
LocationBiasoptional See LocalContextMapViewOptions.locationBias .Changing this property on theLocalContextMapView may trigger a new search. |
locationRestriction |
Type:
LocationRestrictionoptional See LocalContextMapViewOptions.locationRestriction .Changing this property on theLocalContextMapView may trigger a new search. |
maxPlaceCount |
Type:
number See LocalContextMapViewOptions.maxPlaceCount .Changing this property on theLocalContextMapView may trigger a new search. |
placeTypePreferences |
Type:
Array<PlaceTypePreference> See LocalContextMapViewOptions.placeTypePreferences .Changing this property on theLocalContextMapView may trigger a new search.Iterable<string|PlaceTypePreference> is also accepted. |
Inherited:
map ,
pinOptionsSetup ,
placeChooserViewSetup ,
placeDetailsViewSetup
|
Methods | |
---|---|
addListener |
addListener(eventName, handler) Parameters:
Return Value:
MapsEventListener Adds the given listener function to the given event name. |
hidePlaceDetailsView |
hidePlaceDetailsView() Parameters:None
Return Value:None
Hides the place details. |
search |
search() Parameters:None
Return Value:None
Searches for places to show the user based on the current maxPlaceCount ,placeTypePreferences ,locationRestriction ,andlocationBias . |
Events | |
---|---|
error |
function(event) Arguments:
This event is fired if there is an error while performing search. |
placedetailsviewhidestart |
function() Arguments:None
This event is fired before the place details begins animating out. |
placedetailsviewshowstart |
function() Arguments:None
This event is fired before the place details begins animating in. |
LocalContextMapViewOptions interface
google.maps.localContext.LocalContextMapViewOptions
interface
Options for constructing aLocalContextMapView
,or accessing an existingLocalContextMapView
.
Properties | |
---|---|
maxPlaceCount |
Type:
number The maximum number of places to show. When this parameter is 0, the Local Context Library does not load places. [0,24] |
placeTypePreferences |
Type:
Array<PlaceTypePreference> The types of places to search for (up to 10). The type Iterable<string|PlaceTypePreference> is also accepted, but is only supported in browsers which natively support JavaScript Symbols. |
directionsOptionsoptional |
Type:
MapDirectionsOptions|MapDirectionsOptionsLiteraloptional Options for customizing directions. If not set, directions and distance will be disabled. |
elementoptional |
Type:
HTMLElement|SVGElementoptional This Field is read-only. The DOM Element backing the view. |
locationBiasoptional |
Type:
LocationBiasoptional Default:
null A soft boundary or hint to use when searching for places. |
locationRestrictionoptional |
Type:
LocationRestrictionoptional Bounds to constrain search results. If not specified, results will be constrained to the map viewport. |
mapoptional |
Type:
Mapoptional An already instantiated Map instance. If passed in, the map will be moved into the LocalContextMapView's DOM, and willnotbe re-styled. The element associated with the Map may also have styles and classes applied to it by theLocalContextMapView . |
pinOptionsSetupoptional |
Type:
(function({ Configure the place marker icon based on the icon state. Invoked whenever the input to the callback changes. Pass a function to dynamically override the default setup when the LocalContextMapView draws the place marker. Errors and invalid configurations may be determined asynchronously, and will be ignored (defaults will be used, and errors will be logged to the console). |
placeChooserViewSetupoptional |
Type:
(function({ Overrides the setup of the place chooser view. Pass a function to dynamically override the default setup when the LocalContextMapView might change its layout due to resizing. Errors and invalid configurations may be determined asynchronously, and will be ignored (defaults will be used instead, and errors will be logged to the console). Errors detected at construction will cause errors to be thrown synchronously. |
placeDetailsViewSetupoptional |
Type:
(function({ Overrides the setup of the place details view. Pass a function to dynamically override the default setup when the LocalContextMapView might change its layout due to resizing. Errors and invalid configurations may be determined asynchronously, and will be ignored (defaults will be used, and errors will be logged to the console). Errors detected at construction will cause errors to be thrown synchronously. |
PlaceTypePreference typedef
google.maps.localContext.PlaceTypePreference
typedef
A place type to search for, and the weight to use. Ifweight
is omitted the library will determine default weights, which may change and improve over time.
{
type:string,
weight:numberoptional
}
MapDirectionsOptions class
google.maps.localContext.MapDirectionsOptions
class
Provides settings for directions with aLocalContextMapView
.
This class implements
MapDirectionsOptionsLiteral
.
Access by callingconst {MapDirectionsOptions} = await google.maps.importLibrary( "localContext" )
.SeeLibraries in the Maps JavaScript API.
Properties | |
---|---|
Inherited:
origin
|
Methods | |
---|---|
addListener |
addListener(eventName, handler) Parameters:
Return Value:
MapsEventListener Adds the given listener function to the given event name. |
MapDirectionsOptionsLiteral interface
google.maps.localContext.MapDirectionsOptionsLiteral
interface
Object literals are accepted in place ofMapDirectionsOptions
objects, as a convenience, in many places. These are converted toMapDirectionsOptions
objects when the Maps API encounters them.
Properties | |
---|---|
origin |
Type:
LatLng|LatLngLiteral Origin for directions and distance. |
PinOptions interface
google.maps.localContext.PinOptions
interface
Options for customizing a pin marker.
Properties | |
---|---|
backgroundoptional |
Type:
stringoptional The color of the icon's shape, can be any valid CSS color. |
glyphColoroptional |
Type:
stringoptional The color of the icon's glyph, can be any valid CSS color. |
scaleoptional |
Type:
numberoptional The scale of the icon. The value is absolute, not relative to the default sizes in each state. |
PlaceChooserViewSetupOptions interface
google.maps.localContext.PlaceChooserViewSetupOptions
interface
Setup options for the place chooser. Read more aboutsetting layout and visibility.
Properties | |
---|---|
layoutModeoptional |
Type:
PlaceChooserLayoutModeoptional |
positionoptional |
Type:
PlaceChooserPositionoptional Ignored when layoutMode:HIDDEN .If not passed, a position will be determined automatically based on thelayoutMode . |
PlaceChooserLayoutMode constants
google.maps.localContext.PlaceChooserLayoutMode
constants
Layout modes for the place chooser.
Access by callingconst {PlaceChooserLayoutMode} = await google.maps.importLibrary( "localContext" )
.SeeLibraries in the Maps JavaScript API.
Constants | |
---|---|
HIDDEN |
Place chooser is hidden. |
SHEET |
Place chooser is shown as a sheet. |
PlaceChooserPosition constants
google.maps.localContext.PlaceChooserPosition
constants
Display positions for the place chooser.
Access by callingconst {PlaceChooserPosition} = await google.maps.importLibrary( "localContext" )
.SeeLibraries in the Maps JavaScript API.
Constants | |
---|---|
BLOCK_END |
Place chooser is displayed on a line below the map extending to the end of the container. |
INLINE_END |
Place chooser is displayed inline with the map at the end of the line. (In a left-to-right language this means that the place chooser is to the right of the map.) |
INLINE_START |
Place chooser is displayed inline with the map at the start of the line. (In a left-to-right language this means that the place chooser is to the left of the map.) |
PlaceDetailsViewSetupOptions interface
google.maps.localContext.PlaceDetailsViewSetupOptions
interface
Setup options for the place details. Read more aboutsetting layout and visibility.
Properties | |
---|---|
hidesOnMapClickoptional |
Type:
booleanoptional |
layoutModeoptional |
Type:
PlaceDetailsLayoutModeoptional |
positionoptional |
Type:
PlaceDetailsPositionoptional Ignored when layoutMode:INFO_WINDOW .If not passed, a position will be determined automatically based on thelayoutMode . |
PlaceDetailsLayoutMode constants
google.maps.localContext.PlaceDetailsLayoutMode
constants
Layout modes for the place details.
Access by callingconst {PlaceDetailsLayoutMode} = await google.maps.importLibrary( "localContext" )
.SeeLibraries in the Maps JavaScript API.
Constants | |
---|---|
INFO_WINDOW |
Place details is displayed in anInfoWindow . |
SHEET |
Place details is displayed in a sheet. |
PlaceDetailsPosition constants
google.maps.localContext.PlaceDetailsPosition
constants
Display positions for the place details.
Access by callingconst {PlaceDetailsPosition} = await google.maps.importLibrary( "localContext" )
.SeeLibraries in the Maps JavaScript API.
Constants | |
---|---|
INLINE_END |
Place details is displayed inline with the map at the end of the line. (In a left-to-right language this means that the place details is to the right of the map.) |
INLINE_START |
Place details is displayed inline with the map at the start of the line. (In a left-to-right language this means that the place details is to the left of the map.) |