Add buttons to prevent soft-lock in keybind conf.

This commit is contained in:
Nguyễn Quốc Hưng
2024-08-09 23:40:07 +07:00
parent 1a99de7435
commit 91100883fe
5 changed files with 116 additions and 23 deletions

View File

@@ -151,13 +151,13 @@ function button:press(x, y, touchID)
end
---Trigger release action, don't need ``self._hovering`` to ``true``
function button:release(x, y, touchID)
local valid = true
local valid
if touchID then
valid = touchID == self._touchID
else
valid = true
end
if valid then
self._pressed = false
self._touchID = false
@@ -187,7 +187,7 @@ function BUTTON.checkDataValidation(D, safe)
elseif type(D.text) ~= 'string' then
error("[text] must be a string or a function returns string, got "..type(D.text))
end
assert(type(D.x) == "number" , "[x] must be a integer")
assert(type(D.y) == "number" , "[y] must be a integer")
assert(type(D.w) == "number" and D.w > 0, "[w] must be a positive integer")