@hkdigital/lib-core 0.5.30 → 0.5.31
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.
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
* snippetPortrait?: GameBoxSnippet,
|
|
54
54
|
* snippetRequireFullscreen?: GameBoxSnippet,
|
|
55
55
|
* snippetInstallOnHomeScreen?: GameBoxSnippet,
|
|
56
|
+
* debug?: boolean,
|
|
56
57
|
* [attr: string]: any
|
|
57
58
|
* }}
|
|
58
59
|
*/
|
|
@@ -84,7 +85,9 @@
|
|
|
84
85
|
snippetLandscape,
|
|
85
86
|
snippetPortrait,
|
|
86
87
|
snippetRequireFullscreen,
|
|
87
|
-
snippetInstallOnHomeScreen
|
|
88
|
+
snippetInstallOnHomeScreen,
|
|
89
|
+
|
|
90
|
+
debug = false
|
|
88
91
|
} = $props();
|
|
89
92
|
|
|
90
93
|
// > Game dimensions and state
|
|
@@ -149,9 +152,15 @@
|
|
|
149
152
|
isLandscape = !isPortraitMedia;
|
|
150
153
|
});
|
|
151
154
|
|
|
152
|
-
// $inspect
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
// Use $effect for conditional debugging instead of $inspect
|
|
156
|
+
$effect(() => {
|
|
157
|
+
if (debug) {
|
|
158
|
+
console.log('[GameBox] isLandscape:', isLandscape);
|
|
159
|
+
console.log('[GameBox] windowWidth/Height:', windowWidth, windowHeight);
|
|
160
|
+
console.log('[GameBox] iosWindowWidth/Height:',
|
|
161
|
+
iosWindowWidth, iosWindowHeight);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
155
164
|
|
|
156
165
|
// Update game dimensions based on window size and orientation
|
|
157
166
|
$effect(() => {
|
|
@@ -163,12 +172,15 @@
|
|
|
163
172
|
const availWidth = width - marginLeft - marginRight;
|
|
164
173
|
const availHeight = height - marginTop - marginBottom;
|
|
165
174
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
175
|
+
if( debug )
|
|
176
|
+
{
|
|
177
|
+
console.debug('GameBox margins:', {
|
|
178
|
+
marginLeft,
|
|
179
|
+
marginRight,
|
|
180
|
+
marginTop,
|
|
181
|
+
marginBottom
|
|
182
|
+
});
|
|
183
|
+
}
|
|
172
184
|
|
|
173
185
|
if (availWidth > availHeight) {
|
|
174
186
|
gameWidthOnLandscape = getGameWidthOnLandscape({
|
|
@@ -231,13 +243,17 @@
|
|
|
231
243
|
iosWindowWidth = window.innerWidth;
|
|
232
244
|
iosWindowHeight = window.innerHeight;
|
|
233
245
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
246
|
+
|
|
247
|
+
if( debug )
|
|
248
|
+
{
|
|
249
|
+
console.debug('updateIosWidthHeight', {
|
|
250
|
+
angle,
|
|
251
|
+
'window.innerWidth': window.innerWidth,
|
|
252
|
+
'window.innerHeight': window.innerHeight,
|
|
253
|
+
iosWindowWidth,
|
|
254
|
+
iosWindowHeight
|
|
255
|
+
});
|
|
256
|
+
}
|
|
241
257
|
}
|
|
242
258
|
}
|
|
243
259
|
|
|
@@ -271,21 +287,24 @@
|
|
|
271
287
|
// App visibility detection for iOS debugging
|
|
272
288
|
const handleVisibilityChange = () => {
|
|
273
289
|
if (document.visibilityState === 'visible') {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
290
|
+
|
|
291
|
+
if( debug ) {
|
|
292
|
+
console.log('App became visible:', {
|
|
293
|
+
'window.innerWidth': window.innerWidth,
|
|
294
|
+
'window.innerHeight': window.innerHeight,
|
|
295
|
+
'screen.width': screen.width,
|
|
296
|
+
'screen.height': screen.height,
|
|
297
|
+
'screen.orientation.angle': screen.orientation.angle,
|
|
298
|
+
'screen.orientation.type': screen.orientation.type,
|
|
299
|
+
'matchMedia portrait':
|
|
300
|
+
window.matchMedia('(orientation: portrait)').matches,
|
|
301
|
+
'isLandscape': isLandscape,
|
|
302
|
+
'gameWidth': gameWidth,
|
|
303
|
+
'gameHeight': gameHeight,
|
|
304
|
+
'iosWindowWidth': iosWindowWidth,
|
|
305
|
+
'iosWindowHeight': iosWindowHeight
|
|
306
|
+
});
|
|
307
|
+
}
|
|
289
308
|
|
|
290
309
|
// Force iOS dimension update when app becomes visible
|
|
291
310
|
if (isPwa && isAppleMobile) {
|
|
@@ -45,6 +45,7 @@ type GameBox = {
|
|
|
45
45
|
snippetPortrait?: Snippet<[SnippetParams]> | undefined;
|
|
46
46
|
snippetRequireFullscreen?: Snippet<[SnippetParams]> | undefined;
|
|
47
47
|
snippetInstallOnHomeScreen?: Snippet<[SnippetParams]> | undefined;
|
|
48
|
+
debug?: boolean | undefined;
|
|
48
49
|
}>): void;
|
|
49
50
|
};
|
|
50
51
|
declare const GameBox: import("svelte").Component<{
|
|
@@ -91,4 +92,5 @@ declare const GameBox: import("svelte").Component<{
|
|
|
91
92
|
snippetPortrait?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
|
|
92
93
|
snippetRequireFullscreen?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
|
|
93
94
|
snippetInstallOnHomeScreen?: import("svelte").Snippet<[import("./typedef.js").SnippetParams]>;
|
|
95
|
+
debug?: boolean;
|
|
94
96
|
}, {}, "">;
|