react-simple-game-engine 0.1.89 → 0.1.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/classes/p5.js +2 -2
- package/lib/ui-components/scene-runner.js +2 -9
- package/lib/utils.d.ts +10 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +12 -0
- package/package.json +1 -1
package/lib/classes/p5.js
CHANGED
@@ -39,14 +39,14 @@ var P5 = /** @class */ (function (_super) {
|
|
39
39
|
});
|
40
40
|
Object.defineProperty(P5.prototype, "gameMouseX", {
|
41
41
|
get: function () {
|
42
|
-
return this.mouseX - this.scaler.deltaOfScaleForUI.x;
|
42
|
+
return this.mouseX / this.scaler.value - this.scaler.deltaOfScaleForUI.x;
|
43
43
|
},
|
44
44
|
enumerable: false,
|
45
45
|
configurable: true
|
46
46
|
});
|
47
47
|
Object.defineProperty(P5.prototype, "gameMouseY", {
|
48
48
|
get: function () {
|
49
|
-
return this.mouseY - this.scaler.deltaOfScaleForUI.y;
|
49
|
+
return this.mouseY / this.scaler.value - this.scaler.deltaOfScaleForUI.y;
|
50
50
|
},
|
51
51
|
enumerable: false,
|
52
52
|
configurable: true
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
12
12
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
13
13
|
import { useEffect, useMemo, useRef, useState, } from "react";
|
14
14
|
import { Sketch } from "./sketch";
|
15
|
-
import { useWindowSize } from "../utils";
|
15
|
+
import { getDisabledIOSHighlightProperties, useWindowSize } from "../utils";
|
16
16
|
import { LayoutMode } from "../export-enums";
|
17
17
|
import { Scaler } from "../classes/scaler";
|
18
18
|
export function SceneRunner(_a) {
|
@@ -54,19 +54,12 @@ export function SceneRunner(_a) {
|
|
54
54
|
}
|
55
55
|
return (AssetsLoader !== null && AssetsLoader !== void 0 ? AssetsLoader : _jsx("div", { children: "Assets loading..." }));
|
56
56
|
}, [AssetsLoader]);
|
57
|
-
return (_jsxs("div", __assign({ style: {
|
58
|
-
width: windowSize.width,
|
59
|
-
height: windowSize.height,
|
60
|
-
overflow: "hidden",
|
61
|
-
position: "relative",
|
62
|
-
boxSizing: "border-box",
|
63
|
-
} }, { children: [current.loadedAssets && (_jsx(Sketch, { onSetup: setup, onDraw: draw, scaler: refScaler.current })), _jsx("div", __assign({ style: {
|
57
|
+
return (_jsxs("div", __assign({ style: __assign({ width: windowSize.width, height: windowSize.height, overflow: "hidden", position: "relative", boxSizing: "border-box" }, getDisabledIOSHighlightProperties()) }, { children: [current.loadedAssets && (_jsx(Sketch, { onSetup: setup, onDraw: draw, scaler: refScaler.current })), _jsx("div", __assign({ style: {
|
64
58
|
position: "absolute",
|
65
59
|
top: 0,
|
66
60
|
left: 0,
|
67
61
|
width: "100%",
|
68
62
|
height: "100%",
|
69
|
-
userSelect: "none",
|
70
63
|
zIndex: 2,
|
71
64
|
} }, { children: _jsx("div", __assign({ style: __assign({ width: width, height: height, transform: "scale(".concat(refScaler.current.value, ")"), transformOrigin: "left top", position: "relative" }, (function () {
|
72
65
|
var deltaOfScaleForUI = refScaler.current.deltaOfScaleForUI;
|
package/lib/utils.d.ts
CHANGED
@@ -13,4 +13,14 @@ export declare function useWindowSize(): {
|
|
13
13
|
width: number;
|
14
14
|
height: number;
|
15
15
|
};
|
16
|
+
export declare function getDisabledIOSHighlightProperties(): {
|
17
|
+
"-webkit-touch-callout": string;
|
18
|
+
"-webkit-tap-highlight-color": string;
|
19
|
+
"-moz-user-select": string;
|
20
|
+
"-webkit-user-select": string;
|
21
|
+
"-ms-user-select": string;
|
22
|
+
"user-select": string;
|
23
|
+
"text-size-adjust": string;
|
24
|
+
"touch-callout": string;
|
25
|
+
};
|
16
26
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[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CACpC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,KAAK,CAAC,CAWhB;AAED,wBAAsB,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,oBAQxC;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAO5B;AAED,wBAAsB,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAC3C,KAAK,EAAE,CAAC,EAAE,EACV,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EACtE,KAAK,SAAI,GACR,OAAO,CAAC,CAAC,EAAE,CAAC,CAkBd;AAED,wBAAgB,aAAa;;;EAiB5B;AAED,wBAAgB,iCAAiC;;;;;;;;;EAWhD"}
|
package/lib/utils.js
CHANGED
@@ -155,3 +155,15 @@ export function useWindowSize() {
|
|
155
155
|
}, []);
|
156
156
|
return size;
|
157
157
|
}
|
158
|
+
export function getDisabledIOSHighlightProperties() {
|
159
|
+
return {
|
160
|
+
"-webkit-touch-callout": "none",
|
161
|
+
"-webkit-tap-highlight-color": "transparent",
|
162
|
+
"-moz-user-select": "-moz-none",
|
163
|
+
"-webkit-user-select": "none",
|
164
|
+
"-ms-user-select": "none",
|
165
|
+
"user-select": "none",
|
166
|
+
"text-size-adjust": "none",
|
167
|
+
"touch-callout": "none",
|
168
|
+
};
|
169
|
+
}
|