@quenty/uiobjectutils 3.0.0 → 3.1.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 +11 -0
- package/package.json +2 -2
- package/src/Client/UIAlignmentUtils.lua +41 -0
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
|
+
# [3.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/uiobjectutils@3.0.0...@quenty/uiobjectutils@3.1.0) (2022-12-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add UIAlignmentUtils ([6b8fb3b](https://github.com/Quenty/NevermoreEngine/commit/6b8fb3b6167146ba60045980a3f94a7e90645c7c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [3.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/uiobjectutils@2.1.0...@quenty/uiobjectutils@3.0.0) (2022-09-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/uiobjectutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/uiobjectutils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "UI object utils library for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "daae02817ae9128c5bf81220ef44e41d22ec14ad"
|
|
31
31
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class UIAlignmentUtils
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local UIAlignmentUtils = {}
|
|
8
|
+
|
|
9
|
+
function UIAlignmentUtils.horizontalAlignmentToNumber(horizontalAlignment)
|
|
10
|
+
assert(horizontalAlignment, "Bad horizontalAlignment")
|
|
11
|
+
|
|
12
|
+
local x
|
|
13
|
+
if horizontalAlignment == Enum.HorizontalAlignment.Left then
|
|
14
|
+
x = 0
|
|
15
|
+
elseif horizontalAlignment == Enum.HorizontalAlignment.Center then
|
|
16
|
+
x = 0.5
|
|
17
|
+
elseif horizontalAlignment == Enum.HorizontalAlignment.Right then
|
|
18
|
+
x = 1
|
|
19
|
+
else
|
|
20
|
+
error(("[UIAlignmentUtils] - Bad horizontalAlignment %q"):format(tostring(horizontalAlignment)))
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
return x
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
function UIAlignmentUtils.verticalAlignmentToNumber(verticalAlignment)
|
|
27
|
+
assert(verticalAlignment, "Bad verticalAlignment")
|
|
28
|
+
local y
|
|
29
|
+
if verticalAlignment == Enum.VerticalAlignment.Top then
|
|
30
|
+
y = 0
|
|
31
|
+
elseif verticalAlignment == Enum.VerticalAlignment.Center then
|
|
32
|
+
y = 0.5
|
|
33
|
+
elseif verticalAlignment == Enum.VerticalAlignment.Bottom then
|
|
34
|
+
y = 1
|
|
35
|
+
else
|
|
36
|
+
error(("[UIAlignmentUtils] - Bad verticalAlignment %q"):format(tostring(verticalAlignment)))
|
|
37
|
+
end
|
|
38
|
+
return y
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
return UIAlignmentUtils
|