Fix tests

This commit is contained in:
Insality 2023-02-07 18:58:24 +02:00
parent bd9b4ad58f
commit cfaeff1516
2 changed files with 8 additions and 4 deletions

View File

@ -248,6 +248,10 @@ function Button.on_input(self, action_id, action)
return false
end
if not self:is_enabled() then
return false
end
local is_pick = true
local is_key_trigger = (action_id == self.key_trigger)
if not is_key_trigger then
@ -280,7 +284,7 @@ function Button.on_input(self, action_id, action)
-- While hold button, repeat rate pick from input.repeat_interval
if action.repeated then
if not self.disabled and self.on_repeated_click:is_exist() and self.can_action then
if self.on_repeated_click:is_exist() and self.can_action then
on_button_repeated_click(self)
return true
end
@ -290,7 +294,7 @@ function Button.on_input(self, action_id, action)
return on_button_release(self)
end
if not self.disabled and self.can_action and self.on_long_click:is_exist() then
if self.can_action and self.on_long_click:is_exist() then
local press_time = socket.gettime() - self.last_pressed_time
if self.style.AUTOHOLD_TRIGGER <= press_time then

View File

@ -11,7 +11,7 @@ return function()
local function create_drag_instance(on_drag)
local button = mock_gui.add_box("button", 0, 0, 20, 20)
local instance = druid:new_drag(button, on_drag)
instance.style.IS_USE_SCREEN_KOEF = false
instance.style.NO_USE_SCREEN_KOEF = true
instance.style.DRAG_DEADZONE = 4
return instance
end