@quenty/guivisiblemanager 8.0.1 → 8.1.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 CHANGED
@@ -3,6 +3,17 @@
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
+ # [8.1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/guivisiblemanager@8.0.1...@quenty/guivisiblemanager@8.1.0) (2023-02-21)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add doNotAnimate support ([e505dfc](https://github.com/Quenty/NevermoreEngine/commit/e505dfce0d9197ec8b1e2f03e69995442bf73caf))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [8.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/guivisiblemanager@8.0.0...@quenty/guivisiblemanager@8.0.1) (2022-11-04)
7
18
 
8
19
  **Note:** Version bump only for package @quenty/guivisiblemanager
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/guivisiblemanager",
3
- "version": "8.0.1",
3
+ "version": "8.1.0",
4
4
  "description": "Help manage the visibility of GUIs while only constructing the Gui while visible",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,13 +25,13 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/baseobject": "^6.0.1",
29
- "@quenty/cancellabledelay": "^3.3.0",
30
- "@quenty/loader": "^6.0.1",
28
+ "@quenty/baseobject": "^6.1.0",
29
+ "@quenty/cancellabledelay": "^3.4.0",
30
+ "@quenty/loader": "^6.1.0",
31
31
  "@quenty/maid": "^2.4.0"
32
32
  },
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "gitHead": "8b9877c26a3fc753409a5114e56717837291279d"
36
+ "gitHead": "e084b0cc097ddbcb7c782b8ecbd9c2d619c49354"
37
37
  }
@@ -22,7 +22,7 @@ GuiVisibleManager.__index = GuiVisibleManager
22
22
  --[=[
23
23
  Constructs a new GuiVisibleManager.
24
24
 
25
- @param promiseNewPane Promise<TPane> -- Returns a promise for a new pane.
25
+ @param promiseNewPane (maid: Maid) -> Promise<TPane> -- Returns a promise for a new pane.
26
26
  @param maxHideTime number? -- Optional hide time
27
27
  @return GuiVisibleManager
28
28
  ]=]
@@ -32,6 +32,8 @@ function GuiVisibleManager.new(promiseNewPane, maxHideTime)
32
32
  self._maxHideTime = maxHideTime or 1
33
33
  self._promiseNewPane = promiseNewPane or error("No promiseNewPane")
34
34
 
35
+ self._nextDoNotAnimate = false
36
+
35
37
  self._paneVisible = Instance.new("BoolValue")
36
38
  self._paneVisible.Value = false
37
39
  self._maid:GiveTask(self._paneVisible)
@@ -49,6 +51,7 @@ end
49
51
 
50
52
  --[=[
51
53
  Returns whether the Gui is visible.
54
+
52
55
  @return boolean
53
56
  ]=]
54
57
  function GuiVisibleManager:IsVisible()
@@ -83,15 +86,17 @@ end
83
86
  --[=[
84
87
  Creates a handle that will force the gui to be rendered. Clean up the task
85
88
  to stop the showing.
89
+
90
+ @param doNotAnimate boolean | nil
86
91
  @return MaidTask
87
92
  ]=]
88
- function GuiVisibleManager:CreateShowHandle()
93
+ function GuiVisibleManager:CreateShowHandle(doNotAnimate)
89
94
  assert(self._showHandles, "Not initialized yet")
90
95
 
91
96
  local key = HttpService:GenerateGUID(false)
92
97
 
93
98
  self._showHandles[key] = true
94
- self:_updatePaneVisible()
99
+ self:_updatePaneVisible(doNotAnimate)
95
100
 
96
101
  return {
97
102
  Destroy = function()
@@ -107,8 +112,12 @@ function GuiVisibleManager:CreateShowHandle()
107
112
  };
108
113
  end
109
114
 
110
- function GuiVisibleManager:_updatePaneVisible()
111
- self._paneVisible.Value = next(self._showHandles) ~= nil
115
+ function GuiVisibleManager:_updatePaneVisible(doNotAnimate)
116
+ local nextValue = next(self._showHandles) ~= nil
117
+ if nextValue ~= self._paneVisible.Value then
118
+ self._nextDoNotAnimate = doNotAnimate
119
+ self._paneVisible.Value = nextValue
120
+ end
112
121
  end
113
122
 
114
123
  function GuiVisibleManager:_onPaneVisibleChanged()
@@ -142,11 +151,14 @@ function GuiVisibleManager:_handleNewPane(maid, pane)
142
151
  maid:GiveTask(pane)
143
152
 
144
153
  local function updateVisible()
154
+ local doNotAnimate = self._nextDoNotAnimate
155
+ self._nextDoNotAnimate = false
156
+
145
157
  if self._paneVisible.Value then
146
- pane:Show()
158
+ pane:Show(doNotAnimate)
147
159
  maid._hideTask = nil
148
160
  else
149
- pane:Hide()
161
+ pane:Hide(doNotAnimate)
150
162
 
151
163
  -- cleanup after a given amount of time
152
164
  maid._hideTask = cancellableDelay(self._maxHideTime, function()