setPixelRatio scales the viewport on iPad

Description of the problem

In my app I change the frameratio in runtime in order to avoid slow performances on slow devices. My code looks like this:

if (this.fps.frame %% this.fps.framerate === 0) {
   // set the framerate in runtime each second
   this.renderer.setPixelRatio(
      (window.devicePixelRatio || 1) * Math.max(this.fps.framerate / 60, 0.2)
   );
}

This code works beautifully on all browsers on desktop however on iPads the viewport gets somehow scaled even if the canvas stays of the same size. Side note: this problem does not appear using the CanvasRenderer.

Three.js version
  • r74 up to r79
Browser
  • Safari
  • FIrefox
OS
  • iPad (iOS 9.3)
Screenshot

The console logs the pixelRatio calculated
acvebn4p7n

Author: Fantashit

1 thought on “setPixelRatio scales the viewport on iPad

Comments are closed.