@quenty/gamescalingutils 5.3.1 → 6.0.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [6.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@5.3.1...@quenty/gamescalingutils@6.0.0) (2022-08-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add blend helper methods to render the UI scale and dialog padding ([f6d342f](https://github.com/Quenty/NevermoreEngine/commit/f6d342ffd92f0df04011efe762d294f681e19d8c))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [5.3.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/gamescalingutils@5.3.0...@quenty/gamescalingutils@5.3.1) (2022-08-11)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/gamescalingutils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/gamescalingutils",
3
- "version": "5.3.1",
3
+ "version": "6.0.0",
4
4
  "description": "Scale ratios for the UI on different devices",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,10 +28,10 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@quenty/blend": "^4.3.1",
32
- "@quenty/instanceutils": "^5.2.0",
31
+ "@quenty/blend": "^5.0.0",
32
+ "@quenty/instanceutils": "^6.0.0",
33
33
  "@quenty/loader": "^5.0.0",
34
- "@quenty/rx": "^5.2.0"
34
+ "@quenty/rx": "^6.0.0"
35
35
  },
36
- "gitHead": "45ffe88b893e29690163a42c3830c983f6098a59"
36
+ "gitHead": "dbb62609f980983cc32da90acfef13e30ed41113"
37
37
  }
@@ -52,6 +52,55 @@ function GameScalingUtils.observeUIScale(screenGui)
52
52
  }), 30)
53
53
  end
54
54
 
55
+ --[=[
56
+ Blend equivalent of rendering a UI Scale
57
+
58
+ @param props { Parent: Instance?, ScreenGui: ScreenGui }
59
+ @return Observable<number>
60
+ ]=]
61
+ function GameScalingUtils.renderUIScale(props)
62
+ assert(props.ScreenGui, "No screenGui")
63
+
64
+ return Blend.New "UIScale" {
65
+ Parent = props.Parent;
66
+ Scale = GameScalingUtils.observeUIScale(props.ScreenGui)
67
+ }
68
+ end
69
+
70
+ --[=[
71
+ Blend equivalent of rendering the dialog padding
72
+
73
+ @param props { Parent: Instance?, ScreenGui: ScreenGui }
74
+ @return Observable<number>
75
+ ]=]
76
+ function GameScalingUtils.renderDialogPadding(props)
77
+ assert(props.ScreenGui, "No screenGui")
78
+
79
+ return Blend.New "UIPadding" {
80
+ Parent = props.Parent;
81
+ PaddingTop = GameScalingUtils.observeDialogPadding(props.ScreenGui);
82
+ PaddingBottom = GameScalingUtils.observeDialogPadding(props.ScreenGui);
83
+ PaddingLeft = GameScalingUtils.observeDialogPadding(props.ScreenGui);
84
+ PaddingRight = GameScalingUtils.observeDialogPadding(props.ScreenGui);
85
+ }
86
+ end
87
+
88
+ --[=[
89
+ Observes a smoothed out UI scale for a given screenGui
90
+ @param screenGui ScreenGui
91
+ @return Observable<number>
92
+ ]=]
93
+ function GameScalingUtils.observeDialogPadding(screenGui)
94
+ return Blend.Spring(RxInstanceUtils.observeProperty(screenGui, "AbsoluteSize")
95
+ :Pipe({
96
+ Rx.map(GameScalingUtils.getDialogPadding)
97
+ }), 30):Pipe({
98
+ Rx.map(function(padding)
99
+ return UDim.new(0, padding)
100
+ end);
101
+ })
102
+ end
103
+
55
104
  --[=[
56
105
  Computes a reasonable dialog padding for a given absolute screen size
57
106
  @param screenAbsoluteSize Vector2