@quenty/inputobjectutils 4.3.0 → 4.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 +16 -0
- package/default.project.json +1 -0
- package/package.json +5 -4
- package/src/Client/RxInputObjectUtils.lua +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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
|
+
# [4.4.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputobjectutils@4.3.0...@quenty/inputobjectutils@4.4.0) (2024-05-09)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix .package-lock.json replicating in packages ([75d0efe](https://github.com/Quenty/NevermoreEngine/commit/75d0efeef239f221d93352af71a5b3e930ec23c5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* Add RxInputObjectUtils ([7391a63](https://github.com/Quenty/NevermoreEngine/commit/7391a6307e96851c184a412888c7a1ff14ef5b7d))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [4.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputobjectutils@4.2.0...@quenty/inputobjectutils@4.3.0) (2024-04-27)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @quenty/inputobjectutils
|
package/default.project.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/inputobjectutils",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"description": "Provides utility functions involving input objects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@quenty/baseobject": "^10.
|
|
32
|
-
"@quenty/maid": "^3.
|
|
31
|
+
"@quenty/baseobject": "^10.3.0",
|
|
32
|
+
"@quenty/maid": "^3.2.0",
|
|
33
|
+
"@quenty/rx": "^13.3.0"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "3fd5cdca3128bf34c8d9dfae1e92d62533b6e6f5"
|
|
35
36
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
--[=[
|
|
2
|
+
@class RxInputObjectUtils
|
|
3
|
+
]=]
|
|
4
|
+
|
|
5
|
+
local require = require(script.Parent.loader).load(script)
|
|
6
|
+
|
|
7
|
+
local UserInputService = game:GetService("UserInputService")
|
|
8
|
+
|
|
9
|
+
local Maid = require("Maid")
|
|
10
|
+
local Observable = require("Observable")
|
|
11
|
+
local InputObjectUtils = require("InputObjectUtils")
|
|
12
|
+
|
|
13
|
+
local RxInputObjectUtils = {}
|
|
14
|
+
|
|
15
|
+
function RxInputObjectUtils.observeInputObjectEnded(initialInputObject)
|
|
16
|
+
assert(initialInputObject, "Bad initialInputObject")
|
|
17
|
+
|
|
18
|
+
return Observable.new(function(sub)
|
|
19
|
+
if initialInputObject.UserInputState == Enum.UserInputState.End then
|
|
20
|
+
sub:Fire()
|
|
21
|
+
sub:Complete()
|
|
22
|
+
return
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
local maid = Maid.new()
|
|
26
|
+
|
|
27
|
+
-- Handle mouse inputs
|
|
28
|
+
maid:GiveTask(UserInputService.InputEnded:Connect(function(inputObject)
|
|
29
|
+
if InputObjectUtils.isSameInputObject(initialInputObject, inputObject) then
|
|
30
|
+
sub:Fire()
|
|
31
|
+
sub:Complete()
|
|
32
|
+
end
|
|
33
|
+
end))
|
|
34
|
+
|
|
35
|
+
-- Handle touch events
|
|
36
|
+
maid:GiveTask(initialInputObject:GetPropertyChangedSignal("UserInputState"):Connect(function()
|
|
37
|
+
if initialInputObject.UserInputState == Enum.UserInputState.End then
|
|
38
|
+
sub:Fire()
|
|
39
|
+
sub:Complete()
|
|
40
|
+
end
|
|
41
|
+
end))
|
|
42
|
+
|
|
43
|
+
return maid
|
|
44
|
+
end)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
return RxInputObjectUtils
|