@everymatrix/casino-game-page 0.0.301 → 0.0.304

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-game-page",
3
- "version": "0.0.301",
3
+ "version": "0.0.304",
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": "0aaa2050b41f07624312c34d37c3b3b55bb33fcb"
39
+ "gitHead": "d89b47f1860e8b310635d3dbff60138a4eef1a70"
40
40
  }
@@ -76,6 +76,8 @@
76
76
  let isOnNative:boolean = false;
77
77
  let showModal:string = 'false';
78
78
 
79
+ let gameStyle = '';
80
+
79
81
  setupI18n({ withLocale: 'en', translations: {}});
80
82
 
81
83
  Object.keys(GamePageTranslations).forEach((item) => {
@@ -84,6 +86,7 @@
84
86
 
85
87
  // @TODO game typescript model type
86
88
  const formatGameLaunchUrl = (game:any):void => {
89
+ isLoggedIn = true;
87
90
  let url:URL = new URL(game.launchUrl);
88
91
 
89
92
  url.searchParams.append('language', lang);
@@ -99,6 +102,7 @@
99
102
  }
100
103
 
101
104
  game.launchUrl = url;
105
+ isLoading = false;
102
106
 
103
107
  return game;
104
108
  }
@@ -270,11 +274,13 @@
270
274
  modalFrameWidth = game.width;
271
275
  modalFrameHeight = game.height;
272
276
 
273
- definitiveIframeWidth = game.width;
274
- definitiveIframeHeight = game.height;
277
+ definitiveIframeWidth = `${game.width}px`;
278
+ definitiveIframeHeight = `${game.height}px`;
275
279
 
276
280
  gameFrameWidth = game.width;
277
281
  gameFrameHeight = game.height;
282
+
283
+ keepIframeRatio();
278
284
  }
279
285
 
280
286
  // Start section: keep aspect ratio for iframe on resize
@@ -285,19 +291,17 @@
285
291
  let gameContainerHeight = parseInt(iframeContainer.height.slice(0, -2));
286
292
  const iframeRatio = game.width/(game.height + 100);
287
293
 
288
- gameFrameWidth = parseInt(gameFrame.width);
289
- gameFrameHeight = parseInt(gameFrame.height);
294
+
295
+ gameFrameWidth = parseInt(game.width);
296
+ gameFrameHeight = parseInt(game.height);
297
+
290
298
  // resize logic for maintaining game ratio when resizing
291
- if ((gameContainerWidth / iframeRatio) > (gameContainerHeight - buttonsContainer.clientHeight - timeContainer.clientHeight)){
292
- gameFrameHeight = gameContainerHeight - buttonsContainer.clientHeight - timeContainer.clientHeight;
293
- gameFrameWidth = gameContainerHeight * iframeRatio;
294
- } else {
295
- gameFrameWidth = gameContainerWidth;
296
- gameFrameHeight = gameContainerWidth / iframeRatio;
297
- }
299
+ gameFrameWidth = gameContainerWidth * iframeRatio;
300
+
301
+ definitiveIframeWidth = gameFrameWidth ? `${Math.floor(gameFrameWidth)}px` : "1280px";
302
+ definitiveIframeHeight = gameFrameHeight ? `${Math.floor(gameFrameHeight)}px` : "720px";
298
303
 
299
- definitiveIframeWidth = gameFrameWidth ? Math.floor(gameFrameWidth) + "px" : "1280px";
300
- definitiveIframeHeight = gameFrameHeight ? Math.floor(gameFrameHeight) + "px" : "720px";
304
+ calculateFrameProportions();
301
305
  }
302
306
 
303
307
  const openGameWindow = (game:any):void => {
@@ -488,6 +492,16 @@
488
492
  clearInterval(timerInterval);
489
493
  }
490
494
 
