[ts][webgl] Use devicePixelRatio for hdpi screens

This commit is contained in:
Mario Zechner 2021-06-22 23:50:04 +02:00
parent 6c689eb5f8
commit e6e2c95b2c
8 changed files with 17 additions and 12 deletions

View File

@ -10674,8 +10674,9 @@ var spine;
};
SceneRenderer.prototype.resize = function (resizeMode) {
var canvas = this.canvas;
var w = canvas.clientWidth;
var h = canvas.clientHeight;
var dpr = window.devicePixelRatio || 1;
var w = Math.round(canvas.clientWidth * dpr);
var h = Math.round(canvas.clientHeight * dpr);
if (canvas.width != w || canvas.height != h) {
canvas.width = w;
canvas.height = h;

File diff suppressed because one or more lines are too long

View File

@ -10424,8 +10424,9 @@ var spine;
};
SceneRenderer.prototype.resize = function (resizeMode) {
var canvas = this.canvas;
var w = canvas.clientWidth;
var h = canvas.clientHeight;
var dpr = window.devicePixelRatio || 1;
var w = Math.round(canvas.clientWidth * dpr);
var h = Math.round(canvas.clientHeight * dpr);
if (canvas.width != w || canvas.height != h) {
canvas.width = w;
canvas.height = h;

File diff suppressed because one or more lines are too long

View File

@ -10424,8 +10424,9 @@ var spine;
};
SceneRenderer.prototype.resize = function (resizeMode) {
var canvas = this.canvas;
var w = canvas.clientWidth;
var h = canvas.clientHeight;
var dpr = window.devicePixelRatio || 1;
var w = Math.round(canvas.clientWidth * dpr);
var h = Math.round(canvas.clientHeight * dpr);
if (canvas.width != w || canvas.height != h) {
canvas.width = w;
canvas.height = h;

File diff suppressed because one or more lines are too long

View File

@ -15,7 +15,7 @@ body {
</style>
<body>
<div id="container" style="width:640px; height:380px"></div>
<div id="container" style="width:100%; height:100px"></div>
<div id="container-raptor" style="width:640px; height:380px"></div>
<div>
<button id="walk">Walk</button>

View File

@ -447,8 +447,10 @@ module spine.webgl {
resize (resizeMode: ResizeMode) {
let canvas = this.canvas;
var w = canvas.clientWidth;
var h = canvas.clientHeight;
var dpr = window.devicePixelRatio || 1;
var w = Math.round(canvas.clientWidth * dpr);
var h = Math.round(canvas.clientHeight * dpr);
if (canvas.width != w || canvas.height != h) {
canvas.width = w;
canvas.height = h;