mirror of
https://github.com/Insality/druid.git
synced 2025-06-27 10:27:47 +02:00
Update button hold callback
This commit is contained in:
parent
067b650838
commit
a5e579ddaa
@ -1952,6 +1952,8 @@ function helper.table_to_string(t) end
|
|||||||
|
|
||||||
-- Manual Annotations --
|
-- Manual Annotations --
|
||||||
|
|
||||||
|
---@class druid.component: druid.base_component
|
||||||
|
|
||||||
---@class druid.rich_text.metrics
|
---@class druid.rich_text.metrics
|
||||||
---@field width number
|
---@field width number
|
||||||
---@field height number
|
---@field height number
|
||||||
|
@ -240,7 +240,12 @@ local function on_button_release(self)
|
|||||||
is_double_click = is_double_click and self.on_double_click:is_exist()
|
is_double_click = is_double_click and self.on_double_click:is_exist()
|
||||||
|
|
||||||
if is_long_click then
|
if is_long_click then
|
||||||
|
local is_hold_complete = (time - self.last_pressed_time) >= self.style.AUTOHOLD_TRIGGER
|
||||||
|
if is_hold_complete then
|
||||||
on_button_long_click(self)
|
on_button_long_click(self)
|
||||||
|
else
|
||||||
|
self.on_click_outside:trigger(self:get_context(), self.params, self)
|
||||||
|
end
|
||||||
elseif is_double_click then
|
elseif is_double_click then
|
||||||
on_button_double_click(self)
|
on_button_double_click(self)
|
||||||
else
|
else
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
local component = require("druid.component")
|
local component = require("druid.component")
|
||||||
|
|
||||||
---@class {COMPONENT_TYPE}: druid.base_component
|
---@class {COMPONENT_TYPE}: druid.component
|
||||||
---@field druid druid_instance{COMPONENT_ANNOTATIONS}
|
---@field druid druid_instance{COMPONENT_ANNOTATIONS}
|
||||||
local M = component.create("{COMPONENT_TYPE}")
|
local M = component.create("{COMPONENT_TYPE}")
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
-- Manual Annotations --
|
-- Manual Annotations --
|
||||||
|
|
||||||
|
---@class druid.component: druid.base_component
|
||||||
|
|
||||||
---@class druid.rich_text.metrics
|
---@class druid.rich_text.metrics
|
||||||
---@field width number
|
---@field width number
|
||||||
---@field height number
|
---@field height number
|
||||||
|
Loading…
x
Reference in New Issue
Block a user