mirror of
https://github.com/Insality/druid
synced 2025-06-27 18:37:45 +02:00
Update annotations: back_handler and blocker
This commit is contained in:
parent
62cca31b28
commit
5ff6b69dd4
@ -1,13 +1,14 @@
|
|||||||
--- Component to handle back key (android, backspace)
|
--- Component to handle back key (android, backspace)
|
||||||
-- @module druid.back_handler
|
-- @module BackHandler
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.back_handler
|
||||||
|
|
||||||
--- Component events
|
--- On back handler callback(self, params)
|
||||||
-- @table Events
|
-- @tfield druid_event on_back
|
||||||
-- @tfield druid_event on_back On back handler callback
|
|
||||||
|
--- Params to back callback
|
||||||
|
-- @tfield any params
|
||||||
|
|
||||||
--- Component fields
|
|
||||||
-- @table Fields
|
|
||||||
-- @tfield any params Params to click callbacks
|
|
||||||
|
|
||||||
local Event = require("druid.event")
|
local Event = require("druid.event")
|
||||||
local const = require("druid.const")
|
local const = require("druid.const")
|
||||||
@ -17,21 +18,20 @@ local BackHandler = component.create("back_handler", { const.ON_INPUT })
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @function back_handler:init
|
-- @tparam BackHandler self
|
||||||
-- @tparam callback callback On back button
|
-- @tparam callback callback On back button
|
||||||
-- @tparam[opt] params Callback argument
|
-- @tparam[opt] any params Callback argument
|
||||||
function BackHandler:init(callback, params)
|
function BackHandler.init(self, callback, params)
|
||||||
self.params = params
|
self.params = params
|
||||||
|
|
||||||
self.on_back = Event(callback)
|
self.on_back = Event(callback)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Input handler for component
|
--- Input handler for component
|
||||||
-- @function back_handler:on_input
|
-- @tparam BackHandler self
|
||||||
-- @tparam string action_id on_input action id
|
-- @tparam string action_id on_input action id
|
||||||
-- @tparam table action on_input action
|
-- @tparam table action on_input action
|
||||||
function BackHandler:on_input(action_id, action)
|
function BackHandler.on_input(self, action_id, action)
|
||||||
if not action[const.RELEASED] then
|
if not action[const.RELEASED] then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
--- Component to block input on specify zone by node
|
--- Component to block input on specify zone by node
|
||||||
-- @module druid.blocker
|
-- @module Blocker
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.blocker
|
||||||
|
|
||||||
--- Component events
|
---Trigger node
|
||||||
-- @table Events
|
-- @tfield node node
|
||||||
-- @tfield druid_event on_click On release button callback
|
|
||||||
-- @tfield druid_event on_enable_change On enable/disable callback
|
|
||||||
|
|
||||||
--- Component fields
|
|
||||||
-- @table Fields
|
|
||||||
-- @tfield node node Trigger node
|
|
||||||
|
|
||||||
local Event = require("druid.event")
|
|
||||||
local const = require("druid.const")
|
local const = require("druid.const")
|
||||||
local component = require("druid.component")
|
local component = require("druid.component")
|
||||||
|
|
||||||
@ -18,17 +14,14 @@ local Blocker = component.create("blocker", { const.ON_INPUT })
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @function blocker:init
|
-- @tparam Blocker self
|
||||||
-- @tparam node node Gui node
|
-- @tparam node node Gui node
|
||||||
function Blocker:init(node)
|
function Blocker.init(self, node)
|
||||||
self.node = self:get_node(node)
|
self.node = self:get_node(node)
|
||||||
|
|
||||||
self.on_click = Event()
|
|
||||||
self.on_enable_change = Event()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function Blocker:on_input(action_id, action)
|
function Blocker.on_input(self, action_id, action)
|
||||||
if action_id ~= const.ACTION_TOUCH and
|
if action_id ~= const.ACTION_TOUCH and
|
||||||
action_id ~= const.ACTION_MULTITOUCH and
|
action_id ~= const.ACTION_MULTITOUCH and
|
||||||
action_id ~= nil then
|
action_id ~= nil then
|
||||||
@ -48,17 +41,17 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set enabled blocker component state
|
--- Set enabled blocker component state
|
||||||
-- @function blocker:set_enabled
|
-- @tparam Blocker self
|
||||||
-- @tparam bool state Enabled state
|
-- @tparam bool state Enabled state
|
||||||
function Blocker:set_enabled(state)
|
function Blocker.set_enabled(self, state)
|
||||||
gui.set_enabled(self.node, state)
|
gui.set_enabled(self.node, state)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Return blocked enabled state
|
--- Return blocked enabled state
|
||||||
-- @function blocker:is_enabled
|
-- @tparam Blocker self
|
||||||
-- @treturn bool True, if blocker is enabled
|
-- @treturn bool True, if blocker is enabled
|
||||||
function Blocker:is_enabled(state)
|
function Blocker.is_enabled(self)
|
||||||
return gui.is_enabled(self.node)
|
return gui.is_enabled(self.node)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
-- touched while dragging. Drag will be processed even
|
-- touched while dragging. Drag will be processed even
|
||||||
-- the cursor is outside of node, if drag is already started
|
-- the cursor is outside of node, if drag is already started
|
||||||
-- @module druid.drag
|
-- @module druid.drag
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.drag
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
--- Component to handle hover node interaction
|
--- Component to handle hover node interaction
|
||||||
-- @module druid.hover
|
-- @module druid.hover
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.hover
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
-- size will be less than scroll_input size, no scroll is available. For scroll
|
-- size will be less than scroll_input size, no scroll is available. For scroll
|
||||||
-- parent size should be more than input size
|
-- parent size should be more than input size
|
||||||
-- @module druid.scroll
|
-- @module druid.scroll
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.scroll
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
--- Component to handle placing components by row and columns.
|
--- Component to handle placing components by row and columns.
|
||||||
-- Grid can anchor your elements, get content size and other
|
-- Grid can anchor your elements, get content size and other
|
||||||
-- @module druid.static_grid
|
-- @module druid.static_grid
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.static_grid
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
-- Swipe will be triggered, if swipe was started and
|
-- Swipe will be triggered, if swipe was started and
|
||||||
-- ended on one node
|
-- ended on one node
|
||||||
-- @module druid.swipe
|
-- @module druid.swipe
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.swipe
|
||||||
|
|
||||||
--- Components fields
|
--- Components fields
|
||||||
-- @table Fields
|
-- @table Fields
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
-- Druid text can adjust itself for text node size
|
-- Druid text can adjust itself for text node size
|
||||||
-- Text will never will be outside of his text size (even multiline)
|
-- Text will never will be outside of his text size (even multiline)
|
||||||
-- @module druid.text
|
-- @module druid.text
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.text
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
--- Druid checkbox component
|
--- Druid checkbox component
|
||||||
-- @module druid.checkbox
|
-- @module druid.checkbox
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.checkbox
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
--- Checkbox group module
|
--- Checkbox group module
|
||||||
-- @module druid.checkbox_group
|
-- @module druid.checkbox_group
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.checkbox_group
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
--- Component to handle placing components in row
|
--- Component to handle placing components in row
|
||||||
-- @module druid.dynamic_grid
|
-- @module druid.dynamic_grid
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.dynamic_grid
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
-- Carry on user text input
|
-- Carry on user text input
|
||||||
-- @author Part of code from Britzl gooey input component
|
-- @author Part of code from Britzl gooey input component
|
||||||
-- @module druid.input
|
-- @module druid.input
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.input
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
--- Component to handle all GUI texts
|
--- Component to handle all GUI texts
|
||||||
-- Good working with localization system
|
-- Good working with localization system
|
||||||
-- @module druid.lang_text
|
-- @module druid.lang_text
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.lang_text
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
--- Basic progress bar component.
|
--- Basic progress bar component.
|
||||||
-- For correct progress bar init it should be in max size from gui
|
-- For correct progress bar init it should be in max size from gui
|
||||||
-- @module druid.progress
|
-- @module druid.progress
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.progress
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
--- Radio group module
|
--- Radio group module
|
||||||
-- @module druid.radio_group
|
-- @module druid.radio_group
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.radio_group
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
--- Druid slider component
|
--- Druid slider component
|
||||||
-- @module druid.slider
|
-- @module druid.slider
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.slider
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
-- Timer updating by game delta time. If game is not focused -
|
-- Timer updating by game delta time. If game is not focused -
|
||||||
-- timer will be not updated.
|
-- timer will be not updated.
|
||||||
-- @module druid.timer
|
-- @module druid.timer
|
||||||
|
-- @within BaseComponent
|
||||||
|
-- @alias druid.timer
|
||||||
|
|
||||||
--- Component events
|
--- Component events
|
||||||
-- @table Events
|
-- @table Events
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
-- Learn Druid instance function here
|
-- Learn Druid instance function here
|
||||||
-- @module druid_instance
|
-- @module druid_instance
|
||||||
-- @see Button
|
-- @see Button
|
||||||
-- @see druid.blocker
|
-- @see Blocker
|
||||||
-- @see druid.back_handler
|
-- @see BackHandler
|
||||||
-- @see druid.input
|
-- @see druid.input
|
||||||
-- @see druid.text
|
-- @see druid.text
|
||||||
-- @see druid.lang_text
|
-- @see druid.lang_text
|
||||||
|
Loading…
x
Reference in New Issue
Block a user