/**
 * View manager class
 *
 * @constructor FORGE.ViewManager
 * @param {FORGE.Viewer} viewer - {@link FORGE.Viewer} reference.
 * @extends {FORGE.BaseObject}
 */
FORGE.ViewManager = function(viewer)
{
    /**
     * The Viewer reference.
     * @name FORGE.ViewManager#_viewer
     * @type {FORGE.Viewer}
     * @private
     */
    this._viewer = viewer;

    /**
     * The current view reference
     * @name FORGE.ViewManager#_view
     * @type {FORGE.ViewBase}
     * @private
     */
    this._view = null;

    this._ready = false;

    /**
     * The view type to restore when the user quit VR mode
     * @name  FORGE.ViewManager#_viewTypeBackup
     * @type {String}
     * @private
     */
    this._viewTypeBackup = "";

    /**
     * Event dispatcher for view change.
     * @name FORGE.ViewManager#_onChange
     * @type {FORGE.EventDispatcher}
     * @private
     */
    this._onChange = null;


    FORGE.BaseObject.call(this, "ViewManager");
};

FORGE.ViewManager.prototype = Object.create(FORGE.BaseObject.prototype);
FORGE.ViewManager.prototype.constructor = FORGE.ViewManager;

/**
 * Init view with info contained in configuration
 * @method FORGE.RenderManager#_initView
 * @param {FORGE.SceneParser} sceneConfig - scene configuration
 * @private
 */
FORGE.ViewManager.prototype._setView = function(type)
{
    this.log("set View");

    if (this._view !== null && this._view.type === type)
    {
        return;
    }

    this._clearView();

    switch (type)
    {
        case FORGE.ViewType.GOPRO:
            this._view = new FORGE.ViewGoPro(this._viewer, this._viewer.camera);
            break;

        case FORGE.ViewType.RECTILINEAR:
        default:
            this._view = new FORGE.ViewRectilinear(this._viewer, this._viewer.camera);
            break;
    }

    this._ready = true;

    if(this._onChange !== null)
    {
        this._onChange.dispatch();
    }
};

FORGE.ViewManager.prototype._clearView = function()
{
    this.log("clear View");

    this._ready = false;

    if (this._view !== null)
    {
        this._view.destroy();
        this._view = null;
    }
};

FORGE.ViewManager.prototype.load = function(config)
{
    var sceneViewConfig = /** @type {ViewConfig} */ (config);
    var globalViewConfig = /** @type {ViewConfig} */ (this._viewer.config.view);
    var extendedViewConfig = /** @type {ViewConfig} */ (FORGE.Utils.extendMultipleObjects(globalViewConfig, sceneViewConfig));

    var type = (typeof extendedViewConfig.type === "string") ? extendedViewConfig.type.toLowerCase() : FORGE.ViewType.RECTILINEAR;

    this._setView(type);
};

/**
 * Get the current view object.
 * @name  FORGE.ViewManager#current
 * @type {FORGE.ViewBase}
 * @readonly
 */
Object.defineProperty(FORGE.ViewManager.prototype, "current",
{
    /** @this {FORGE.ViewManager} */
    get: function()
    {
        return this._view;
    }
});

/**
 * Get the view ready flag.
 * @name  FORGE.ViewManager#ready
 * @type {boolean}
 * @readonly
 */
Object.defineProperty(FORGE.ViewManager.prototype, "ready",
{
    /** @this {FORGE.ViewManager} */
    get: function()
    {
        return this._ready;
    }
});

/**
 * Get and set the current view type.
 * @name  FORGE.ViewManager#type
 * @type {string}
 */
Object.defineProperty(FORGE.ViewManager.prototype, "type",
{
    /** @this {FORGE.ViewManager} */
    get: function()
    {
        return (this._view !== null) ? this._view.type : null;
    },

    /** @this {FORGE.ViewManager} */
    set: function(value)
    {
        this._setView(value);
    }
});

/**
 * Get the onChange {@link FORGE.EventDispatcher}.
 * @name  FORGE.ViewManager#onChange
 * @type {FORGE.EventDispatcher}
 * @readonly
 */
Object.defineProperty(FORGE.ViewManager.prototype, "onChange",
{
    /** @this {FORGE.ViewManager} */
    get: function()
    {
        if (this._onChange === null)
        {
            this._onChange = new FORGE.EventDispatcher(this);
        }

        return this._onChange;
    }
});
@@ -509,16 +509,111 @@
  null;%0A%0A
+    /**%0A     * Ready flag%0A     * @name FORGE.ViewManager#_ready%0A     * @type %7Bboolean%7D%0A     */%0A
     this
@@ -625,24 +625,24 @@
 dy = false;%0A
-
 %0A    /**%0A   
@@ -759,17 +759,17 @@
  @type %7B
-S
+s
 tring%7D%0A 
@@ -1201,54 +1201,25 @@
 %0A * 
-Init view with info contained in configuration
+Set the view type
 %0A * 
@@ -1236,14 +1236,12 @@
 RGE.
-Render
+View
 Mana
@@ -1249,11 +1249,10 @@
 er#_
-ini
+se
 tVie
@@ -1268,60 +1268,50 @@
 am %7B
-FORGE.SceneParser%7D sceneConfig - scene configuration
+string%7D type - The type of the view to set
 %0A * 
@@ -1383,35 +1383,8 @@
 )%0A%7B%0A
-    this.log(%22set View%22);%0A%0A
     
@@ -1485,24 +1485,57 @@
 earView();%0A%0A
+    this.log(%22set view %22+type);%0A%0A
     switch (
@@ -1953,32 +1953,110 @@
 ch();%0A    %7D%0A%7D;%0A%0A
+/**%0A * Clear the view%0A * @method FORGE.ViewManager#_clearView%0A * @private%0A */%0A
 FORGE.ViewManage
@@ -2097,37 +2097,8 @@
 )%0A%7B%0A
-    this.log(%22clear View%22);%0A%0A
     
@@ -2146,32 +2146,65 @@
 !== null)%0A    %7B%0A
+        this.log(%22clear view%22);%0A%0A
         this._vi
@@ -2250,24 +2250,178 @@
 ;%0A    %7D%0A%7D;%0A%0A
+/**%0A * Load a view configuration%0A * @method FORGE.ViewManager#load%0A * @param  %7BViewConfig%7D config - The configuration of the view to load%0A * @private%0A */%0A
 FORGE.ViewMa

Clean and doc on the ViewManager