@rbxts/touch-button 1.0.1 → 1.0.3

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.
@@ -20,6 +20,6 @@ export declare class TouchButton {
20
20
  setConfig(config: TouchButtonConfig): void;
21
21
  private scheduleConfigUpdate;
22
22
  private updateConfig;
23
- private resetConfigToDefault;
23
+ resetConfigToDefault(): void;
24
24
  destroy(): void;
25
25
  }
@@ -139,27 +139,6 @@ do
139
139
  touchBtn.ImageColor3 = EDITING_MODE_BUTTON_COLOR
140
140
  iconImage.ImageColor3 = EDITING_MODE_BUTTON_COLOR
141
141
  do
142
- local resetBtn = Instance.new("TextButton")
143
- resetBtn.Name = "Reset"
144
- resetBtn.AnchorPoint = Vector2.new(0.5, 0.5)
145
- resetBtn.BackgroundColor3 = Color3.new()
146
- resetBtn.BackgroundTransparency = 0.25
147
- resetBtn.FontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Medium, Enum.FontStyle.Normal)
148
- resetBtn.Position = UDim2.fromScale(0.5, 0.5)
149
- resetBtn.Size = UDim2.fromOffset(120, 32)
150
- resetBtn.Text = "Reset Buttons"
151
- resetBtn.TextColor3 = Color3.new(1, 1, 1)
152
- resetBtn.TextSize = 16
153
- resetBtn.Parent = touchGui
154
- editingTrove:add(resetBtn)
155
- local UICorner = Instance.new("UICorner")
156
- UICorner.CornerRadius = UDim.new(0, 5)
157
- UICorner.Parent = resetBtn
158
- resetBtn.MouseButton1Click:Connect(function()
159
- for _1, touchBtn in TouchButton.touchButtons do
160
- touchBtn:resetConfigToDefault()
161
- end
162
- end)
163
142
  end
164
143
  local resizeBtn = Instance.new("ImageButton")
165
144
  resizeBtn.AnchorPoint = Vector2.new(0.5, 0.5)
@@ -288,10 +267,44 @@ do
288
267
  end
289
268
  function TouchButton:destroy()
290
269
  self.touchBtn:Destroy()
270
+ local _touchButtons = TouchButton.touchButtons
271
+ local _touchButtons_1 = TouchButton.touchButtons
272
+ local _self = self
273
+ local _arg0 = (table.find(_touchButtons_1, _self) or 0) - 1
274
+ table.remove(_touchButtons, _arg0 + 1)
291
275
  end
292
276
  TouchButton.configEditingMode = atom(false)
293
277
  TouchButton.touchButtons = {}
294
278
  end
279
+ local editingTrove = Trove.new()
280
+ effect(function()
281
+ local isEditing = TouchButton.configEditingMode()
282
+ if isEditing then
283
+ local resetBtn = Instance.new("TextButton")
284
+ resetBtn.Name = "Reset"
285
+ resetBtn.AnchorPoint = Vector2.new(0.5, 0.5)
286
+ resetBtn.BackgroundColor3 = Color3.new()
287
+ resetBtn.BackgroundTransparency = 0.25
288
+ resetBtn.FontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Medium, Enum.FontStyle.Normal)
289
+ resetBtn.Position = UDim2.fromScale(0.5, 0.5)
290
+ resetBtn.Size = UDim2.fromOffset(120, 32)
291
+ resetBtn.Text = "Reset Buttons"
292
+ resetBtn.TextColor3 = Color3.new(1, 1, 1)
293
+ resetBtn.TextSize = 16
294
+ resetBtn.Parent = touchGui
295
+ editingTrove:add(resetBtn)
296
+ local UICorner = Instance.new("UICorner")
297
+ UICorner.CornerRadius = UDim.new(0, 5)
298
+ UICorner.Parent = resetBtn
299
+ resetBtn.MouseButton1Click:Connect(function()
300
+ for _, touchBtn in TouchButton.touchButtons do
301
+ touchBtn:resetConfigToDefault()
302
+ end
303
+ end)
304
+ else
305
+ editingTrove:clean()
306
+ end
307
+ end)
295
308
  return {
296
309
  TouchButton = TouchButton,
297
310
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/touch-button",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "out/init.lua",
6
6
  "scripts": {