mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +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)
|
||||
-- @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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,7 @@
|
||||
--- Component to handle hover node interaction
|
||||
-- @module druid.hover
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.hover
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,7 @@
|
||||
--- Druid checkbox component
|
||||
-- @module druid.checkbox
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.checkbox
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -1,5 +1,7 @@
|
||||
--- Checkbox group module
|
||||
-- @module druid.checkbox_group
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.checkbox_group
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -1,5 +1,7 @@
|
||||
--- Component to handle placing components in row
|
||||
-- @module druid.dynamic_grid
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.dynamic_grid
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -2,6 +2,8 @@
|
||||
-- Carry on user text input
|
||||
-- @author Part of code from Britzl gooey input component
|
||||
-- @module druid.input
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.input
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -1,6 +1,8 @@
|
||||
--- Component to handle all GUI texts
|
||||
-- Good working with localization system
|
||||
-- @module druid.lang_text
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.lang_text
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -1,6 +1,8 @@
|
||||
--- Basic progress bar component.
|
||||
-- For correct progress bar init it should be in max size from gui
|
||||
-- @module druid.progress
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.progress
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -1,5 +1,7 @@
|
||||
--- Radio group module
|
||||
-- @module druid.radio_group
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.radio_group
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -1,5 +1,7 @@
|
||||
--- Druid slider component
|
||||
-- @module druid.slider
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.slider
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -2,6 +2,8 @@
|
||||
-- Timer updating by game delta time. If game is not focused -
|
||||
-- timer will be not updated.
|
||||
-- @module druid.timer
|
||||
-- @within BaseComponent
|
||||
-- @alias druid.timer
|
||||
|
||||
--- Component events
|
||||
-- @table Events
|
||||
|
@ -9,8 +9,8 @@
|
||||
-- Learn Druid instance function here
|
||||
-- @module druid_instance
|
||||
-- @see Button
|
||||
-- @see druid.blocker
|
||||
-- @see druid.back_handler
|
||||
-- @see Blocker
|
||||
-- @see BackHandler
|
||||
-- @see druid.input
|
||||
-- @see druid.text
|
||||
-- @see druid.lang_text
|
||||
|
Loading…
x
Reference in New Issue
Block a user