-
Notifications
You must be signed in to change notification settings - Fork 1
GmapsContextMenu
Matthew Wright edited this page Jan 2, 2021
·
4 revisions
A GmapsContextMenu displays clickable text options in a popup window above the mouse right click location. The content area (options) is configured with JSON. While it is based on an InfoWindow, it does not have a tapered stem.
Typically you will attach a context menu to a map, but you can also attach context menus to circles, markers, and other shapes.
GmapsContextMenu class
An overlay that looks like a bubble and is often connected to the map or a marker.
| Constructor | Detail |
|---|---|
| GmapsContextMenu | GmapsContextMenu([map, settings]) Parameters:
|
| Method | Detail |
|---|---|
| registerFor([mapOrShape]) |
Arguments:
|
| registerOpenFor([mapOrShape]) |
Arguments:
rightclick
|
| registerCloseFor([mapOrShape]) |
Arguments:
click
|
| updateOptions() |
Arguments:
|
| close() |
Arguments:
|
Object used to define the properties that can be set on a GmapsContextMenu.
| Property | Detail |
|---|---|
| registerOpenForMap |
Type: boolean optional Default: true Whether this context menu should be opened by the map on rightclick. |
| registerCloseForMap |
Type: boolean optional Default: true Whether this context menu should be closed by the map on click. |
| options |
Type Array[GmapsContextMenu option] Options displayed in the context menu. |
Object to customize a clickable text option displayed in the GmapsContextMenu.
| Property | Detail |
|---|---|
| text |
Type: boolean required The text displayed for the menu item. |
| showWhen |
Type: function() optional A function returning boolean for whether to display this option on right click |
| onclick |
Type: function(latLng) required A function with an argument that returns {lat, lng} for the position the context menu is opened when the option is clicked. |
Meta object that stores each of the GmapsContextMenus and provides additional option(s).
GmapsContext.setSetting("setting", "value");| Setting | Detail |
|---|---|
| registerCloseForEverything |
Type: boolean optional Default: true Registers every GmapsContextMenu made to be closed on click by every map, marker, shape referenced in every other GmapsContextMenu. When enabled, this allows every open context menu to close when a click occurs outside every open context menu. |