@quenty/inputkeymaputils 3.0.0 → 3.0.2-canary.216.1c1ac8b.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 +24 -0
- package/README.md +1 -1
- package/package.json +5 -5
- package/src/Client/InputKeyMapUtils.lua +46 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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.0.2-canary.216.1c1ac8b.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputkeymaputils@3.0.1...@quenty/inputkeymaputils@3.0.2-canary.216.1c1ac8b.0) (2021-10-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Update linting ([1c1ac8b](https://github.com/Quenty/NevermoreEngine/commit/1c1ac8b60f35fcaa134378dc1c8e75fd145a84f9))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* Handle slotted touch buttons so we can always position touch buttons in the same place ([eb6e615](https://github.com/Quenty/NevermoreEngine/commit/eb6e6154c76fea60510cff7c702978a7301a75c6))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputkeymaputils@3.0.0...@quenty/inputkeymaputils@3.0.1) (2021-09-18)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @quenty/inputkeymaputils
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [3.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputkeymaputils@2.1.0...@quenty/inputkeymaputils@3.0.0) (2021-09-11)
|
|
7
31
|
|
|
8
32
|
|
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Converts keymap into ContextActionService friendly types
|
|
|
34
34
|
|
|
35
35
|
### `InputKeyMapUtils.getInputModes(inputKeyMapList)`
|
|
36
36
|
|
|
37
|
-
### `InputKeyMapUtils.
|
|
37
|
+
### `InputKeyMapUtils.isRobloxTouchButton(inputKeyMapList)`
|
|
38
38
|
|
|
39
39
|
### `InputKeyMapUtils.isTapInWorld(inputKeyMapList)`
|
|
40
40
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/inputkeymaputils",
|
|
3
|
-
"version": "3.0.0",
|
|
3
|
+
"version": "3.0.2-canary.216.1c1ac8b.0",
|
|
4
4
|
"description": "Utility methods for input map",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/inputmode": "
|
|
30
|
-
"@quenty/loader": "
|
|
31
|
-
"@quenty/table": "
|
|
29
|
+
"@quenty/inputmode": "3.0.2-canary.216.1c1ac8b.0",
|
|
30
|
+
"@quenty/loader": "3.0.2-canary.216.1c1ac8b.0",
|
|
31
|
+
"@quenty/table": "2.0.1-canary.216.1c1ac8b.0"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "1c1ac8b60f35fcaa134378dc1c8e75fd145a84f9"
|
|
37
37
|
}
|
|
@@ -9,6 +9,7 @@ local Table = require("Table")
|
|
|
9
9
|
|
|
10
10
|
local InputKeyMapUtils = {}
|
|
11
11
|
|
|
12
|
+
-- Should be called "createInputKeyMapList"
|
|
12
13
|
function InputKeyMapUtils.createKeyMap(inputMode, inputTypes)
|
|
13
14
|
assert(type(inputMode) == "table", "Bad inputMode")
|
|
14
15
|
assert(type(inputTypes) == "table", "Bad inputTypes")
|
|
@@ -91,7 +92,51 @@ function InputKeyMapUtils.getInputModes(inputKeyMapList)
|
|
|
91
92
|
return modes
|
|
92
93
|
end
|
|
93
94
|
|
|
94
|
-
function InputKeyMapUtils.
|
|
95
|
+
function InputKeyMapUtils.getSlottedTouchButtonData(inputKeyMapList)
|
|
96
|
+
local slottedTouchButtons = {}
|
|
97
|
+
|
|
98
|
+
for _, inputKeyMap in pairs(inputKeyMapList) do
|
|
99
|
+
assert(inputKeyMap.inputMode, "Bad inputKeyMap.inputMode")
|
|
100
|
+
assert(inputKeyMap.inputTypes, "Bad inputKeyMap.inputTypes")
|
|
101
|
+
|
|
102
|
+
for _, touchButtonData in pairs(inputKeyMap.inputTypes) do
|
|
103
|
+
if InputKeyMapUtils.isSlottedTouchButton(touchButtonData) then
|
|
104
|
+
table.insert(slottedTouchButtons, {
|
|
105
|
+
slotId = touchButtonData.slotId;
|
|
106
|
+
inputMode = inputKeyMap.inputMode;
|
|
107
|
+
})
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
return slottedTouchButtons
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
function InputKeyMapUtils.isSlottedTouchButton(inputType)
|
|
116
|
+
return type(inputType) == "table" and inputType.type == "SlottedTouchButton"
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
-- Touch buttons should always show up in the same position
|
|
120
|
+
-- We use the SlotId to determine which slot we should put these buttons in
|
|
121
|
+
function InputKeyMapUtils.createSlottedTouchButton(slotId)
|
|
122
|
+
assert(slotId == "primary1" or slotId == "primary2" or slotId == "primary3" or slotId == "primary4", "Bad slotId")
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
type = "SlottedTouchButton";
|
|
126
|
+
slotId = slotId;
|
|
127
|
+
}
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
function InputKeyMapUtils.getUniqueKeyForInputType(inputType)
|
|
131
|
+
if InputKeyMapUtils.isSlottedTouchButton(inputType) then
|
|
132
|
+
return inputType.slotId
|
|
133
|
+
else
|
|
134
|
+
return inputType
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
-- Only returns true if we're a Roblox touch button
|
|
139
|
+
function InputKeyMapUtils.isRobloxTouchButton(inputKeyMapList)
|
|
95
140
|
for _, inputKeyMap in pairs(inputKeyMapList) do
|
|
96
141
|
assert(inputKeyMap.inputMode, "Bad inputKeyMap.inputMode")
|
|
97
142
|
assert(inputKeyMap.inputTypes, "Bad inputKeyMap.inputTypes")
|