ALKMaps.Control.NavigationHistory

A navigation history control.  This is a meta-control, that creates two dependent controls: previous and next.  Call the trigger method on the previous and next controls to restore previous and next history states.  The previous and next controls will become active when there are available states to restore and will become deactive when there are no states to restore.

Inherits from

Summary
ALKMaps.Control.NavigationHistoryA navigation history control.
Properties
type{String} Note that this control is not intended to be added directly to a control panel.
previous{ALKMaps.Control} A button type control whose trigger method restores the previous state managed by this control.
previousOptions{Object} Set this property on the options argument of the constructor to set optional properties on the previous control.
next{ALKMaps.Control} A button type control whose trigger method restores the next state managed by this control.
nextOptions{Object} Set this property on the options argument of the constructor to set optional properties on the next control.
limit{Integer} Optional limit on the number of history items to retain.
autoActivate{Boolean} Activate the control when it is added to a map.
clearOnDeactivate{Boolean} Clear the history when the control is deactivated.
registry{Object} An object with keys corresponding to event types.
nextStack{Array} Array of items in the history.
previousStack{Array} List of items in the history.
listeners{Object} An object containing properties corresponding to event types.
restoring{Boolean} Currently restoring a history state.
Constructor
ALKMaps.Control.NavigationHistory
Functions
onPreviousChangeCalled when the previous history stack changes.
onNextChangeCalled when the next history stack changes.
destroyDestroy the control.
setMapSet the map property for the control and previous and next child controls.
drawCalled when the control is added to the map.
previousTriggerRestore the previous state.
nextTriggerRestore the next state.
clearClear history.
getStateGet the current state and return it.
restoreUpdate the state with the given object.
setListenersSets functions to be registered in the listeners object.
activateActivate the control.
initStackCalled after the control is activated if the previous history stack is empty.
deactivateDeactivate the control.

Properties

type

{String} Note that this control is not intended to be added directly to a control panel.  Instead, add the sub-controls previous and next.  These sub-controls are button type controls that activate and deactivate themselves.  If this parent control is added to a panel, it will act as a toggle.

previous

{ALKMaps.Control} A button type control whose trigger method restores the previous state managed by this control.

previousOptions

{Object} Set this property on the options argument of the constructor to set optional properties on the previous control.

next

{ALKMaps.Control} A button type control whose trigger method restores the next state managed by this control.

nextOptions

{Object} Set this property on the options argument of the constructor to set optional properties on the next control.

limit

{Integer} Optional limit on the number of history items to retain.  If null, there is no limit.  Default is 50.

autoActivate

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

clearOnDeactivate

{Boolean} Clear the history when the control is deactivated.  Default is false.

registry

{Object} An object with keys corresponding to event types.  Values are functions that return an object representing the current state.

nextStack

{Array} Array of items in the history.

previousStack

{Array} List of items in the history.  First item represents the current state.

listeners

{Object} An object containing properties corresponding to event types.  This object is used to configure the control and is modified on construction.

restoring

{Boolean} Currently restoring a history state.  This is set to true before calling restore and set to false after restore returns.

Constructor

ALKMaps.Control.NavigationHistory

Parameters

options{Object} An optional object whose properties will be used to extend the control.

Functions

onPreviousChange

onPreviousChange: function(state,
length)

Called when the previous history stack changes.

Parameters

state{Object} An object representing the state to be restored if previous is triggered again or null if no previous states remain.
length{Integer} The number of remaining previous states that can be restored.

onNextChange

onNextChange: function(state,
length)

Called when the next history stack changes.

Parameters

state{Object} An object representing the state to be restored if next is triggered again or null if no next states remain.
length{Integer} The number of remaining next states that can be restored.

destroy

destroy: function()

Destroy the control.

setMap

setMap: function(map)

Set the map property for the control and previous and next child controls.

Parameters

map{ALKMaps.Map}

draw

draw: function()

Called when the control is added to the map.

previousTrigger

previousTrigger: function()

Restore the previous state.  If no items are in the previous history stack, this has no effect.

Returns

{Object} Item representing state that was restored.  Undefined if no items are in the previous history stack.

nextTrigger

nextTrigger: function()

Restore the next state.  If no items are in the next history stack, this has no effect.  The next history stack is populated as states are restored from the previous history stack.

Returns

{Object} Item representing state that was restored.  Undefined if no items are in the next history stack.

clear

clear: function()

Clear history.

getState

getState: function()

Get the current state and return it.

Returns

{Object} An object representing the current state.

restore

restore: function(state)

Update the state with the given object.

Parameters

state{Object} An object representing the state to restore.

setListeners

setListeners: function()

Sets functions to be registered in the listeners object.

activate

activate: function()

Activate the control.  This registers any listeners.

Returns

{Boolean} Control successfully activated.

initStack

initStack: function()

Called after the control is activated if the previous history stack is empty.

deactivate

deactivate: function()

Deactivate the control.  This unregisters any listeners.

Returns

{Boolean} Control successfully deactivated.

Controls affect the display or behavior of the map.
{ALKMaps.Control} A button type control whose trigger method restores the previous state managed by this control.
{ALKMaps.Control} A button type control whose trigger method restores the next state managed by this control.
onPreviousChange: function(state,
length)
Called when the previous history stack changes.
onNextChange: function(state,
length)
Called when the next history stack changes.
destroy: function()
Destroy the control.
setMap: function(map)
Set the map property for the control and previous and next child controls.
draw: function()
Called when the control is added to the map.
previousTrigger: function()
Restore the previous state.
nextTrigger: function()
Restore the next state.
clear: function()
Clear history.
getState: function()
Get the current state and return it.
restore: function(state)
Update the state with the given object.
setListeners: function()
Sets functions to be registered in the listeners object.
activate: function()
Activate the control.
initStack: function()
Called after the control is activated if the previous history stack is empty.
deactivate: function()
Deactivate the control.
Instances of ALKMaps.Map are interactive maps embedded in a web page.
Close