fix js scaling on startup

This commit is contained in:
RandomityGuy 2023-07-24 22:47:40 +05:30
parent 88cf03f3b5
commit 2b549ff328

View file

@ -51,6 +51,12 @@ class Main extends hxd.App {
#if js
var zoomRatio = Util.isTouchDevice() ? js.Browser.window.screen.height * js.Browser.window.devicePixelRatio / 768 : js.Browser.window.devicePixelRatio; // js.Browser.window.devicePixelRatio;
s2d.scaleMode = Zoom(zoomRatio);
Settings.zoomRatio = zoomRatio;
Settings.optionsSettings.screenWidth = cast js.Browser.window.screen.width; // 1024; // cast(js.Browser.window.innerWidth / js.Browser.window.innerHeight) * 768; // cast js.Browser.window.innerWidth * js.Browser.window.devicePixelRatio * 0.5;
Settings.optionsSettings.screenHeight = cast js.Browser.window.screen.height; // 768; // cast js.Browser.window.innerHeight * js.Browser.window.devicePixelRatio * 0.5;
var canvasElement = js.Browser.document.getElementById("webgl");
canvasElement.style.width = "100%";
canvasElement.style.height = "100%";
#end
#if android
var zoomRatio = Window.getInstance().height / 600;