Skip to content

Navigable Minimap

  • Plugin name: "navigable_minimap"
  • Plugin namespace: "navigable_minimap"

Loading the plugin

var input_options = {
    container: "container-id",
    plugins: ["navigable_minimap"]
};

DVM.loadModule("map_viewer", input_options)
    .then(function(viewer) {
        start(viewer);
    })
    .catch(function(err) {
        console.error(err);
    });

function start(viewer) {
    var minimap_opts = {
        container: "minimap-container-id"
    };
    var minimap;
    viewer.navigable_minimap.createNavigableMinimap(minimap_opts)
        .then(function(_minimap) {
            minimap = _minimap;
         })
        .catch(function(err) {
            console.error(err);
        });
}

If this plugin is loaded, the module will have the following additional features:

Methods

createNavigableMinimap()

Creates a secondary instance of a viewer with a subset of methods that will be linked to the original module and will show a navigable minimap. This instance has special features that can be checked here.

Input

This method has as input the same object as when the module is loaded.

Output

Returns a promise that resolves in a minimap instance.

Example

var minimap_opts = {
    container: "minimap-container-id"
};

viewer.navigable_minimap.createNavigableMinimap(minimap_opts)
    .then(function(minimap) {
        // minimap instance
     })
    .catch(function(err) {
        console.error(err);
    });

getNavigableMinimap()

Returns the minimap instance if it has been created, or null if not.

Minimap instance has some particularities:

  • Camera is fixed showing the full map.

The following methods have been removed:

  • loadMap
  • bindInterfaceAction
  • goTo
  • focusOn
  • move
  • scaleBy

The following properties have been removed:

  • zoom_buttons_speed
  • navigation_buttons_speed
  • max_scaling_factor
  • min_scaling_factor

The following flags have been removed:

  • panning
  • zooming
  • automatic_hover
  • automatic_selection
  • variable_zoom_on_resize

Methods

loadMinimap

If the linked viewer instance has loaded a map, the minimap instance will try to load the minimap. Returns a promises that is resolved when the minimap finishes loading.

Warning

Not all maps have a minimap assigned. If a map has no minimap, then the instance won't load anything.

Example:
1
2
3
4
5
6
7
minimap.navigable_minimap.loadMinimap()
    .then(function() {
        // Minimap loaded
    })
    .catch(function(err) {
        // Minimap not loaded, probably doesn't exist
    });

flags

minimap_interactive

If true, it is possible to drag the minimap area to move the camera of the main instance.

Example:
minimap_instance.navigable_minimap.flags.minimap_interactive = true;

minimap_automatic_load

If true, the instance will manage when the minimap should load and when not. If false loadMinimap has to be called.

If automatic_load is enabled, you don't need to call loadMinimap but then you cannot use its promise to know when the minimap has finished loading. To cover this, you can use the end_load callback in the minimap instance.

Example:
minimap_instance.navigable_minimap.flags.minimap_automatic_load = true;