@quenty/buttonhighlightmodel 3.3.1-canary.238.2c4d310.0 → 3.3.2
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 +9 -1
- package/README.md +3 -15
- package/package.json +8 -8
- package/src/Client/ButtonHighlightModel.lua +64 -6
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
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.3.
|
|
6
|
+
## [3.3.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/buttonhighlightmodel@3.3.1...@quenty/buttonhighlightmodel@3.3.2) (2021-12-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/buttonhighlightmodel
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [3.3.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/buttonhighlightmodel@3.3.0...@quenty/buttonhighlightmodel@3.3.1) (2021-12-30)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/buttonhighlightmodel
|
|
9
17
|
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
## ButtonHighlightModel
|
|
2
2
|
<div align="center">
|
|
3
3
|
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
4
|
-
<img src="https://
|
|
4
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://discord.gg/mhtGUS8">
|
|
7
7
|
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
@@ -13,21 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
Contains model information for the current button
|
|
15
15
|
|
|
16
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/ButtonHighlightModel">View docs →</a></div>
|
|
17
|
+
|
|
16
18
|
## Installation
|
|
17
19
|
```
|
|
18
20
|
npm install @quenty/buttonhighlightmodel --save
|
|
19
21
|
```
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
Usage is designed to be simple.
|
|
23
|
-
|
|
24
|
-
### `ButtonHighlightModel.new(button, onUpdate)`
|
|
25
|
-
|
|
26
|
-
### `ButtonHighlightModel:IsInteractionEnabled()`
|
|
27
|
-
|
|
28
|
-
### `ButtonHighlightModel:SetKeyDown(isKeyDown)`
|
|
29
|
-
|
|
30
|
-
### `ButtonHighlightModel:SetInteractionEnabled(interactionEnabled)`
|
|
31
|
-
|
|
32
|
-
### `ButtonHighlightModel:SetIsChoosen(isChoosen)`
|
|
33
|
-
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/buttonhighlightmodel",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Contains model information for the current button",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/acceltween": "2.0.1
|
|
30
|
-
"@quenty/baseobject": "3.2.1
|
|
31
|
-
"@quenty/loader": "3.1.2
|
|
32
|
-
"@quenty/maid": "2.0.2
|
|
33
|
-
"@quenty/rx": "3.5.
|
|
34
|
-
"@quenty/steputils": "3.0.1
|
|
29
|
+
"@quenty/acceltween": "^2.0.1",
|
|
30
|
+
"@quenty/baseobject": "^3.2.1",
|
|
31
|
+
"@quenty/loader": "^3.1.2",
|
|
32
|
+
"@quenty/maid": "^2.0.2",
|
|
33
|
+
"@quenty/rx": "^3.5.2",
|
|
34
|
+
"@quenty/steputils": "^3.0.1"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "4afdd64f4ff6bc3b4b4c0ca7a31e839196f2411e"
|
|
40
40
|
}
|
|
@@ -16,22 +16,40 @@ local ButtonHighlightModel = setmetatable({}, BaseObject)
|
|
|
16
16
|
ButtonHighlightModel.ClassName = "ButtonHighlightModel"
|
|
17
17
|
ButtonHighlightModel.__index = ButtonHighlightModel
|
|
18
18
|
|
|
19
|
+
--[=[
|
|
20
|
+
A model that dictates the current state of a button.
|
|
21
|
+
@param button GuiBase
|
|
22
|
+
@param onUpdate function?
|
|
23
|
+
@return ButtonHighlightModel
|
|
24
|
+
]=]
|
|
19
25
|
function ButtonHighlightModel.new(button, onUpdate)
|
|
20
26
|
local self = setmetatable(BaseObject.new(assert(button, "Bad button")), ButtonHighlightModel)
|
|
21
27
|
|
|
22
28
|
self._onUpdate = onUpdate
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
--[=[
|
|
31
|
+
@prop InteractionEnabled BoolValue
|
|
32
|
+
@readonly
|
|
33
|
+
@within ButtonHighlightModel
|
|
34
|
+
]=]
|
|
25
35
|
self.InteractionEnabled = Instance.new("BoolValue")
|
|
26
36
|
self.InteractionEnabled.Value = true
|
|
27
37
|
self._maid:GiveTask(self.InteractionEnabled)
|
|
28
38
|
|
|
29
|
-
|
|
39
|
+
--[=[
|
|
40
|
+
@prop IsSelected BoolValue
|
|
41
|
+
@readonly
|
|
42
|
+
@within ButtonHighlightModel
|
|
43
|
+
]=]
|
|
30
44
|
self.IsSelected = Instance.new("BoolValue")
|
|
31
45
|
self.IsSelected.Value = false
|
|
32
46
|
self._maid:GiveTask(self.IsSelected)
|
|
33
47
|
|
|
34
|
-
|
|
48
|
+
--[=[
|
|
49
|
+
@prop IsMouseOrTouchOver BoolValue
|
|
50
|
+
@readonly
|
|
51
|
+
@within ButtonHighlightModel
|
|
52
|
+
]=]
|
|
35
53
|
self.IsMouseOrTouchOver = Instance.new("BoolValue")
|
|
36
54
|
self.IsMouseOrTouchOver.Value = false
|
|
37
55
|
self._maid:GiveTask(self.IsMouseOrTouchOver)
|
|
@@ -44,7 +62,11 @@ function ButtonHighlightModel.new(button, onUpdate)
|
|
|
44
62
|
self._numFingerDown.Value = 0
|
|
45
63
|
self._maid:GiveTask(self._numFingerDown)
|
|
46
64
|
|
|
47
|
-
|
|
65
|
+
--[=[
|
|
66
|
+
@prop IsChoosen BoolValue
|
|
67
|
+
@readonly
|
|
68
|
+
@within ButtonHighlightModel
|
|
69
|
+
]=]
|
|
48
70
|
self.IsChoosen = Instance.new("BoolValue")
|
|
49
71
|
self.IsChoosen.Value = false
|
|
50
72
|
self._maid:GiveTask(self.IsChoosen)
|
|
@@ -57,12 +79,20 @@ function ButtonHighlightModel.new(button, onUpdate)
|
|
|
57
79
|
self._isMouseOver.Value = false
|
|
58
80
|
self._maid:GiveTask(self._isMouseOver)
|
|
59
81
|
|
|
60
|
-
|
|
82
|
+
--[=[
|
|
83
|
+
@prop IsHighlighted BoolValue
|
|
84
|
+
@readonly
|
|
85
|
+
@within ButtonHighlightModel
|
|
86
|
+
]=]
|
|
61
87
|
self.IsHighlighted = Instance.new("BoolValue")
|
|
62
88
|
self.IsHighlighted.Value = false
|
|
63
89
|
self._maid:GiveTask(self.IsHighlighted)
|
|
64
90
|
|
|
65
|
-
|
|
91
|
+
--[=[
|
|
92
|
+
@prop IsPressed BoolValue
|
|
93
|
+
@readonly
|
|
94
|
+
@within ButtonHighlightModel
|
|
95
|
+
]=]
|
|
66
96
|
self.IsPressed = Instance.new("BoolValue")
|
|
67
97
|
self.IsPressed.Value = false
|
|
68
98
|
self._maid:GiveTask(self.IsPressed)
|
|
@@ -163,6 +193,10 @@ function ButtonHighlightModel.new(button, onUpdate)
|
|
|
163
193
|
return self
|
|
164
194
|
end
|
|
165
195
|
|
|
196
|
+
--[=[
|
|
197
|
+
Observes how pressed down the button is
|
|
198
|
+
@return Observable<number>
|
|
199
|
+
]=]
|
|
166
200
|
function ButtonHighlightModel:ObservePercentPressed()
|
|
167
201
|
return Blend.AccelTween(Blend.toPropertyObservable(self.IsPressed)
|
|
168
202
|
:Pipe({
|
|
@@ -172,6 +206,10 @@ function ButtonHighlightModel:ObservePercentPressed()
|
|
|
172
206
|
}), 200)
|
|
173
207
|
end
|
|
174
208
|
|
|
209
|
+
--[=[
|
|
210
|
+
Observes how highlighted the button is
|
|
211
|
+
@return Observable<number>
|
|
212
|
+
]=]
|
|
175
213
|
function ButtonHighlightModel:ObservePercentHiglighted()
|
|
176
214
|
return Blend.AccelTween(Blend.toPropertyObservable(self.IsHighlighted)
|
|
177
215
|
:Pipe({
|
|
@@ -181,6 +219,10 @@ function ButtonHighlightModel:ObservePercentHiglighted()
|
|
|
181
219
|
}), 200)
|
|
182
220
|
end
|
|
183
221
|
|
|
222
|
+
--[=[
|
|
223
|
+
Observes how choosen the button is
|
|
224
|
+
@return Observable<number>
|
|
225
|
+
]=]
|
|
184
226
|
function ButtonHighlightModel:ObservePercentChoosen()
|
|
185
227
|
return Blend.AccelTween(Blend.toPropertyObservable(self.IsChoosen)
|
|
186
228
|
:Pipe({
|
|
@@ -190,20 +232,36 @@ function ButtonHighlightModel:ObservePercentChoosen()
|
|
|
190
232
|
}), 200)
|
|
191
233
|
end
|
|
192
234
|
|
|
235
|
+
--[=[
|
|
236
|
+
Observes interaction enabled
|
|
237
|
+
@return booloean
|
|
238
|
+
]=]
|
|
193
239
|
function ButtonHighlightModel:IsInteractionEnabled()
|
|
194
240
|
return self.InteractionEnabled.Value
|
|
195
241
|
end
|
|
196
242
|
|
|
243
|
+
--[=[
|
|
244
|
+
Sets whether a key is down
|
|
245
|
+
@param isKeyDown boolean
|
|
246
|
+
]=]
|
|
197
247
|
function ButtonHighlightModel:SetKeyDown(isKeyDown)
|
|
198
248
|
self._isKeyDown.Value = isKeyDown
|
|
199
249
|
end
|
|
200
250
|
|
|
251
|
+
--[=[
|
|
252
|
+
Sets whether interaction is enabled
|
|
253
|
+
@param interactionEnabled boolean
|
|
254
|
+
]=]
|
|
201
255
|
function ButtonHighlightModel:SetInteractionEnabled(interactionEnabled)
|
|
202
256
|
assert(type(interactionEnabled) == "boolean", "Bad interactionEnabled")
|
|
203
257
|
|
|
204
258
|
self.InteractionEnabled.Value = interactionEnabled
|
|
205
259
|
end
|
|
206
260
|
|
|
261
|
+
--[=[
|
|
262
|
+
Sets whether the model is choosen
|
|
263
|
+
@param isChoosen boolean
|
|
264
|
+
]=]
|
|
207
265
|
function ButtonHighlightModel:SetIsChoosen(isChoosen)
|
|
208
266
|
assert(type(isChoosen) == "boolean", "Bad isChoosen")
|
|
209
267
|
|