Navigating the map history

Mapping undo/redo is very easy to implement with Dracones. You must provide an history size and optionaly, UI controls to bind both calls (the controls' disabled attribute will be modified automatically):

var map_widget = new dracones.MapWidget({
    anchor_elem: 'anchor_div', 
    app_name: '<app_name>', 
    mid: '<map_instance_name>', 
    map: '<mapfile>', 
    init_dlayers: ['region', 'info_marker'],
    history_size: 5,
    undo_control_id: '<undo_control_id>',
    redo_control_id: '<redo_control_id>'

If the UI control IDs are not supplied, you can perform a manual call to dracones.MapWidget.history, which however must be used with caution, since it does not perform history "bound" checking (the can_undo and can_redo variables in the JSON response returning from any call can easily be used for this, though). Here is an example using a map that we defined in a previous tutorial: