ALKMaps.Control.ContextMenuFeature

The context menu control allows you to create a right-click menu to expose any custom functions.

Example

var contextMenu = new ALKMaps.Control.ContextMenuFeature({
  ctxMenuItems: [
    {
      separator: false, text: 'Remove Waypoint', onclick: function (e) {
        removeWaypoint(contextMenu);
      }
    },
    { separator: true },
    { separator: false, text: 'Zoom In', onclick: function (e) { map.zoomIn(); } },
    { separator: true },
    { separator: false, text: 'Zoom Out', onclick: function (e) { map.zoomOut(); } }
  ]
}, {
  filter: new ALKMaps.Filter.Comparison({
    type: ALKMaps.Filter.Comparison.EQUAL_TO,
    property: "isViaPoint",
    value: true
  })
});

Inherits from

Summary
ALKMaps.Control.ContextMenuFeatureThe context menu control allows you to create a right-click menu to expose any custom functions.
Properties
handleRightClicks{Boolean} Whether or not to handle right clicks.
autoActivate{Boolean} Activate the control when it is added to a map.
ctxMenuItems
featureCallbacks{Object} The functions that are sent to the feature handler for callback.
geometryTypes{Array(String)} To restrict dragging to a limited set of geometry types, send a list of strings corresponding to the geometry class names.
rightClickedItem
filter
Functions
destroyThe destroy method is used to perform any clean up before the control is dereferenced.
activateActivates the control.
deactivateDeactivates the control.
setMapSet the map property for the control, and register map events.
drawThe draw method is called when the control is ready to be displayed on the page.
showMenuDisplays the context menu at the specified location.
hideMenuHides the context menu.

Properties

handleRightClicks

{Boolean} Whether or not to handle right clicks.

autoActivate

{Boolean} Activate the control when it is added to a map.  Default is true.

ctxMenuItems

{Object}{ ‘ctxMenuItems’: [ { separator: false, text: ‘Zoom In’, onclick: function(ex) { alert(ex); }}, { separator: true }, { separator: false, text: ‘Zoom Out’, onclick: function(ex) { alert(ex); }} ] }

featureCallbacks

{Object} The functions that are sent to the feature handler for callback.

geometryTypes

{Array(String)} To restrict dragging to a limited set of geometry types, send a list of strings corresponding to the geometry class names.

rightClickedItem

filter

Functions

destroy

destroy: function ()

The destroy method is used to perform any clean up before the control is dereferenced.

activate

activate: function ()

Activates the control.

Returns

{Boolean} The control was effectively activated.

deactivate

deactivate: function ()

Deactivates the control.

Returns

{Boolean} The control was effectively deactivated.

setMap

setMap: function (map)

Set the map property for the control, and register map events.

Parameters

map{ALKMaps.Map}

draw

draw: function ()

The draw method is called when the control is ready to be displayed on the page.

Returns

{DOMElement} A reference to the DIV DOMElement containing the control

showMenu

showMenu: function (loc)

Displays the context menu at the specified location.

Parameters

loc{Array<Number>} Pixel coordinates

hideMenu

hideMenu: function ()

Hides the context menu.

destroy: function ()
The destroy method is used to perform any clean up before the control is dereferenced.
activate: function ()
Activates the control.
deactivate: function ()
Deactivates the control.
setMap: function (map)
Set the map property for the control, and register map events.
draw: function ()
The draw method is called when the control is ready to be displayed on the page.
showMenu: function (loc)
Displays the context menu at the specified location.
hideMenu: function ()
Hides the context menu.
Controls affect the display or behavior of the map.
Instances of ALKMaps.Map are interactive maps embedded in a web page.
Close