File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -774,11 +774,13 @@ export class AdvancedDynamicTexture extends DynamicTexture {
774
774
const size = this . getSize ( ) ;
775
775
const globalViewPort = this . _fullscreenViewport . toGlobal ( size . width , size . height ) ;
776
776
777
- const targetX = Math . round ( globalViewPort . width * ( 1 / this . rootContainer . scaleX ) ) ;
778
- const targetY = Math . round ( globalViewPort . height * ( 1 / this . rootContainer . scaleY ) ) ;
777
+ const targetX = Math . round ( globalViewPort . width / this . _rootContainer . scaleX ) ;
778
+ const targetY = Math . round ( globalViewPort . height / this . _rootContainer . scaleY ) ;
779
779
780
- globalViewPort . x += ( globalViewPort . width - targetX ) / 2 ;
781
- globalViewPort . y += ( globalViewPort . height - targetY ) / 2 ;
780
+ const scale = this . _adjustToEngineHardwareScalingLevel ? this . _renderScale / ( this . getScene ( ) ?. getEngine ( ) . getHardwareScalingLevel ( ) || 1 ) : 1 ;
781
+
782
+ globalViewPort . x += ( globalViewPort . width / scale - targetX ) / 2 ;
783
+ globalViewPort . y += ( globalViewPort . height / scale - targetY ) / 2 ;
782
784
783
785
globalViewPort . width = targetX ;
784
786
globalViewPort . height = targetY ;
You can’t perform that action at this time.
0 commit comments