From ee76c41a2b5b4813b67ac0e45453f981ab6a5430 Mon Sep 17 00:00:00 2001 From: Uwe Oestermeier Date: Mon, 27 May 2024 13:52:15 +0200 Subject: [PATCH] Fixed resolution problems. --- lib/pixi/app.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/pixi/app.js b/lib/pixi/app.js index 67d004e..ed930b3 100644 --- a/lib/pixi/app.js +++ b/lib/pixi/app.js @@ -71,7 +71,7 @@ export default class PIXIApp extends PIXI.Application { * @param {HTMLElement} [opts.view] - The canvas HTML element. If not set, a render-element is added inside the body. * @param {boolean} [opts.transparent=true] - Should the render view be transparent? * @param {boolean} [opts.antialias=true] - Sets antialias (only applicable in chrome at the moment). - * @param {number} [opts.resolution=window.devicePixelRatio | 1] - The resolution / device pixel ratio of the renderer, retina would be 2. + * @param {number} [opts.resolution=window.devicePixelRatio || 1] - The resolution / device pixel ratio of the renderer, retina would be 2. * @param {boolean} [opts.autoResize=true] - Should the canvas-element be resized automatically if the resolution was set? * @param {number} [opts.backgroundColor=0x282828] - The color of the background. * @param {string|Theme} [opts.theme=dark] - The name of the theme (dark, light, red) or a Theme object to use for styling. @@ -81,6 +81,7 @@ export default class PIXIApp extends PIXI.Application { * @param {boolean} [opts.roundPixels=true] - Align PIXI.DisplayObject coordinates to screen resolution. * @param {boolean} [opts.monkeyPatchMapping=true] - Monkey patch for canvas fullscreen support on large displays. * @param {boolean} [opts.adaptive=true] - Adds Graphics adaptive calculation of quadratic curve and arc subdivision. + * @param {boolean} [opts.autoDensity=true] - Automatically adapts width to devicePixelRation */ constructor({ width = null, @@ -90,7 +91,7 @@ export default class PIXIApp extends PIXI.Application { backgroundColor = 0x282828, theme = 'dark', antialias = true, - resolution = 1, + resolution = window.devicePixelRatio || 1, // Needed for text resolution https://www.html5gamedevs.com/topic/46418-text-and-resolution/ autoResize = true, fpsLogging = false, progress = {}, @@ -98,7 +99,8 @@ export default class PIXIApp extends PIXI.Application { roundPixels = true, monkeyPatchMapping = true, adaptive = true, - graphql = false + graphql = false, + autoDensity = true // Needed for text resolution https://www.html5gamedevs.com/topic/46418-text-and-resolution/ }) { const fullScreen = !width || !height @@ -116,7 +118,8 @@ export default class PIXIApp extends PIXI.Application { resolution, autoResize, backgroundColor, - forceCanvas + forceCanvas, + autoDensity }) this.width = width