toggleEnlargedMode(type) {

    if (!this.isInSidebar && type === 'halfscreen') {
      return;
    }

    this.logger('log', 'Toggled graph enlargement');

    const enlargedMode = this.enlargedMode;

    // in any case, exit enlarged mode if active
    if (enlargedMode) {

      // reset click to use
      this.network.setOptions({ clickToUse: this.clickToUse });

      // remove markers
      utils.findAndRemoveClassNames([
        `tmap-has-${enlargedMode}-widget`,
        `tmap-${enlargedMode}`
      ]);

      // reset flag
      this.enlargedMode = null;
      document.body.scrollTop = this.scrollTop;
    }

    if (!enlargedMode
       || (enlargedMode !== type
           && (type === 'fullscreen'
               || (type === 'halfscreen' && !this.isInSidebar)))) {

      this.scrollTop = document.body.scrollTop;

      this.enlargedMode = type;

      const pContainer = (this.isInSidebar
                        ? this.sidebar
                        : utils.getFirstElementByClassName('tc-story-river'));

      $tw.utils.addClass(this.document.body, `tmap-has-${type}-widget`);
      $tw.utils.addClass(pContainer, `tmap-has-${type}-widget`);
      $tw.utils.addClass(this.domNode, `tmap-${type}`);

      // disable click to use by force
      this.network.setOptions({ clickToUse: false });

      $tm.notify(`Toggled ${type} mode`);

    }

    // always do resize
    this.handleResizeEvent();

  }
Calling this function will toggle the enlargement of the map
instance. Markers need to be added at various places to ensure the
map stretches properly. This includes marking ancestor dom nodes
to be able to shift the stacking context.

@param {string} type - either 'halfscreen' or 'fullscreen'.