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