Skip to content

Commit

Permalink
chore: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
triniwiz committed Oct 28, 2023
1 parent 1ea27c0 commit c6121db
Show file tree
Hide file tree
Showing 85 changed files with 6,489 additions and 2,209 deletions.
2 changes: 1 addition & 1 deletion apps/demo/src/plugin-demos/canvas.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</ActionBar>
</Page.actionBar>

<GridLayout backgroundColor="red" rows="*" columns="*" loaded="{{ gridLoaded }}" iosOverflowSafeArea="false" width="100%" height="100%">
<GridLayout rows="*" columns="*" loaded="{{ gridLoaded }}" iosOverflowSafeArea="false" width="100%" height="100%">

<!-- <ui:Dom rowSpan="2" colSpan="2"> -->

Expand Down
6 changes: 3 additions & 3 deletions packages/canvas-phaser-ce/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ export default function Game({ canvas, width = null, height = null, renderer = 2
(global as any).document.readyState = 'complete';

const config = {
width: width || realWidth,
height: height || realHeight,
width: (width || realWidth) * window.devicePixelRatio,
height: (height || realHeight) * window.devicePixelRatio,
renderer: renderer || 2,
title: title || 'tns-phaser-game',
state: state || null,
transparent: transparent || false,
antialias: antialias || true,
physicsConfig: physicsConfig || null,
canvas,
canvas
};

const game = new Phaser.Game(config);
Expand Down
4 changes: 4 additions & 0 deletions packages/canvas-polyfill/DOM/HTMLCanvasElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ export class HTMLCanvasElement extends Element {
getContext(contextType, contextOptions) {
return this._canvas.getContext(contextType, contextOptions);
}

setPointerCapture(id) {}

releasePointerCapture(id) {}
}
10 changes: 6 additions & 4 deletions packages/canvas-polyfill/resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { Application } from '@nativescript/core';
*/

const scale = Screen.mainScreen.scale;
const screenWidth = Screen.mainScreen.widthPixels;
const screenHeight = Screen.mainScreen.heightPixels;
(global as any).window.devicePixelRatio = (global as any).devicePixelRatio = 1;
// const screenWidth = Screen.mainScreen.widthPixels;
// const screenHeight = Screen.mainScreen.heightPixels;
const screenWidth = Screen.mainScreen.widthDIPs;
const screenHeight = Screen.mainScreen.heightDIPs;
(global as any).window.devicePixelRatio = (global as any).devicePixelRatio = scale; //1;
(global as any).window.innerWidth = (global as any).innerWidth = screenWidth;
(global as any).window.clientWidth = (global as any).clientWidth = screenWidth;
(global as any).window.innerHeight = (global as any).innerHeight = screenHeight;
Expand All @@ -24,7 +26,7 @@ if (!(global as any).__TNS_BROWSER_POLYFILL_RESIZE) {
const width = portrait ? screenWidth : screenHeight;
const height = portrait ? screenHeight : screenWidth;

(global as any).window.devicePixelRatio = (global as any).devicePixelRatio = 1;
(global as any).window.devicePixelRatio = (global as any).devicePixelRatio = scale; //1;
(global as any).window.innerWidth = (global as any).innerWidth = width;
(global as any).window.clientWidth = (global as any).clientWidth = width;
(global as any).window.innerHeight = (global as any).innerHeight = height;
Expand Down
Loading

0 comments on commit c6121db

Please sign in to comment.