495
+
496
+ const calculateFrameProportions = (): void => {
497
+ let w = isFullscreen ? '100%' : definitiveIframeWidth;
498
+ let h = isFullscreen ? '100%' : definitiveIframeHeight;
499
+ let mW = isFullscreen || !isModal ? 'none' : (game.width ? `${Math.floor(game.width)}px`: '1280px');
500
+ let mH = isFullscreen || !isModal ? 'none' : (game.height ? `${(Math.floor(game.height) + 100)}px` : '720px');
501
+
502
+ gameStyle = `width: ${w}; height: ${h}; max-width: ${mW}; max-height: ${mH}`;
503
+ }
504
+
491
505
  onMount(() => {
492
506
  window.addEventListener('resize', resizeHandler, false);
493
507
  window.addEventListener('message', messageHandler, false);
@@ -582,7 +596,7 @@
582
596
  {:else}
583
597
  {#if isLoggedIn}
584
598
  <div id="IframeContainer" part="IframeContainer" bind:this={gameFrameContainer} class:FullsScreenLayout={isFullscreen} style="width: {modalFrameWidth}; height: {modalFrameHeight}">
585
- <div id="IframeGame" part="IframeGame" bind:this={gameInnerContainer} style="width: {isFullscreen ? '100%' : definitiveIframeWidth}; height: {isFullscreen ? '100%' : definitiveIframeHeight}; max-width: {isFullscreen ? 'none' : (game.width ? game.width + 'px' : '1280px')}; max-height: {isFullscreen ? 'none' : (game.height ? (Math.floor(game.height) + 100) + 'px' : '720px')}">
599
+ <div id="IframeGame" part="IframeGame" bind:this={gameInnerContainer} style="{gameStyle}">
586
600
  <iframe title="Games" id="IframeGame" class="GamesContainer" part="GamesContainer" aria-hidden="false" src={game.launchUrl} bind:this={iframe}/>
587
601
  <div class="BottomGame {haspanicbutton == 'true' ? 'BottomGamePanicSection' : ''}" part="BottomGame {haspanicbutton == 'true' ? 'BottomGamePanicSection' : ''}" bind:this={buttonsContainer}>
588
602
  <button class="DepositButton" part="DepositButton" on:click='{() => toggleDeposit()}'>{$_('gamePage.deposit')}</button>
@@ -607,8 +621,8 @@
607
621
  {:else}
608
622
  {#if funMode}
609
623
  <div id="IframeContainer" part="IframeContainer" bind:this={gameFrameContainer} class:FullsScreenLayout={isFullscreen} style="width: {modalFrameWidth}; height: {modalFrameHeight}">
610
- <div id="IframeGame" part="IframeGame" bind:this={gameInnerContainer} style="width: {isFullscreen ? '100%' : definitiveIframeWidth}; height: {isFullscreen ? '100%' : definitiveIframeHeight}; max-width: {isFullscreen || !isModal ? 'none' : (game.width ? Math.floor(game.width) + 'px' : '1280px')}; max-height: {isFullscreen || !isModal ? 'none' : (game.height ? (Math.floor(game.height) + 100) + 'px' : '720px')}">
611
- <iframe title="Games" class="GamesContainer" part="GamesContainer" aria-hidden="false" src={game.launchUrl} bind:this={iframe}/>
624
+ <div id="IframeGame" part="IframeGame" bind:this={gameInnerContainer} style="{gameStyle}">
625
+ <iframe title="Games" id="IframeGame" class="GamesContainer" part="GamesContainer" aria-hidden="false" src={game.launchUrl} bind:this={iframe}/>
612
626
  <div class="BottomGame" part="BottomGame" bind:this={buttonsContainer}>
613
627
  <div class="ButtonsContainer" part="ButtonsContainer">
614
628
  <button class="LoginButton" part="LoginButton" on:click='{() => toggleLogin()}'>{$_('gamePage.signIn')}</button>
@@ -653,6 +667,14 @@
653
667
 
654
668
  .CasinoGamePageContainer {
655
669
  height: 100%;
670
+ padding: 0;
671
+ @media (min-width: 812px) {
672
+ padding: 60px 20px 20px;
673
+ }
674
+
675
+ @media (min-width: 1024px) {
676
+ padding: 60px 80px 80px;
677
+ }
656
678
  }
657
679
 
658
680
  .BottomGame {
@@ -716,6 +738,7 @@
716
738
  .BottomGame .ButtonsContainer {
717
739
  width: 275px;
718
740
  display: flex;
741
+ justify-self: start;
719
742
  flex-direction: row;
720
743
  justify-content: space-between;
721
744
  }
@@ -772,8 +795,10 @@
772
795
  justify-content: center;
773
796
  }
774
797
  #IframeGame {
775
- width: 100%;
776
- height: 100%;
798
+ max-width: 1280px;
799
+ max-height: 820px;
800
+ width: 1245px;
801
+ height: 797px;
777
802
  }
778
803
  .FullsScreenLayout .GamesContainer {
779
804
  // the use of !important is necessary in order to override the dynamic inline width/height, when in fullscreen mode