drawImageAtPosition(ctx, factor, left, top, width, height) {
    if (!this.initialized()) return; //can't draw image yet not intialized

    if (factor > 2) {
      // Determine which zoomed image to use
      factor *= 0.5;
      let iterations = 0;
      while (factor > 2 && iterations < this.NUM_ITERATIONS) {
        factor *= 0.5;
        iterations += 1;
      }

      if (iterations >= this.NUM_ITERATIONS) {
        iterations = this.NUM_ITERATIONS - 1;
      }
      //console.log("iterations: " + iterations);

      const from = this.coordinates[iterations];
      ctx.drawImage(
        this.canvas,
        from[0],
        from[1],
        from[2],
        from[3],
        left,
        top,
        width,
        height
      );
    } else {
      // Draw image directly
      ctx.drawImage(this.image, left, top, width, height);
    }
  }
Draw the image, using the mipmap if necessary.

MipMap is only used if param factor > 2; otherwise, original bitmap
is resized. This is also used to skip mipmap usage, e.g. by setting factor = 1

Credits to 'Alex de Mulder' for original implementation.
@param {CanvasRenderingContext2D} ctx  context on which to draw zoomed image
@param {Float} factor scale factor at which to draw
@param {number} left
@param {number} top
@param {number} width
@param {number} height