setSize(width = this.options.width, height = this.options.height) {
    width = this._prepareValue(width);
    height = this._prepareValue(height);

    let emitEvent = false;
    const oldWidth = this.frame.canvas.width;
    const oldHeight = this.frame.canvas.height;

    // update the pixel ratio
    //
    // NOTE: Comment in following is rather inconsistent; this is the ONLY place in the code
    //       where it is assumed that the pixel ratio could change at runtime.
    //       The only way I can think of this happening is a rotating screen or tablet; but then
    //       there should be a mechanism for reloading the data (TODO: check if this is present).
    //
    //       If the assumption is true (i.e. pixel ratio can change at runtime), then *all* usage
    //       of pixel ratio must be overhauled for this.
    //
    //       For the time being, I will humor the assumption here, and in the rest of the code assume it is
    //       constant.
    const previousRatio = this.pixelRatio; // we cache this because the camera state storage needs the old value
    this._setPixelRatio();

    if (
      width != this.options.width ||
      height != this.options.height ||
      this.frame.style.width != width ||
      this.frame.style.height != height
    ) {
      this._getCameraState(previousRatio);

      this.frame.style.width = width;
      this.frame.style.height = height;

      this.frame.canvas.style.width = "100%";
      this.frame.canvas.style.height = "100%";

      this.frame.canvas.width = Math.round(
        this.frame.canvas.clientWidth * this.pixelRatio
      );
      this.frame.canvas.height = Math.round(
        this.frame.canvas.clientHeight * this.pixelRatio
      );

      this.options.width = width;
      this.options.height = height;

      this.canvasViewCenter = {
        x: 0.5 * this.frame.clientWidth,
        y: 0.5 * this.frame.clientHeight,
      };

      emitEvent = true;
    } else {
      // this would adapt the width of the canvas to the width from 100% if and only if
      // there is a change.

      const newWidth = Math.round(
        this.frame.canvas.clientWidth * this.pixelRatio
      );
      const newHeight = Math.round(
        this.frame.canvas.clientHeight * this.pixelRatio
      );

      // store the camera if there is a change in size.
      if (
        this.frame.canvas.width !== newWidth ||
        this.frame.canvas.height !== newHeight
      ) {
        this._getCameraState(previousRatio);
      }

      if (this.frame.canvas.width !== newWidth) {
        this.frame.canvas.width = newWidth;
        emitEvent = true;
      }
      if (this.frame.canvas.height !== newHeight) {
        this.frame.canvas.height = newHeight;
        emitEvent = true;
      }
    }

    if (emitEvent === true) {
      this.body.emitter.emit("resize", {
        width: Math.round(this.frame.canvas.width / this.pixelRatio),
        height: Math.round(this.frame.canvas.height / this.pixelRatio),
        oldWidth: Math.round(oldWidth / this.pixelRatio),
        oldHeight: Math.round(oldHeight / this.pixelRatio),
      });

      // restore the camera on change.
      this._setCameraState();
    }

    // set initialized so the get and set camera will work from now on.
    this.initialized = true;
    return emitEvent;
  }
Set a new size for the network
@param {string} width   Width in pixels or percentage (for example '800px'
                        or '50%')
@param {string} height  Height in pixels or percentage  (for example '400px'
                        or '30%')
@returns {boolean}