@quenty/transitionmodel 7.1.1 → 7.2.1-canary.468.ea8a226.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/default.project.json +1 -0
- package/package.json +15 -13
- package/src/Shared/SpringTransitionModel.lua +47 -12
- package/src/Shared/TransitionModel.lua +29 -9
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
|
+
## [7.2.1-canary.468.ea8a226.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/transitionmodel@7.2.0...@quenty/transitionmodel@7.2.1-canary.468.ea8a226.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
|
+
* Allow SetShowTarget and SetHideTarget to be set for a SPringTransitionModel ([70bc88d](https://github.com/Quenty/NevermoreEngine/commit/70bc88d750dca1696cf84ff83634c6a0d47c907d))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [7.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/transitionmodel@7.1.1...@quenty/transitionmodel@7.2.0) (2024-04-27)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @quenty/transitionmodel
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [7.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/transitionmodel@7.1.0...@quenty/transitionmodel@7.1.1) (2024-04-23)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @quenty/transitionmodel
|
package/default.project.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/transitionmodel",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.2.1-canary.468.ea8a226.0",
|
|
4
4
|
"description": "Helps with Gui visiblity showing and hiding",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,20 +25,22 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/baseobject": "
|
|
29
|
-
"@quenty/basicpane": "
|
|
30
|
-
"@quenty/blend": "
|
|
31
|
-
"@quenty/
|
|
32
|
-
"@quenty/
|
|
33
|
-
"@quenty/
|
|
34
|
-
"@quenty/
|
|
35
|
-
"@quenty/
|
|
36
|
-
"@quenty/
|
|
37
|
-
"@quenty/
|
|
38
|
-
"@quenty/
|
|
28
|
+
"@quenty/baseobject": "10.2.1-canary.468.ea8a226.0",
|
|
29
|
+
"@quenty/basicpane": "13.2.1-canary.468.ea8a226.0",
|
|
30
|
+
"@quenty/blend": "12.2.1-canary.468.ea8a226.0",
|
|
31
|
+
"@quenty/ducktype": "5.2.1-canary.468.ea8a226.0",
|
|
32
|
+
"@quenty/instanceutils": "13.2.1-canary.468.ea8a226.0",
|
|
33
|
+
"@quenty/loader": "10.2.1-canary.468.ea8a226.0",
|
|
34
|
+
"@quenty/maid": "3.1.1-canary.468.ea8a226.0",
|
|
35
|
+
"@quenty/promise": "10.2.1-canary.468.ea8a226.0",
|
|
36
|
+
"@quenty/rx": "13.2.1-canary.468.ea8a226.0",
|
|
37
|
+
"@quenty/signal": "7.2.1-canary.468.ea8a226.0",
|
|
38
|
+
"@quenty/spring": "10.2.1-canary.468.ea8a226.0",
|
|
39
|
+
"@quenty/timedtween": "7.2.1-canary.468.ea8a226.0",
|
|
40
|
+
"@quenty/valueobject": "13.2.1-canary.468.ea8a226.0"
|
|
39
41
|
},
|
|
40
42
|
"publishConfig": {
|
|
41
43
|
"access": "public"
|
|
42
44
|
},
|
|
43
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "ea8a2260a364aaf6d6c246a93632b789935da134"
|
|
44
46
|
}
|
|
@@ -9,6 +9,7 @@ local TransitionModel = require("TransitionModel")
|
|
|
9
9
|
local SpringObject = require("SpringObject")
|
|
10
10
|
local Promise = require("Promise")
|
|
11
11
|
local Maid = require("Maid")
|
|
12
|
+
local SpringUtils = require("SpringUtils")
|
|
12
13
|
|
|
13
14
|
local SpringTransitionModel = setmetatable({}, BasicPane)
|
|
14
15
|
SpringTransitionModel.ClassName = "SpringTransitionModel"
|
|
@@ -25,20 +26,14 @@ SpringTransitionModel.__index = SpringTransitionModel
|
|
|
25
26
|
function SpringTransitionModel.new(showTarget, hideTarget)
|
|
26
27
|
local self = setmetatable(BasicPane.new(), SpringTransitionModel)
|
|
27
28
|
|
|
28
|
-
self._transitionModel = TransitionModel.new()
|
|
29
|
-
self._transitionModel:BindToPaneVisbility(self)
|
|
30
|
-
self._maid:GiveTask(self._transitionModel)
|
|
31
|
-
|
|
32
29
|
self._showTarget = showTarget or 1
|
|
33
|
-
|
|
34
|
-
self._hideTarget = hideTarget
|
|
35
|
-
else
|
|
36
|
-
self._hideTarget = 0*self._showTarget
|
|
37
|
-
end
|
|
30
|
+
self._hideTarget = hideTarget
|
|
38
31
|
|
|
39
|
-
self.
|
|
32
|
+
self._transitionModel = self._maid:Add(TransitionModel.new())
|
|
33
|
+
self._transitionModel:BindToPaneVisbility(self)
|
|
34
|
+
|
|
35
|
+
self._springObject = self._maid:Add(SpringObject.new(self:_computeHideTarget()))
|
|
40
36
|
self._springObject.Speed = 30
|
|
41
|
-
self._maid:GiveTask(self._springObject)
|
|
42
37
|
|
|
43
38
|
self._transitionModel:SetPromiseShow(function(maid, doNotAnimate)
|
|
44
39
|
return self:_promiseShow(maid, doNotAnimate)
|
|
@@ -50,6 +45,38 @@ function SpringTransitionModel.new(showTarget, hideTarget)
|
|
|
50
45
|
return self
|
|
51
46
|
end
|
|
52
47
|
|
|
48
|
+
--[=[
|
|
49
|
+
Sets the show target for the transition model
|
|
50
|
+
|
|
51
|
+
@param showTarget T?
|
|
52
|
+
@param doNotAnimate boolean?
|
|
53
|
+
]=]
|
|
54
|
+
function SpringTransitionModel:SetShowTarget(showTarget, doNotAnimate)
|
|
55
|
+
self._showTarget = SpringUtils.toLinearIfNeeded(showTarget or 1)
|
|
56
|
+
|
|
57
|
+
if self:IsVisible() then
|
|
58
|
+
self._springObject:SetTarget(self._showTarget, doNotAnimate)
|
|
59
|
+
else
|
|
60
|
+
self._springObject:SetTarget(self:_computeHideTarget(), doNotAnimate)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
--[=[
|
|
65
|
+
Sets the hide target for the transition model
|
|
66
|
+
|
|
67
|
+
@param hideTarget T?
|
|
68
|
+
@param doNotAnimate boolean?
|
|
69
|
+
]=]
|
|
70
|
+
function SpringTransitionModel:SetHideTarget(hideTarget, doNotAnimate)
|
|
71
|
+
self._hideTarget = hideTarget
|
|
72
|
+
|
|
73
|
+
if self:IsVisible() then
|
|
74
|
+
self._springObject:SetTarget(self._showTarget, doNotAnimate)
|
|
75
|
+
else
|
|
76
|
+
self._springObject:SetTarget(self:_computeHideTarget(), doNotAnimate)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
53
80
|
--[=[
|
|
54
81
|
Returns true if showing is complete
|
|
55
82
|
@return boolean
|
|
@@ -214,7 +241,7 @@ function SpringTransitionModel:_promiseShow(maid, doNotAnimate)
|
|
|
214
241
|
end
|
|
215
242
|
|
|
216
243
|
function SpringTransitionModel:_promiseHide(maid, doNotAnimate)
|
|
217
|
-
self._springObject:SetTarget(self
|
|
244
|
+
self._springObject:SetTarget(self:_computeHideTarget(), doNotAnimate)
|
|
218
245
|
|
|
219
246
|
if doNotAnimate then
|
|
220
247
|
return Promise.resolved()
|
|
@@ -223,4 +250,12 @@ function SpringTransitionModel:_promiseHide(maid, doNotAnimate)
|
|
|
223
250
|
end
|
|
224
251
|
end
|
|
225
252
|
|
|
253
|
+
function SpringTransitionModel:_computeHideTarget()
|
|
254
|
+
if self._hideTarget then
|
|
255
|
+
return SpringUtils.toLinearIfNeeded(self._hideTarget)
|
|
256
|
+
else
|
|
257
|
+
return 0*SpringUtils.toLinearIfNeeded(self._showTarget)
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
|
|
226
261
|
return SpringTransitionModel
|
|
@@ -11,6 +11,7 @@ local BasicPane = require("BasicPane")
|
|
|
11
11
|
local Promise = require("Promise")
|
|
12
12
|
local Maid = require("Maid")
|
|
13
13
|
local ValueObject = require("ValueObject")
|
|
14
|
+
local DuckTypeUtils = require("DuckTypeUtils")
|
|
14
15
|
|
|
15
16
|
local TransitionModel = setmetatable({}, BasicPane)
|
|
16
17
|
TransitionModel.ClassName = "TransitionModel"
|
|
@@ -27,11 +28,8 @@ TransitionModel.__index = TransitionModel
|
|
|
27
28
|
function TransitionModel.new()
|
|
28
29
|
local self = setmetatable(BasicPane.new(), TransitionModel)
|
|
29
30
|
|
|
30
|
-
self._isShowingComplete = ValueObject.new(false, "boolean")
|
|
31
|
-
self._maid:
|
|
32
|
-
|
|
33
|
-
self._isHidingComplete = ValueObject.new(false, "boolean")
|
|
34
|
-
self._maid:GiveTask(self._isHidingComplete)
|
|
31
|
+
self._isShowingComplete = self._maid:Add(ValueObject.new(false, "boolean"))
|
|
32
|
+
self._isHidingComplete = self._maid:Add(ValueObject.new(false, "boolean"))
|
|
35
33
|
|
|
36
34
|
self._showCallback = nil
|
|
37
35
|
self._hideCallback = nil
|
|
@@ -47,6 +45,16 @@ function TransitionModel.new()
|
|
|
47
45
|
return self
|
|
48
46
|
end
|
|
49
47
|
|
|
48
|
+
--[=[
|
|
49
|
+
Returnes true if it's a transition model
|
|
50
|
+
|
|
51
|
+
@param value any
|
|
52
|
+
@return boolean
|
|
53
|
+
]=]
|
|
54
|
+
function TransitionModel.isTransitionModel(value)
|
|
55
|
+
return DuckTypeUtils.isImplementation(TransitionModel, value)
|
|
56
|
+
end
|
|
57
|
+
|
|
50
58
|
--[=[
|
|
51
59
|
Shows the model and promises when the showing is complete.
|
|
52
60
|
|
|
@@ -54,9 +62,11 @@ end
|
|
|
54
62
|
@return Promise
|
|
55
63
|
]=]
|
|
56
64
|
function TransitionModel:PromiseShow(doNotAnimate)
|
|
65
|
+
local promise = self:_promiseIsShown()
|
|
66
|
+
|
|
57
67
|
self:Show(doNotAnimate)
|
|
58
68
|
|
|
59
|
-
return
|
|
69
|
+
return promise
|
|
60
70
|
end
|
|
61
71
|
|
|
62
72
|
--[=[
|
|
@@ -66,9 +76,11 @@ end
|
|
|
66
76
|
@return Promise
|
|
67
77
|
]=]
|
|
68
78
|
function TransitionModel:PromiseHide(doNotAnimate)
|
|
79
|
+
local promise = self:_promiseIsHidden()
|
|
80
|
+
|
|
69
81
|
self:Hide(doNotAnimate)
|
|
70
82
|
|
|
71
|
-
return
|
|
83
|
+
return promise
|
|
72
84
|
end
|
|
73
85
|
|
|
74
86
|
--[=[
|
|
@@ -251,7 +263,11 @@ function TransitionModel:_executeShow(doNotAnimate)
|
|
|
251
263
|
self._isShowingComplete.Value = true
|
|
252
264
|
end)
|
|
253
265
|
|
|
254
|
-
self.
|
|
266
|
+
if self.Destroy then
|
|
267
|
+
self._maid._transition = maid
|
|
268
|
+
else
|
|
269
|
+
maid:DoCleaning()
|
|
270
|
+
end
|
|
255
271
|
end
|
|
256
272
|
|
|
257
273
|
function TransitionModel:_executeHide(doNotAnimate)
|
|
@@ -280,7 +296,11 @@ function TransitionModel:_executeHide(doNotAnimate)
|
|
|
280
296
|
self._isHidingComplete.Value = true
|
|
281
297
|
end)
|
|
282
298
|
|
|
283
|
-
self.
|
|
299
|
+
if self.Destroy then
|
|
300
|
+
self._maid._transition = maid
|
|
301
|
+
else
|
|
302
|
+
maid:DoCleaning()
|
|
303
|
+
end
|
|
284
304
|
end
|
|
285
305
|
|
|
286
306
|
return TransitionModel
|