@everymatrix/casino-game-page 0.0.322 → 0.0.325

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-game-page",
3
- "version": "0.0.322",
3
+ "version": "0.0.325",
4
4
  "main": "dist/casino-game-page.js",
5
5
  "svelte": "src/index.ts",
6
6
  "scripts": {
@@ -36,5 +36,5 @@
36
36
  "publishConfig": {
37
37
  "access": "public"
38
38
  },
39
- "gitHead": "2990bded751255b4e5977ee1e2d181e17c730dc5"
39
+ "gitHead": "78178d0c87241acca69756f2bd40ac66e48b7279"
40
40
  }
@@ -77,6 +77,7 @@
77
77
  let showModal:string = 'false';
78
78
 
79
79
  let gameStyle = '';
80
+ let gameRationedHeight: number;
80
81
 
81
82
  setupI18n({ withLocale: 'en', translations: {}});
82
83
 
@@ -269,6 +270,36 @@
269
270
  });
270
271
  }
271
272
 
273
+ const resizeIframeIfNotVisible = (): void => {
274
+ if (isFullscreen) return;
275
+
276
+ const resizeCallback = (entries, observer): void => {
277
+ const maxIntersectionRatio = 0.5;
278
+ const intersectionRatio = entries[0].intersectionRatio;
279
+
280
+ const gameFrameContainerHeight = parseInt(
281
+ getComputedStyle(gameFrameContainer).height
282
+ );
283
+
284
+ if (!gameRationedHeight)
285
+ gameRationedHeight =
286
+ gameFrameContainerHeight *
287
+ Math.max(intersectionRatio, maxIntersectionRatio);
288
+
289
+ gameFrameContainer.style.height = `${gameRationedHeight}px`;
290
+ gameInnerContainer.style.height = `${gameRationedHeight}px`;
291
+
292
+ observer.unobserve(gameFrameContainer);
293
+ };
294
+
295
+ const options = {
296
+ threshold: 0,
297
+ };
298
+
299
+ const observer = new IntersectionObserver(resizeCallback, options);
300
+ observer.observe(gameFrameContainer);
301
+ };
302
+
272
303
  const maximizeGameFrame = ():void => {
273
304
  modalFrameWidth = game.width;
274
305
  modalFrameHeight = game.height;
@@ -499,6 +530,7 @@
499
530
  let mH = isFullscreen || !isModal ? 'none' : (game.height ? `${(Math.floor(game.height) + 100)}px` : '720px');
500
531
 
501
532
  gameStyle = `width: ${w}; height: ${h}; max-width: ${mW}; max-height: ${mH}`;
533
+ resizeIframeIfNotVisible();
502
534
  }
503
535
 
504
536
  onMount(() => {