# Changing hardware scaling level breaks AdvancedDynamicTexture control alignment

**URL:** <https://forum.babylonjs.com/t/changing-hardware-scaling-level-breaks-advanceddynamictexture-control-alignment/10252>\
**Category:** Bugs\
**Created:** [April 23, 2020, 1:25pm UTC](https://forum.babylonjs.com/t/changing-hardware-scaling-level-breaks-advanceddynamictexture-control-alignment/10252 "2020-04-23T13:25:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![irinel.pascu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/irinel.pascu/32/7799_2.png) [@irinel.pascu](https://forum.babylonjs.com/u/irinel.pascu)\
**Post date:** [April 23, 2020, 1:25pm UTC](https://forum.babylonjs.com/t/changing-hardware-scaling-level-breaks-advanceddynamictexture-control-alignment/10252/1 "2020-04-23T13:25:35Z")

</div>

In order to get crisper UI, I added:  
`engine.setHardwareScalingLevel(1 / window.devicePixelRatio);`  
and  
` this.advancedTexture.rootContainer.scaleX = window.devicePixelRatio; this.advancedTexture.rootContainer.scaleY = window.devicePixelRatio;`  
and now when changing the verticalAlignment and horizontalAlignment, the control (in my case, a button) it is offset outside the screen relative to the viewport size  
` button1.verticalAlignment = BABYLON.GUI.Control.VERTICAL_ALIGNMENT_TOP; button1.horizontalAlignment = BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_LEFT; button1.topInPixels = 0; button1.leftInPixels = 0;`  
Is this normal? How can I avoid this and still have the above button placed in the corner?

[https://www.babylonjs-playground.com/#2ARI2W#42](https://www.babylonjs-playground.com/#2ARI2W#42) // uncomment the 2 alignment lines and watch the button disappear. uncomment the top and left position lines to see the

---

<div class="post-metadata">

**Author:** ![irinel.pascu](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/irinel.pascu/32/7799_2.png) [@irinel.pascu](https://forum.babylonjs.com/u/irinel.pascu)\
**Post date:** [April 23, 2020, 1:33pm UTC](https://forum.babylonjs.com/t/changing-hardware-scaling-level-breaks-advanceddynamictexture-control-alignment/10252/2 "2020-04-23T13:33:55Z")

</div>

setting this fixes the issue. Is it a good idea?  
` advancedTexture.rootContainer.top = 100 / window.devicePixelRatio + "%"; advancedTexture.rootContainer.left = 100 / window.devicePixelRatio + "%";`

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [April 23, 2020, 3:35pm UTC](https://forum.babylonjs.com/t/changing-hardware-scaling-level-breaks-advanceddynamictexture-control-alignment/10252/3 "2020-04-23T15:35:30Z")

</div>

This seems perfectly fine;)
