This commit is contained in:
Bill 2022-04-05 02:59:41 -04:00
parent c67c2c34de
commit 514581a2b4
2 changed files with 14 additions and 8 deletions

View File

@ -114,10 +114,10 @@ export class Nitro extends Application implements INitro
canvas.className = 'client-canvas';
const instance = new this(new NitroCore(), {
autoDensity: true,
resolution: window.devicePixelRatio,
width: window.innerWidth,
height: window.innerHeight,
autoDensity: false,
resolution: 1,
width: window.innerWidth * window.devicePixelRatio,
height: window.innerHeight * window.devicePixelRatio,
view: canvas
});
@ -400,12 +400,12 @@ export class Nitro extends Application implements INitro
public get width(): number
{
return (this.renderer.width / this.renderer.resolution);
return this.renderer.width;
}
public get height(): number
{
return (this.renderer.height / this.renderer.resolution);
return this.renderer.height;
}
public get ticker(): Ticker

View File

@ -1519,6 +1519,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
if(!screenPoint) return null;
screenPoint.x = Math.round(screenPoint.x);
screenPoint.y = Math.round(screenPoint.y);
rectangle.x = (rectangle.x * scale);
rectangle.y = (rectangle.y * scale);
rectangle.width = (rectangle.width * scale);
@ -1532,8 +1535,8 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
if(!canvas) return null;
rectangle.x += ((canvas.width / 2) + canvas.screenOffsetX);
rectangle.y += ((canvas.height / 2) + canvas.screenOffsetY);
rectangle.x += (Math.round(canvas.width / 2) + canvas.screenOffsetX);
rectangle.y += (Math.round(canvas.height / 2) + canvas.screenOffsetY);
return rectangle;
}
@ -2732,6 +2735,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
screenPoint.x += ((renderingCanvas.width / 2) + renderingCanvas.screenOffsetX);
screenPoint.y += ((renderingCanvas.height / 2) + renderingCanvas.screenOffsetY);
screenPoint.x = Math.round(screenPoint.x);
screenPoint.y = Math.round(screenPoint.y);
return screenPoint;
}