Update annotations: back_handler and blocker

This commit is contained in:
Insality
2020-10-11 23:25:23 +03:00
parent 62cca31b28
commit 5ff6b69dd4
18 changed files with 57 additions and 34 deletions

View File

@@ -1,13 +1,14 @@
--- Component to handle back key (android, backspace)
-- @module druid.back_handler
-- @module BackHandler
-- @within BaseComponent
-- @alias druid.back_handler
--- Component events
-- @table Events
-- @tfield druid_event on_back On back handler callback
--- On back handler callback(self, params)
-- @tfield druid_event on_back
--- Params to back callback
-- @tfield any params
--- Component fields
-- @table Fields
-- @tfield any params Params to click callbacks
local Event = require("druid.event")
local const = require("druid.const")
@@ -17,21 +18,20 @@ local BackHandler = component.create("back_handler", { const.ON_INPUT })
--- Component init function
-- @function back_handler:init
-- @tparam BackHandler self
-- @tparam callback callback On back button
-- @tparam[opt] params Callback argument
function BackHandler:init(callback, params)
-- @tparam[opt] any params Callback argument
function BackHandler.init(self, callback, params)
self.params = params
self.on_back = Event(callback)
end
--- Input handler for component
-- @function back_handler:on_input
-- @tparam BackHandler self
-- @tparam string action_id on_input action id
-- @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
return false
end

View File

@@ -1,16 +1,12 @@
--- Component to block input on specify zone by node
-- @module druid.blocker
-- @module Blocker
-- @within BaseComponent
-- @alias druid.blocker
--- Component events
-- @table Events
-- @tfield druid_event on_click On release button callback
-- @tfield druid_event on_enable_change On enable/disable callback
---Trigger node
-- @tfield node node
--- Component fields
-- @table Fields
-- @tfield node node Trigger node
local Event = require("druid.event")
local const = require("druid.const")
local component = require("druid.component")
@@ -18,17 +14,14 @@ local Blocker = component.create("blocker", { const.ON_INPUT })
--- Component init function
-- @function blocker:init
-- @tparam Blocker self
-- @tparam node node Gui node
function Blocker:init(node)
function Blocker.init(self, node)
self.node = self:get_node(node)
self.on_click = Event()
self.on_enable_change = Event()
end
function Blocker:on_input(action_id, action)
function Blocker.on_input(self, action_id, action)
if action_id ~= const.ACTION_TOUCH and
action_id ~= const.ACTION_MULTITOUCH and
action_id ~= nil then
@@ -48,17 +41,17 @@ end
--- Set enabled blocker component state
-- @function blocker:set_enabled
-- @tparam Blocker self
-- @tparam bool state Enabled state
function Blocker:set_enabled(state)
function Blocker.set_enabled(self, state)
gui.set_enabled(self.node, state)
end
--- Return blocked enabled state
-- @function blocker:is_enabled
-- @tparam Blocker self
-- @treturn bool True, if blocker is enabled
function Blocker:is_enabled(state)
function Blocker.is_enabled(self)
return gui.is_enabled(self.node)
end

View File

@@ -3,6 +3,8 @@
-- touched while dragging. Drag will be processed even
-- the cursor is outside of node, if drag is already started
-- @module druid.drag
-- @within BaseComponent
-- @alias druid.drag
--- Component events
-- @table Events

View File

@@ -1,5 +1,7 @@
--- Component to handle hover node interaction
-- @module druid.hover
-- @within BaseComponent
-- @alias druid.hover
--- Component events
-- @table Events

View File

@@ -6,6 +6,8 @@
-- size will be less than scroll_input size, no scroll is available. For scroll
-- parent size should be more than input size
-- @module druid.scroll
-- @within BaseComponent
-- @alias druid.scroll
--- Component events
-- @table Events

View File

@@ -1,6 +1,8 @@
--- Component to handle placing components by row and columns.
-- Grid can anchor your elements, get content size and other
-- @module druid.static_grid
-- @within BaseComponent
-- @alias druid.static_grid
--- Component events
-- @table Events

View File

@@ -2,6 +2,8 @@
-- Swipe will be triggered, if swipe was started and
-- ended on one node
-- @module druid.swipe
-- @within BaseComponent
-- @alias druid.swipe
--- Components fields
-- @table Fields

View File

@@ -2,6 +2,8 @@
-- Druid text can adjust itself for text node size
-- Text will never will be outside of his text size (even multiline)
-- @module druid.text
-- @within BaseComponent
-- @alias druid.text
--- Component events
-- @table Events