@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.
- package/out/client/touch-button.luau +36 -18
- package/package.json +1 -1
|
@@ -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 =
|
|
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
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
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
|