# Convert scaling code to v3

**URL:** <https://phaser.discourse.group/t/convert-scaling-code-to-v3/11249>\
**Category:** Phaser 3\
**Created:** [February 15, 2022, 5:07am UTC](https://phaser.discourse.group/t/convert-scaling-code-to-v3/11249 "2022-02-15T05:07:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Un\_Gamer](https://avatars.discourse-cdn.com/v4/letter/u/a6a055/32.png) [@Un\_Gamer](https://phaser.discourse.group/u/Un_Gamer)\
**Post date:** [February 15, 2022, 5:07am UTC](https://phaser.discourse.group/t/convert-scaling-code-to-v3/11249/1 "2022-02-15T05:07:42Z")

</div>

Hello,  
I need help converting this code :

```javascript
setupStage() {
    this.scale.scaleMode = Phaser.ScaleManager.USER_SCALE;
    if (!isMobile) this.scale.setResizeCallback(this.scaleGame);
    this.scaleGame();
  }
scaleGame = () => {
    const padding = isMobile ? 0 : 80; // include padding around the canvas frame for desktop
    const yScale = (window.innerHeight - padding) / this.game.height;
    const scale = Math.min(yScale, 1);
    this.scale.setUserScale(scale, scale);
  };

```

to v3.

To code is from here : [Responsive phaser game](https://medium.com/@mattcolman/responsive-phaser-game-54a0e2dafba7)

Thank you.
