@rbxts/touch-button 1.0.5 → 1.0.7

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.
@@ -133,9 +133,11 @@ do
133
133
  end)
134
134
  end)
135
135
  local editingTrove = Trove.new()
136
+ local lastActive = touchBtn.Active
136
137
  effect(function()
137
138
  local isEditing = TouchButton.configEditingMode()
138
139
  if isEditing then
140
+ lastActive = touchBtn.Active
139
141
  touchBtn.Active = true
140
142
  touchBtn.ImageColor3 = EDITING_MODE_BUTTON_COLOR
141
143
  iconImage.ImageColor3 = EDITING_MODE_BUTTON_COLOR
@@ -207,7 +209,7 @@ do
207
209
  end))
208
210
  else
209
211
  editingTrove:clean()
210
- touchBtn.Active = false
212
+ touchBtn.Active = lastActive
211
213
  touchBtn.ImageColor3 = Color3.fromRGB(255, 255, 255)
212
214
  iconImage.ImageColor3 = Color3.fromRGB(255, 255, 255)
213
215
  end
@@ -239,27 +241,43 @@ do
239
241
  effect(function()
240
242
  local isEditing = TouchButton.configEditingMode()
241
243
  if isEditing then
242
- local resetBtn = Instance.new("TextButton")
243
- resetBtn.Name = "Reset"
244
- resetBtn.AnchorPoint = Vector2.new(0.5, 0.5)
245
- resetBtn.BackgroundColor3 = Color3.new()
246
- resetBtn.BackgroundTransparency = 0.25
247
- resetBtn.FontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Medium, Enum.FontStyle.Normal)
248
- resetBtn.Position = UDim2.fromScale(0.5, 0.5)
249
- resetBtn.Size = UDim2.fromOffset(120, 32)
250
- resetBtn.Text = "Reset Buttons"
251
- resetBtn.TextColor3 = Color3.new(1, 1, 1)
252
- resetBtn.TextSize = 16
253
- resetBtn.Parent = touchGui
254
- editingTrove:add(resetBtn)
255
- local UICorner = Instance.new("UICorner")
256
- UICorner.CornerRadius = UDim.new(0, 5)
257
- UICorner.Parent = resetBtn
258
- resetBtn.MouseButton1Click:Connect(function()
244
+ local createButton = function(props)
245
+ local btn = Instance.new("TextButton")
246
+ btn.Name = props.name
247
+ btn.AnchorPoint = Vector2.new(0.5, 0.5)
248
+ btn.BackgroundColor3 = Color3.new()
249
+ btn.BackgroundTransparency = 0.25
250
+ btn.FontFace = Font.new("rbxasset://fonts/families/GothamSSm.json", Enum.FontWeight.Medium, Enum.FontStyle.Normal)
251
+ btn.Position = UDim2.new(0.5, 0, 0.5, props.offsetY)
252
+ btn.Size = UDim2.fromOffset(120, 32)
253
+ btn.Text = props.text
254
+ btn.TextColor3 = Color3.new(1, 1, 1)
255
+ btn.TextSize = 16
256
+ btn.Parent = touchGui
257
+ editingTrove:add(btn)
258
+ local UICorner = Instance.new("UICorner")
259
+ UICorner.CornerRadius = UDim.new(0, 5)
260
+ UICorner.Parent = btn
261
+ return btn
262
+ end
263
+ createButton({
264
+ name = "Reset",
265
+ text = "Reset Buttons",
266
+ backgroundColor = Color3.new(),
267
+ offsetY = -19,
268
+ }).MouseButton1Click:Connect(function()
259
269
  for _, touchBtn in TouchButton.touchButtons do
260
270
  touchBtn:resetConfigToDefault()
261
271
  end
262
272
  end)
273
+ createButton({
274
+ name = "Finish",
275
+ text = "Finish Editing",
276
+ backgroundColor = Color3.fromRGB(30, 175, 30),
277
+ offsetY = 19,
278
+ }).MouseButton1Click:Connect(function()
279
+ self.configEditingMode(false)
280
+ end)
263
281
  else
264
282
  editingTrove:clean()
265
283
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/touch-button",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "",
5
5
  "main": "out/init.lua",
6
6
  "scripts": {