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
      (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
  • Safari
  • FIrefox
  • iPad (iOS 9.3)

The console logs the pixelRatio calculated

Author: Fantashit

1 thought on “setPixelRatio scales the viewport on iPad

Comments are closed.