@quenty/uiobjectutils 6.4.0-canary.490.601c967.0 → 6.4.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 +5 -2
- package/package.json +7 -4
- package/src/Client/GuiInteractionUtils.lua +49 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
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.4.0
|
|
6
|
+
# [6.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/uiobjectutils@6.3.0...@quenty/uiobjectutils@6.4.0) (2024-09-12)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add GuiInteractionUtils.observeInteractionEnabled ([2e27110](https://github.com/Quenty/NevermoreEngine/commit/2e2711020665371e1c1d3b1ba35f44dc9a9ad3a7))
|
|
9
12
|
|
|
10
13
|
|
|
11
14
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/uiobjectutils",
|
|
3
|
-
"version": "6.4.0
|
|
3
|
+
"version": "6.4.0",
|
|
4
4
|
"description": "UI object utils library for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,8 +28,11 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/
|
|
32
|
-
"@quenty/
|
|
31
|
+
"@quenty/brio": "^14.5.0",
|
|
32
|
+
"@quenty/enumutils": "^3.2.0",
|
|
33
|
+
"@quenty/instanceutils": "^13.5.0",
|
|
34
|
+
"@quenty/loader": "^10.4.0",
|
|
35
|
+
"@quenty/rx": "^13.5.0"
|
|
33
36
|
},
|
|
34
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "fb172906f3ee725269ec1e5f4daf9dca227e729d"
|
|
35
38
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class GuiInteractionUtils
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local RxInstanceUtils = require("RxInstanceUtils")
|
|
8
|
+
local Rx = require("Rx")
|
|
9
|
+
local RxBrioUtils = require("RxBrioUtils")
|
|
10
|
+
|
|
11
|
+
local GuiInteractionUtils = {}
|
|
12
|
+
|
|
13
|
+
--[=[
|
|
14
|
+
Observes whether a Gui is interactable
|
|
15
|
+
|
|
16
|
+
@param gui GuiObject
|
|
17
|
+
@return Observable<boolean>
|
|
18
|
+
]=]
|
|
19
|
+
function GuiInteractionUtils.observeInteractionEnabled(gui)
|
|
20
|
+
assert(typeof(gui) == "Instance" and gui:IsA("GuiObject"), "Bad gui")
|
|
21
|
+
|
|
22
|
+
return RxInstanceUtils.observeProperty(gui, "GuiState"):Pipe({
|
|
23
|
+
Rx.map(function(state)
|
|
24
|
+
-- Ensure we have interaction enabled (visible, et cetera)
|
|
25
|
+
return state ~= Enum.GuiState.NonInteractable
|
|
26
|
+
end);
|
|
27
|
+
Rx.distinct();
|
|
28
|
+
})
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
--[=[
|
|
32
|
+
Observes whether a Gui is interactable, and returns a Brio only during
|
|
33
|
+
interaction.
|
|
34
|
+
|
|
35
|
+
@param gui GuiObject
|
|
36
|
+
@return Observable<Brio>
|
|
37
|
+
]=]
|
|
38
|
+
function GuiInteractionUtils.observeInteractionEnabledBrio(gui)
|
|
39
|
+
assert(typeof(gui) == "Instance" and gui:IsA("GuiObject"), "Bad gui")
|
|
40
|
+
|
|
41
|
+
return GuiInteractionUtils.observeInteractionEnabled(gui):Pipe({
|
|
42
|
+
RxBrioUtils.switchToBrio(function(canInteract)
|
|
43
|
+
return canInteract
|
|
44
|
+
end)
|
|
45
|
+
})
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
return GuiInteractionUtils
|