@hkdigital/lib-sveltekit 0.1.25 → 0.1.26

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.
@@ -39,6 +39,12 @@
39
39
  aspectOnLandscape,
40
40
  aspectOnPortrait,
41
41
 
42
+ marginLeft = 0,
43
+ marginRight = 0,
44
+
45
+ marginTop = 0,
46
+ marginBottom = 0,
47
+
42
48
  // > Scaling options
43
49
  enableScaling = false,
44
50
  designLandscape = { width: 1920, height: 1080 },
@@ -69,19 +75,22 @@
69
75
  $effect(() => {
70
76
  if (!windowWidth || !windowHeight) return;
71
77
 
78
+ const availWidth = windowWidth - marginLeft - marginRight;
79
+ const availHeight = windowHeight - marginTop - marginBottom;
80
+
72
81
  let gameAspect;
73
82
 
74
- if (windowWidth > windowHeight) {
83
+ if (availWidth > availHeight) {
75
84
  gameWidth = getGameWidthOnLandscape({
76
- windowWidth,
77
- windowHeight,
85
+ windowWidth: availWidth,
86
+ windowHeight: availHeight,
78
87
  aspectOnLandscape
79
88
  });
80
89
  gameAspect = aspectOnLandscape;
81
90
  } else {
82
91
  gameWidth = getGameWidthOnPortrait({
83
- windowWidth,
84
- windowHeight,
92
+ windowWidth: availWidth,
93
+ windowHeight: availHeight,
85
94
  aspectOnPortrait
86
95
  });
87
96
  gameAspect = aspectOnPortrait;
@@ -90,7 +99,7 @@
90
99
  if (gameAspect) {
91
100
  gameHeight = gameWidth / gameAspect;
92
101
  } else {
93
- gameHeight = windowHeight;
102
+ gameHeight = availHeight;
94
103
  }
95
104
  });
96
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hkdigital/lib-sveltekit",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "author": {
5
5
  "name": "HKdigital",
6
6
  "url": "https://hkdigital.nl"