User Image DynamicTexture with resize

when i use resize with Image in AdvancedDynamicTexture.
When the browser size changes, the image aspect ratio will still change.
Even if I use image STRETCH_ Uniform, the aspect ratio will still change
@babylonjs/core": "^4.2.0

const advancedTexture = AdvancedDynamicTexture.CreateFullscreenUI("UI");
    const image = new Image("CrossHair", "/CrossHair.png");
    image.width = "30px";
    image.height = "30px";
    // image.stretch = Image.STRETCH_UNIFORM;

    advancedTexture.addControl(image);
window.addEventListener('resize', this.getDimensions);
    getDimensions() {
      const bjsCanvas = this.$refs.bjsCanvas;
      
      if(bjsCanvas!=undefined){
        // console.log(document.documentElement.clientWidth,document.documentElement.clientHeight);
        // bjsCanvas.style.width = document.documentElement.clientWidth+"px";
        // bjsCanvas.style.height = document.documentElement.clientHeight+"px";
        bjsCanvas.width = document.documentElement.clientWidth;
        bjsCanvas.height = document.documentElement.clientHeight;
        
        // bjsCanvas.width = this.width;
        // bjsCanvas.height = this.height;
        if(myScene&&myScene.getEngine){
         myScene.getEngine().resize();
        }

      }
      
      
      
    }

Hello! Would you be able to provide us with a playground repro? :smiley:

it works right in playground
I don’t know if there is a problem with my adaptive resize
playground Adaptive resize is available by default

window.addEventListener(‘resize’, this.getDimensions);

Then could you provide a jsfiddle/codepen or any other kind of online repro?

When you are using the playground are you on the latest version (5.0) or 4.2?

I’m suggesting this because it could have been a bug that was fixed since.

I have created a new project, but it will still deform

The code is here

I played around with this. Seems like this works:

      //const bjsCanvas = this.$refs.bjsCanvas;
      //
      //if(bjsCanvas){
      //  console.log(document.documentElement.clientWidth,document.documentElement.clientHeight);
      //  bjsCanvas.style.width = document.documentElement.clientWidth+"px";
      //  bjsCanvas.style.height = document.documentElement.clientHeight+"px";
      //  bjsCanvas.width = document.documentElement.clientWidth;
      //  bjsCanvas.height = document.documentElement.clientHeight;
      //console.log(window.width,window.height);
      myScene.getEngine().setSize(document.documentElement.clientWidth, document.documentElement.clientHeight);
      //}

I have also worked locally. After testing, I found that setting the width and height of canvas style is not a good idea