mirror of
https://github.com/Insality/druid
synced 2025-06-27 18:37:45 +02:00
Update doc links, update emmylua generator
This commit is contained in:
parent
a846adf97b
commit
f801bb6862
512
annotations.lua
512
annotations.lua
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,7 @@ file={"./druid",
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
package='druid'
|
package='druid'
|
||||||
sort=false
|
sort=true
|
||||||
dir='./docs'
|
dir='./docs'
|
||||||
style='!fixed'
|
style='!fixed'
|
||||||
topics={}
|
topics={}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
-- @alias druid.back_handler
|
-- @alias druid.back_handler
|
||||||
|
|
||||||
--- On back handler callback(self, params)
|
--- On back handler callback(self, params)
|
||||||
-- @tfield druid_event on_back
|
-- @tfield DruidEvent on_back @{DruidEvent}
|
||||||
|
|
||||||
--- Params to back callback
|
--- Params to back callback
|
||||||
-- @tfield any params
|
-- @tfield any params
|
||||||
@ -21,7 +21,7 @@ local BackHandler = component.create("back_handler")
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam BackHandler self
|
-- @tparam BackHandler self @{BackHandler}
|
||||||
-- @tparam callback callback On back button
|
-- @tparam callback callback On back button
|
||||||
-- @tparam[opt] any params Callback argument
|
-- @tparam[opt] any params Callback argument
|
||||||
function BackHandler.init(self, callback, params)
|
function BackHandler.init(self, callback, params)
|
||||||
@ -31,7 +31,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Input handler for component
|
--- Input handler for component
|
||||||
-- @tparam BackHandler self
|
-- @tparam BackHandler self @{BackHandler}
|
||||||
-- @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(self, action_id, action)
|
function BackHandler.on_input(self, action_id, action)
|
||||||
|
@ -17,7 +17,7 @@ local Blocker = component.create("blocker")
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Blocker self
|
-- @tparam Blocker self @{Blocker}
|
||||||
-- @tparam node node Gui node
|
-- @tparam node node Gui node
|
||||||
function Blocker.init(self, node)
|
function Blocker.init(self, node)
|
||||||
self.node = self:get_node(node)
|
self.node = self:get_node(node)
|
||||||
@ -44,7 +44,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set enabled blocker component state
|
--- Set enabled blocker component state
|
||||||
-- @tparam Blocker self
|
-- @tparam Blocker self @{Blocker}
|
||||||
-- @tparam bool state Enabled state
|
-- @tparam bool state Enabled state
|
||||||
function Blocker.set_enabled(self, state)
|
function Blocker.set_enabled(self, state)
|
||||||
gui.set_enabled(self.node, state)
|
gui.set_enabled(self.node, state)
|
||||||
@ -52,7 +52,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return blocked enabled state
|
--- Return blocked enabled state
|
||||||
-- @tparam Blocker self
|
-- @tparam Blocker self @{Blocker}
|
||||||
-- @treturn bool True, if blocker is enabled
|
-- @treturn bool True, if blocker is enabled
|
||||||
function Blocker.is_enabled(self)
|
function Blocker.is_enabled(self)
|
||||||
return gui.is_enabled(self.node)
|
return gui.is_enabled(self.node)
|
||||||
|
@ -6,22 +6,22 @@
|
|||||||
-- @alias druid.button
|
-- @alias druid.button
|
||||||
|
|
||||||
--- On release button callback(self, params, button_instance)
|
--- On release button callback(self, params, button_instance)
|
||||||
-- @tfield druid_event on_click
|
-- @tfield DruidEvent on_click @{DruidEvent}
|
||||||
|
|
||||||
--- On repeated action button callback(self, params, button_instance, click_amount)
|
--- On repeated action button callback(self, params, button_instance, click_amount)
|
||||||
-- @tfield druid_event on_repeated_click
|
-- @tfield DruidEvent on_repeated_click @{DruidEvent}
|
||||||
|
|
||||||
---On long tap button callback(self, params, button_instance, time)
|
---On long tap button callback(self, params, button_instance, time)
|
||||||
-- @tfield druid_event on_long_click
|
-- @tfield DruidEvent on_long_click @{DruidEvent}
|
||||||
|
|
||||||
---On double tap button callback(self, params, button_instance, click_amount)
|
---On double tap button callback(self, params, button_instance, click_amount)
|
||||||
-- @tfield druid_event on_double_click
|
-- @tfield DruidEvent on_double_click @{DruidEvent}
|
||||||
|
|
||||||
---On button hold before long_click callback(self, params, button_instance, time)
|
---On button hold before long_click callback(self, params, button_instance, time)
|
||||||
-- @tfield druid_event on_hold_callback
|
-- @tfield DruidEvent on_hold_callback @{DruidEvent}
|
||||||
|
|
||||||
---On click outside of button(self, params, button_instance)
|
---On click outside of button(self, params, button_instance)
|
||||||
-- @tfield druid_event on_click_outside
|
-- @tfield DruidEvent on_click_outside @{DruidEvent}
|
||||||
|
|
||||||
---Trigger node
|
---Trigger node
|
||||||
-- @tfield node node
|
-- @tfield node node
|
||||||
@ -45,7 +45,7 @@
|
|||||||
-- @tfield any params
|
-- @tfield any params
|
||||||
|
|
||||||
---Druid hover logic component
|
---Druid hover logic component
|
||||||
-- @tfield druid.hover hover
|
-- @tfield Hover hover @{Hover}
|
||||||
|
|
||||||
---Restriction zone
|
---Restriction zone
|
||||||
-- @tfield[opt] node click_zone
|
-- @tfield[opt] node click_zone
|
||||||
@ -193,7 +193,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Button self
|
-- @tparam Button self @{Button}
|
||||||
-- @tparam node node Gui node
|
-- @tparam node node Gui node
|
||||||
-- @tparam function callback Button callback
|
-- @tparam function callback Button callback
|
||||||
-- @tparam[opt] table params Button callback params
|
-- @tparam[opt] table params Button callback params
|
||||||
@ -339,7 +339,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set enabled button component state
|
--- Set enabled button component state
|
||||||
-- @tparam Button self
|
-- @tparam Button self @{Button}
|
||||||
-- @tparam bool state Enabled state
|
-- @tparam bool state Enabled state
|
||||||
-- @treturn Button Current button instance
|
-- @treturn Button Current button instance
|
||||||
function Button.set_enabled(self, state)
|
function Button.set_enabled(self, state)
|
||||||
@ -352,7 +352,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return button enabled state
|
--- Return button enabled state
|
||||||
-- @tparam Button self
|
-- @tparam Button self @{Button}
|
||||||
-- @treturn bool True, if button is enabled
|
-- @treturn bool True, if button is enabled
|
||||||
function Button.is_enabled(self)
|
function Button.is_enabled(self)
|
||||||
return not self.disabled
|
return not self.disabled
|
||||||
@ -361,7 +361,7 @@ end
|
|||||||
|
|
||||||
--- Strict button click area. Useful for
|
--- Strict button click area. Useful for
|
||||||
-- no click events outside stencil node
|
-- no click events outside stencil node
|
||||||
-- @tparam Button self
|
-- @tparam Button self @{Button}
|
||||||
-- @tparam node zone Gui node
|
-- @tparam node zone Gui node
|
||||||
-- @treturn Button Current button instance
|
-- @treturn Button Current button instance
|
||||||
function Button.set_click_zone(self, zone)
|
function Button.set_click_zone(self, zone)
|
||||||
@ -373,7 +373,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set key-code to trigger this button
|
--- Set key-code to trigger this button
|
||||||
-- @tparam Button self
|
-- @tparam Button self @{Button}
|
||||||
-- @tparam hash key The action_id of the key
|
-- @tparam hash key The action_id of the key
|
||||||
-- @treturn Button Current button instance
|
-- @treturn Button Current button instance
|
||||||
function Button.set_key_trigger(self, key)
|
function Button.set_key_trigger(self, key)
|
||||||
|
@ -9,19 +9,19 @@
|
|||||||
-- @alias druid.drag
|
-- @alias druid.drag
|
||||||
|
|
||||||
--- Event on touch start callback(self)
|
--- Event on touch start callback(self)
|
||||||
-- @tfield druid_event on_touch_start
|
-- @tfield DruidEvent on_touch_start @{DruidEvent}
|
||||||
|
|
||||||
--- Event on touch end callback(self)
|
--- Event on touch end callback(self)
|
||||||
-- @tfield druid_event on_touch_end
|
-- @tfield DruidEvent on_touch_end @{DruidEvent}
|
||||||
|
|
||||||
--- Event on drag start callback(self)
|
--- Event on drag start callback(self)
|
||||||
-- @tfield druid_event on_drag_start
|
-- @tfield DruidEvent on_drag_start @{DruidEvent}
|
||||||
|
|
||||||
--- on drag progress callback(self, dx, dy)
|
--- on drag progress callback(self, dx, dy)
|
||||||
-- @tfield druid_event on_drag Event
|
-- @tfield DruidEvent on_drag Event @{DruidEvent}
|
||||||
|
|
||||||
--- Event on drag end callback(self)
|
--- Event on drag end callback(self)
|
||||||
-- @tfield druid_event on_drag_end
|
-- @tfield DruidEvent on_drag_end @{DruidEvent}
|
||||||
|
|
||||||
--- Is component now touching
|
--- Is component now touching
|
||||||
-- @tfield bool is_touch
|
-- @tfield bool is_touch
|
||||||
@ -162,7 +162,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Drag component constructor
|
--- Drag component constructor
|
||||||
-- @tparam Drag self
|
-- @tparam Drag self @{Drag}
|
||||||
-- @tparam node node GUI node to detect dragging
|
-- @tparam node node GUI node to detect dragging
|
||||||
-- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy)
|
-- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy)
|
||||||
function Drag.init(self, node, on_drag_callback)
|
function Drag.init(self, node, on_drag_callback)
|
||||||
@ -277,7 +277,7 @@ end
|
|||||||
|
|
||||||
--- Strict drag click area. Useful for
|
--- Strict drag click area. Useful for
|
||||||
-- restrict events outside stencil node
|
-- restrict events outside stencil node
|
||||||
-- @tparam Drag self
|
-- @tparam Drag self @{Drag}
|
||||||
-- @tparam node node Gui node
|
-- @tparam node node Gui node
|
||||||
function Drag.set_click_zone(self, node)
|
function Drag.set_click_zone(self, node)
|
||||||
self.click_zone = self:get_node(node)
|
self.click_zone = self:get_node(node)
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
-- @alias druid.hover
|
-- @alias druid.hover
|
||||||
|
|
||||||
--- On hover callback(self, state)
|
--- On hover callback(self, state)
|
||||||
-- @tfield druid_event on_hover
|
-- @tfield DruidEvent on_hover @{DruidEvent}
|
||||||
|
|
||||||
--- On mouse hover callback(self, state)
|
--- On mouse hover callback(self, state)
|
||||||
-- @tfield druid_event on_mouse_hover
|
-- @tfield DruidEvent on_mouse_hover @{DruidEvent}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ local Hover = component.create("hover")
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Hover self
|
-- @tparam Hover self @{Hover}
|
||||||
-- @tparam node node Gui node
|
-- @tparam node node Gui node
|
||||||
-- @tparam function on_hover_callback Hover callback
|
-- @tparam function on_hover_callback Hover callback
|
||||||
function Hover.init(self, node, on_hover_callback)
|
function Hover.init(self, node, on_hover_callback)
|
||||||
@ -90,7 +90,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set hover state
|
--- Set hover state
|
||||||
-- @tparam Hover self
|
-- @tparam Hover self @{Hover}
|
||||||
-- @tparam bool state The hover state
|
-- @tparam bool state The hover state
|
||||||
function Hover.set_hover(self, state)
|
function Hover.set_hover(self, state)
|
||||||
if self._is_hovered ~= state then
|
if self._is_hovered ~= state then
|
||||||
@ -100,7 +100,7 @@ function Hover.set_hover(self, state)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Set mouse hover state
|
--- Set mouse hover state
|
||||||
-- @tparam Hover self
|
-- @tparam Hover self @{Hover}
|
||||||
-- @tparam bool state The mouse hover state
|
-- @tparam bool state The mouse hover state
|
||||||
function Hover.set_mouse_hover(self, state)
|
function Hover.set_mouse_hover(self, state)
|
||||||
if self._is_mouse_hovered ~= state then
|
if self._is_mouse_hovered ~= state then
|
||||||
@ -112,7 +112,7 @@ end
|
|||||||
|
|
||||||
--- Strict hover click area. Useful for
|
--- Strict hover click area. Useful for
|
||||||
-- no click events outside stencil node
|
-- no click events outside stencil node
|
||||||
-- @tparam Hover self
|
-- @tparam Hover self @{Hover}
|
||||||
-- @tparam node zone Gui node
|
-- @tparam node zone Gui node
|
||||||
function Hover.set_click_zone(self, zone)
|
function Hover.set_click_zone(self, zone)
|
||||||
self.click_zone = self:get_node(zone)
|
self.click_zone = self:get_node(zone)
|
||||||
@ -122,7 +122,7 @@ end
|
|||||||
--- Set enable state of hover component.
|
--- Set enable state of hover component.
|
||||||
-- If hover is not enabled, it will not generate
|
-- If hover is not enabled, it will not generate
|
||||||
-- any hover events
|
-- any hover events
|
||||||
-- @tparam Hover self
|
-- @tparam Hover self @{Hover}
|
||||||
-- @tparam bool state The hover enabled state
|
-- @tparam bool state The hover enabled state
|
||||||
function Hover.set_enabled(self, state)
|
function Hover.set_enabled(self, state)
|
||||||
self._is_enabled = state
|
self._is_enabled = state
|
||||||
@ -139,7 +139,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return current hover enabled state
|
--- Return current hover enabled state
|
||||||
-- @tparam Hover self
|
-- @tparam Hover self @{Hover}
|
||||||
-- @treturn bool The hover enabled state
|
-- @treturn bool The hover enabled state
|
||||||
function Hover.is_enabled(self)
|
function Hover.is_enabled(self)
|
||||||
return self._is_enabled
|
return self._is_enabled
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
|
|
||||||
|
|
||||||
--- On scroll move callback(self, position)
|
--- On scroll move callback(self, position)
|
||||||
-- @tfield druid_event on_scroll
|
-- @tfield DruidEvent on_scroll @{DruidEvent}
|
||||||
|
|
||||||
--- On scroll_to function callback(self, target, is_instant)
|
--- On scroll_to function callback(self, target, is_instant)
|
||||||
-- @tfield druid_event on_scroll_to
|
-- @tfield DruidEvent on_scroll_to @{DruidEvent}
|
||||||
|
|
||||||
--- On scroll_to_index function callback(self, index, point)
|
--- On scroll_to_index function callback(self, index, point)
|
||||||
-- @tfield druid_event on_point_scroll
|
-- @tfield DruidEvent on_point_scroll @{DruidEvent}
|
||||||
|
|
||||||
--- Scroll view node
|
--- Scroll view node
|
||||||
-- @tfield node view_node
|
-- @tfield node view_node
|
||||||
@ -46,7 +46,7 @@
|
|||||||
-- @tfield vector3 available_size
|
-- @tfield vector3 available_size
|
||||||
|
|
||||||
--- Drag Druid component
|
--- Drag Druid component
|
||||||
-- @tfield Drag drag
|
-- @tfield Drag drag @{Drag}
|
||||||
|
|
||||||
--- Current index of points of interests
|
--- Current index of points of interests
|
||||||
-- @tfield[opt] number selected
|
-- @tfield[opt] number selected
|
||||||
@ -133,7 +133,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Scroll constructor
|
--- Scroll constructor
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam node view_node GUI view scroll node
|
-- @tparam node view_node GUI view scroll node
|
||||||
-- @tparam node content_node GUI content scroll node
|
-- @tparam node content_node GUI content scroll node
|
||||||
function Scroll.init(self, view_node, content_node)
|
function Scroll.init(self, view_node, content_node)
|
||||||
@ -211,7 +211,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Start scroll to target point.
|
--- Start scroll to target point.
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam vector3 point Target point
|
-- @tparam vector3 point Target point
|
||||||
-- @tparam[opt] bool is_instant Instant scroll flag
|
-- @tparam[opt] bool is_instant Instant scroll flag
|
||||||
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
|
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
|
||||||
@ -245,7 +245,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Scroll to item in scroll by point index.
|
--- Scroll to item in scroll by point index.
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam number index Point index
|
-- @tparam number index Point index
|
||||||
-- @tparam[opt] bool skip_cb If true, skip the point callback
|
-- @tparam[opt] bool skip_cb If true, skip the point callback
|
||||||
function Scroll.scroll_to_index(self, index, skip_cb)
|
function Scroll.scroll_to_index(self, index, skip_cb)
|
||||||
@ -268,7 +268,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Start scroll to target scroll percent
|
--- Start scroll to target scroll percent
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam vector3 percent target percent
|
-- @tparam vector3 percent target percent
|
||||||
-- @tparam[opt] bool is_instant instant scroll flag
|
-- @tparam[opt] bool is_instant instant scroll flag
|
||||||
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
|
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
|
||||||
@ -287,7 +287,7 @@ end
|
|||||||
|
|
||||||
--- Return current scroll progress status.
|
--- Return current scroll progress status.
|
||||||
-- Values will be in [0..1] interval
|
-- Values will be in [0..1] interval
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @treturn vector3 New vector with scroll progress values
|
-- @treturn vector3 New vector with scroll progress values
|
||||||
function Scroll.get_percent(self)
|
function Scroll.get_percent(self)
|
||||||
local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x)
|
local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x)
|
||||||
@ -299,7 +299,7 @@ end
|
|||||||
|
|
||||||
--- Set scroll content size.
|
--- Set scroll content size.
|
||||||
-- It will change content gui node size
|
-- It will change content gui node size
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam vector3 size The new size for content node
|
-- @tparam vector3 size The new size for content node
|
||||||
-- @tparam vector3 offset Offset value to set, where content is starts
|
-- @tparam vector3 offset Offset value to set, where content is starts
|
||||||
-- @treturn druid.scroll Current scroll instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
@ -317,7 +317,7 @@ end
|
|||||||
--- Enable or disable scroll inert.
|
--- Enable or disable scroll inert.
|
||||||
-- If disabled, scroll through points (if exist)
|
-- If disabled, scroll through points (if exist)
|
||||||
-- If no points, just simple drag without inertion
|
-- If no points, just simple drag without inertion
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam bool state Inert scroll state
|
-- @tparam bool state Inert scroll state
|
||||||
-- @treturn druid.scroll Current scroll instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function Scroll.set_inert(self, state)
|
function Scroll.set_inert(self, state)
|
||||||
@ -328,7 +328,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return if scroll have inertion.
|
--- Return if scroll have inertion.
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @treturn bool If scroll have inertion
|
-- @treturn bool If scroll have inertion
|
||||||
function Scroll.is_inert(self)
|
function Scroll.is_inert(self)
|
||||||
return self._is_inert
|
return self._is_inert
|
||||||
@ -337,7 +337,7 @@ end
|
|||||||
|
|
||||||
--- Set extra size for scroll stretching.
|
--- Set extra size for scroll stretching.
|
||||||
-- Set 0 to disable stretching effect
|
-- Set 0 to disable stretching effect
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam[opt=0] number stretch_size Size in pixels of additional scroll area
|
-- @tparam[opt=0] number stretch_size Size in pixels of additional scroll area
|
||||||
-- @treturn druid.scroll Current scroll instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function Scroll.set_extra_stretch_size(self, stretch_size)
|
function Scroll.set_extra_stretch_size(self, stretch_size)
|
||||||
@ -349,7 +349,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return vector of scroll size with width and height.
|
--- Return vector of scroll size with width and height.
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @treturn vector3 Available scroll size
|
-- @treturn vector3 Available scroll size
|
||||||
function Scroll.get_scroll_size(self)
|
function Scroll.get_scroll_size(self)
|
||||||
return self.available_size
|
return self.available_size
|
||||||
@ -358,7 +358,7 @@ end
|
|||||||
|
|
||||||
--- Set points of interest.
|
--- Set points of interest.
|
||||||
-- Scroll will always centered on closer points
|
-- Scroll will always centered on closer points
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam table points Array of vector3 points
|
-- @tparam table points Array of vector3 points
|
||||||
-- @treturn druid.scroll Current scroll instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function Scroll.set_points(self, points)
|
function Scroll.set_points(self, points)
|
||||||
@ -375,7 +375,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Lock or unlock horizontal scroll
|
--- Lock or unlock horizontal scroll
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam bool state True, if horizontal scroll is enabled
|
-- @tparam bool state True, if horizontal scroll is enabled
|
||||||
-- @treturn druid.scroll Current scroll instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function Scroll.set_horizontal_scroll(self, state)
|
function Scroll.set_horizontal_scroll(self, state)
|
||||||
@ -386,7 +386,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Lock or unlock vertical scroll
|
--- Lock or unlock vertical scroll
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam bool state True, if vertical scroll is enabled
|
-- @tparam bool state True, if vertical scroll is enabled
|
||||||
-- @treturn druid.scroll Current scroll instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function Scroll.set_vertical_scroll(self, state)
|
function Scroll.set_vertical_scroll(self, state)
|
||||||
@ -398,7 +398,7 @@ end
|
|||||||
|
|
||||||
--- Check node if it visible now on scroll.
|
--- Check node if it visible now on scroll.
|
||||||
-- Extra border is not affected. Return true for elements in extra scroll zone
|
-- Extra border is not affected. Return true for elements in extra scroll zone
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam node node The node to check
|
-- @tparam node node The node to check
|
||||||
-- @treturn boolean True if node in visible scroll area
|
-- @treturn boolean True if node in visible scroll area
|
||||||
function Scroll.is_node_in_view(self, node)
|
function Scroll.is_node_in_view(self, node)
|
||||||
@ -421,7 +421,7 @@ end
|
|||||||
|
|
||||||
--- Bind the grid component (Static or Dynamic) to recalculate
|
--- Bind the grid component (Static or Dynamic) to recalculate
|
||||||
-- scroll size on grid changes
|
-- scroll size on grid changes
|
||||||
-- @tparam Scroll self
|
-- @tparam Scroll self @{Scroll}
|
||||||
-- @tparam StaticGrid|DynamicGrid grid Druid grid component
|
-- @tparam StaticGrid|DynamicGrid grid Druid grid component
|
||||||
-- @treturn druid.scroll Current scroll instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function Scroll.bind_grid(self, grid)
|
function Scroll.bind_grid(self, grid)
|
||||||
@ -524,7 +524,7 @@ function Scroll._check_soft_zone(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Cancel animation on other animation or input touch
|
-- Cancel animation on other animation or input touch
|
||||||
function Scroll._cancel_animate(self)
|
function Scroll._cancel_animate(self)
|
||||||
self.inertion.x = 0
|
self.inertion.x = 0
|
||||||
self.inertion.y = 0
|
self.inertion.y = 0
|
||||||
|
@ -7,19 +7,19 @@
|
|||||||
-- @alias druid.static_grid
|
-- @alias druid.static_grid
|
||||||
|
|
||||||
--- On item add callback(self, node, index)
|
--- On item add callback(self, node, index)
|
||||||
-- @tfield druid_event on_add_item
|
-- @tfield DruidEvent on_add_item @{DruidEvent}
|
||||||
|
|
||||||
--- On item remove callback(self, index)
|
--- On item remove callback(self, index)
|
||||||
-- @tfield druid_event on_remove_item
|
-- @tfield DruidEvent on_remove_item @{DruidEvent}
|
||||||
|
|
||||||
--- On item add, remove or change in_row callback(self, index|nil)
|
--- On item add, remove or change in_row callback(self, index|nil)
|
||||||
-- @tfield druid_event on_change_items
|
-- @tfield DruidEvent on_change_items @{DruidEvent}
|
||||||
|
|
||||||
--- On grid clear callback(self)
|
--- On grid clear callback(self)
|
||||||
-- @tfield druid_event on_clear
|
-- @tfield DruidEvent on_clear @{DruidEvent}
|
||||||
|
|
||||||
--- On update item positions callback(self)
|
--- On update item positions callback(self)
|
||||||
-- @tfield druid_event on_update_positions
|
-- @tfield DruidEvent on_update_positions @{DruidEvent}
|
||||||
|
|
||||||
--- Parent gui node
|
--- Parent gui node
|
||||||
-- @tfield node parent
|
-- @tfield node parent
|
||||||
@ -79,7 +79,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam node parent The gui node parent, where items will be placed
|
-- @tparam node parent The gui node parent, where items will be placed
|
||||||
-- @tparam node element Element prefab. Need to get it size
|
-- @tparam node element Element prefab. Need to get it size
|
||||||
-- @tparam[opt=1] number in_row How many nodes in row can be placed
|
-- @tparam[opt=1] number in_row How many nodes in row can be placed
|
||||||
@ -117,7 +117,7 @@ end
|
|||||||
|
|
||||||
local _temp_pos = vmath.vector3(0)
|
local _temp_pos = vmath.vector3(0)
|
||||||
--- Return pos for grid node index
|
--- Return pos for grid node index
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam number index The grid element index
|
-- @tparam number index The grid element index
|
||||||
-- @treturn vector3 Node position
|
-- @treturn vector3 Node position
|
||||||
function StaticGrid.get_pos(self, index)
|
function StaticGrid.get_pos(self, index)
|
||||||
@ -135,7 +135,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return index for grid pos
|
--- Return index for grid pos
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam vector3 pos The node position in the grid
|
-- @tparam vector3 pos The node position in the grid
|
||||||
-- @treturn number The node index
|
-- @treturn number The node index
|
||||||
function StaticGrid.get_index(self, pos)
|
function StaticGrid.get_index(self, pos)
|
||||||
@ -151,7 +151,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return grid index by node
|
--- Return grid index by node
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam node node The gui node in the grid
|
-- @tparam node node The gui node in the grid
|
||||||
-- @treturn number The node index
|
-- @treturn number The node index
|
||||||
function StaticGrid.get_index_by_node(self, node)
|
function StaticGrid.get_index_by_node(self, node)
|
||||||
@ -171,7 +171,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set grid anchor. Default anchor is equal to anchor of grid parent node
|
--- Set grid anchor. Default anchor is equal to anchor of grid parent node
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam vector3 anchor Anchor
|
-- @tparam vector3 anchor Anchor
|
||||||
function StaticGrid.set_anchor(self, anchor)
|
function StaticGrid.set_anchor(self, anchor)
|
||||||
self.anchor = anchor
|
self.anchor = anchor
|
||||||
@ -180,7 +180,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Add new item to the grid
|
--- Add new item to the grid
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam node item Gui node
|
-- @tparam node item Gui node
|
||||||
-- @tparam[opt] number index The item position. By default add as last item
|
-- @tparam[opt] number index The item position. By default add as last item
|
||||||
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
||||||
@ -219,7 +219,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Remove the item from the grid. Note that gui node will be not deleted
|
--- Remove the item from the grid. Note that gui node will be not deleted
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam number index The grid node index to remove
|
-- @tparam number index The grid node index to remove
|
||||||
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
||||||
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
|
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
|
||||||
@ -252,7 +252,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return grid content size
|
--- Return grid content size
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @treturn vector3 The grid content size
|
-- @treturn vector3 The grid content size
|
||||||
function StaticGrid.get_size(self)
|
function StaticGrid.get_size(self)
|
||||||
return vmath.vector3(
|
return vmath.vector3(
|
||||||
@ -286,7 +286,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return grid content borders
|
--- Return grid content borders
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @treturn vector3 The grid content borders
|
-- @treturn vector3 The grid content borders
|
||||||
function StaticGrid.get_borders(self)
|
function StaticGrid.get_borders(self)
|
||||||
return self.border
|
return self.border
|
||||||
@ -294,7 +294,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return array of all node positions
|
--- Return array of all node positions
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @treturn vector3[] All grid node positions
|
-- @treturn vector3[] All grid node positions
|
||||||
function StaticGrid.get_all_pos(self)
|
function StaticGrid.get_all_pos(self)
|
||||||
local result = {}
|
local result = {}
|
||||||
@ -308,7 +308,7 @@ end
|
|||||||
|
|
||||||
--- Change set position function for grid nodes. It will call on
|
--- Change set position function for grid nodes. It will call on
|
||||||
-- update poses on grid elements. Default: gui.set_position
|
-- update poses on grid elements. Default: gui.set_position
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam function callback Function on node set position
|
-- @tparam function callback Function on node set position
|
||||||
-- @treturn druid.static_grid Current grid instance
|
-- @treturn druid.static_grid Current grid instance
|
||||||
function StaticGrid.set_position_function(self, callback)
|
function StaticGrid.set_position_function(self, callback)
|
||||||
@ -320,7 +320,7 @@ end
|
|||||||
|
|
||||||
--- Clear grid nodes array. GUI nodes will be not deleted!
|
--- Clear grid nodes array. GUI nodes will be not deleted!
|
||||||
-- If you want to delete GUI nodes, use static_grid.nodes array before grid:clear
|
-- If you want to delete GUI nodes, use static_grid.nodes array before grid:clear
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @treturn druid.static_grid Current grid instance
|
-- @treturn druid.static_grid Current grid instance
|
||||||
function StaticGrid.clear(self)
|
function StaticGrid.clear(self)
|
||||||
self.border.x = 0
|
self.border.x = 0
|
||||||
@ -338,7 +338,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return StaticGrid offset, where StaticGrid content starts.
|
--- Return StaticGrid offset, where StaticGrid content starts.
|
||||||
-- @tparam StaticGrid self The StaticGrid instance
|
-- @tparam StaticGrid self @{StaticGrid} The StaticGrid instance
|
||||||
-- @treturn vector3 The StaticGrid offset
|
-- @treturn vector3 The StaticGrid offset
|
||||||
function StaticGrid:get_offset()
|
function StaticGrid:get_offset()
|
||||||
local borders = self:get_borders()
|
local borders = self:get_borders()
|
||||||
@ -354,7 +354,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set new in_row elements for grid
|
--- Set new in_row elements for grid
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam number in_row The new in_row value
|
-- @tparam number in_row The new in_row value
|
||||||
-- @treturn druid.static_grid Current grid instance
|
-- @treturn druid.static_grid Current grid instance
|
||||||
function StaticGrid.set_in_row(self, in_row)
|
function StaticGrid.set_in_row(self, in_row)
|
||||||
@ -368,7 +368,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update grid inner state
|
--- Update grid inner state
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||||
-- @local
|
-- @local
|
||||||
function StaticGrid._update(self, is_instant)
|
function StaticGrid._update(self, is_instant)
|
||||||
@ -379,7 +379,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update first and last indexes of grid nodes
|
--- Update first and last indexes of grid nodes
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @local
|
-- @local
|
||||||
function StaticGrid._update_indexes(self)
|
function StaticGrid._update_indexes(self)
|
||||||
self.first_index = nil
|
self.first_index = nil
|
||||||
@ -395,7 +395,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update grid content borders, recalculate min and max values
|
--- Update grid content borders, recalculate min and max values
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @local
|
-- @local
|
||||||
function StaticGrid._update_borders(self)
|
function StaticGrid._update_borders(self)
|
||||||
if not self.first_index then
|
if not self.first_index then
|
||||||
@ -414,7 +414,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update grid nodes position
|
--- Update grid nodes position
|
||||||
-- @tparam StaticGrid self
|
-- @tparam StaticGrid self @{StaticGrid}
|
||||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||||
-- @local
|
-- @local
|
||||||
function StaticGrid._update_pos(self, is_instant)
|
function StaticGrid._update_pos(self, is_instant)
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
-- @tparam[opt] node click_zone
|
-- @tparam[opt] node click_zone
|
||||||
|
|
||||||
--- Trigger on swipe event(self, swipe_side, dist, delta_time
|
--- Trigger on swipe event(self, swipe_side, dist, delta_time
|
||||||
-- @tfield druid_event on_swipe)
|
-- @tfield DruidEvent on_swipe) @{DruidEvent}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Swipe self
|
-- @tparam Swipe self @{Swipe}
|
||||||
-- @tparam node node Gui node
|
-- @tparam node node Gui node
|
||||||
-- @tparam function on_swipe_callback Swipe callback for on_swipe_end event
|
-- @tparam function on_swipe_callback Swipe callback for on_swipe_end event
|
||||||
function Swipe.init(self, node, on_swipe_callback)
|
function Swipe.init(self, node, on_swipe_callback)
|
||||||
@ -149,7 +149,7 @@ end
|
|||||||
|
|
||||||
--- Strict swipe click area. Useful for
|
--- Strict swipe click area. Useful for
|
||||||
-- restrict events outside stencil node
|
-- restrict events outside stencil node
|
||||||
-- @tparam Swipe self
|
-- @tparam Swipe self @{Swipe}
|
||||||
-- @tparam node zone Gui node
|
-- @tparam node zone Gui node
|
||||||
function Swipe.set_click_zone(self, zone)
|
function Swipe.set_click_zone(self, zone)
|
||||||
self.click_zone = self:get_node(zone)
|
self.click_zone = self:get_node(zone)
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
-- @alias druid.text
|
-- @alias druid.text
|
||||||
|
|
||||||
--- On set text callback(self, text)
|
--- On set text callback(self, text)
|
||||||
-- @tfield druid_event on_set_text
|
-- @tfield DruidEvent on_set_text @{DruidEvent}
|
||||||
|
|
||||||
--- On adjust text size callback(self, new_scale)
|
--- On adjust text size callback(self, new_scale)
|
||||||
-- @tfield druid_event on_update_text_scale
|
-- @tfield DruidEvent on_update_text_scale @{DruidEvent}
|
||||||
|
|
||||||
--- On change pivot callback(self, pivot)
|
--- On change pivot callback(self, pivot)
|
||||||
-- @tfield druid_event on_set_pivot
|
-- @tfield DruidEvent on_set_pivot @{DruidEvent}
|
||||||
|
|
||||||
--- Text node
|
--- Text node
|
||||||
-- @tfield node node
|
-- @tfield node node
|
||||||
@ -185,7 +185,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam node node Gui text node
|
-- @tparam node node Gui text node
|
||||||
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
|
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
|
||||||
-- @tparam[opt=0] int adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
|
-- @tparam[opt=0] int adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
|
||||||
@ -234,7 +234,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Calculate text width with font with respect to trailing space
|
--- Calculate text width with font with respect to trailing space
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam[opt] string text
|
-- @tparam[opt] string text
|
||||||
function Text.get_text_width(self, text)
|
function Text.get_text_width(self, text)
|
||||||
text = text or self.last_value
|
text = text or self.last_value
|
||||||
@ -255,7 +255,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set text to text field
|
--- Set text to text field
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam string set_to Text for node
|
-- @tparam string set_to Text for node
|
||||||
-- @treturn Text Current text instance
|
-- @treturn Text Current text instance
|
||||||
function Text.set_to(self, set_to)
|
function Text.set_to(self, set_to)
|
||||||
@ -273,7 +273,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set color
|
--- Set color
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam vector4 color Color for node
|
-- @tparam vector4 color Color for node
|
||||||
-- @treturn Text Current text instance
|
-- @treturn Text Current text instance
|
||||||
function Text.set_color(self, color)
|
function Text.set_color(self, color)
|
||||||
@ -285,7 +285,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set alpha
|
--- Set alpha
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam number alpha Alpha for node
|
-- @tparam number alpha Alpha for node
|
||||||
-- @treturn Text Current text instance
|
-- @treturn Text Current text instance
|
||||||
function Text.set_alpha(self, alpha)
|
function Text.set_alpha(self, alpha)
|
||||||
@ -297,7 +297,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set scale
|
--- Set scale
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam vector3 scale Scale for node
|
-- @tparam vector3 scale Scale for node
|
||||||
-- @treturn Text Current text instance
|
-- @treturn Text Current text instance
|
||||||
function Text.set_scale(self, scale)
|
function Text.set_scale(self, scale)
|
||||||
@ -309,7 +309,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set text pivot. Text will re-anchor inside text area
|
--- Set text pivot. Text will re-anchor inside text area
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam gui.pivot pivot Gui pivot constant
|
-- @tparam gui.pivot pivot Gui pivot constant
|
||||||
-- @treturn Text Current text instance
|
-- @treturn Text Current text instance
|
||||||
function Text.set_pivot(self, pivot)
|
function Text.set_pivot(self, pivot)
|
||||||
@ -335,7 +335,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return true, if text with line break
|
--- Return true, if text with line break
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @treturn bool Is text node with line break
|
-- @treturn bool Is text node with line break
|
||||||
function Text.is_multiline(self)
|
function Text.is_multiline(self)
|
||||||
return gui.get_line_break(self.node)
|
return gui.get_line_break(self.node)
|
||||||
@ -343,7 +343,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set text adjust, refresh the current text visuals, if needed
|
--- Set text adjust, refresh the current text visuals, if needed
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam[opt] number adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type
|
-- @tparam[opt] number adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type
|
||||||
-- @tparam[opt] number minimal_scale If pass nil - not use minimal scale
|
-- @tparam[opt] number minimal_scale If pass nil - not use minimal scale
|
||||||
-- @treturn Text Current text instance
|
-- @treturn Text Current text instance
|
||||||
@ -357,7 +357,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
|
--- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
|
||||||
-- @tparam Text self
|
-- @tparam Text self @{Text}
|
||||||
-- @tparam number minimal_scale If pass nil - not use minimal scale
|
-- @tparam number minimal_scale If pass nil - not use minimal scale
|
||||||
-- @treturn Text Current text instance
|
-- @treturn Text Current text instance
|
||||||
function Text.set_minimal_scale(self, minimal_scale)
|
function Text.set_minimal_scale(self, minimal_scale)
|
||||||
|
95
druid/custom/rich_input/rich_input.lua
Normal file
95
druid/custom/rich_input/rich_input.lua
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
-- Copyright (c) 2022 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
|
||||||
|
|
||||||
|
--- Druid Rich Input custom component.
|
||||||
|
-- It's wrapper on Input component with cursor and placeholder text
|
||||||
|
-- @module RichInput
|
||||||
|
-- @within Input
|
||||||
|
-- @alias druid.rich_input
|
||||||
|
|
||||||
|
--- On input field select callback(self, button_node)
|
||||||
|
-- @tfield DruidInstance druid @{DruidInstance}
|
||||||
|
|
||||||
|
--- On input field text change callback(self, input_text)
|
||||||
|
-- @tfield Input input @{Input}
|
||||||
|
|
||||||
|
--- On input field text change to empty string callback(self, input_text)
|
||||||
|
-- @tfield node cursor
|
||||||
|
|
||||||
|
--- On input field text change to max length string callback(self, input_text)
|
||||||
|
-- @tfield druid.text placeholder @{Text}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
local component = require("druid.component")
|
||||||
|
|
||||||
|
local RichInput = component.create("druid.rich_input")
|
||||||
|
|
||||||
|
local SCHEME = {
|
||||||
|
ROOT = "root",
|
||||||
|
BUTTON = "button",
|
||||||
|
PLACEHOLDER = "placeholder_text",
|
||||||
|
INPUT = "input_text",
|
||||||
|
CURSOR = "cursor_node",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
local function animate_cursor(self)
|
||||||
|
gui.cancel_animation(self.cursor, gui.PROP_COLOR)
|
||||||
|
gui.set_color(self.cursor, vmath.vector4(1))
|
||||||
|
gui.animate(self.cursor, gui.PROP_COLOR, vmath.vector4(1,1,1,0), gui.EASING_INSINE, 0.8, 0, nil, gui.PLAYBACK_LOOP_PINGPONG)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function update_text(self, text)
|
||||||
|
local text_width = self.input.total_width
|
||||||
|
animate_cursor(self)
|
||||||
|
gui.set_position(self.cursor, vmath.vector3(text_width/2, 0, 0))
|
||||||
|
gui.set_scale(self.cursor, self.input.text.scale)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function on_select(self)
|
||||||
|
gui.set_enabled(self.cursor, true)
|
||||||
|
gui.set_enabled(self.placeholder.node, false)
|
||||||
|
animate_cursor(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function on_unselect(self)
|
||||||
|
gui.set_enabled(self.cursor, false)
|
||||||
|
gui.set_enabled(self.placeholder.node, true and #self.input:get_text() == 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Component init function
|
||||||
|
-- @tparam RichInput self @{RichInput}
|
||||||
|
-- @tparam string template The template string name
|
||||||
|
-- @tparam table nodes Nodes table from gui.clone_tree
|
||||||
|
function RichInput.init(self, template, nodes)
|
||||||
|
self:set_template(template)
|
||||||
|
self:set_nodes(nodes)
|
||||||
|
self.druid = self:get_druid()
|
||||||
|
self.input = self.druid:new_input(self:get_node(SCHEME.BUTTON), self:get_node(SCHEME.INPUT))
|
||||||
|
self.cursor = self:get_node(SCHEME.CURSOR)
|
||||||
|
|
||||||
|
self.input:set_text("")
|
||||||
|
self.placeholder = self.druid:new_text(self:get_node(SCHEME.PLACEHOLDER))
|
||||||
|
|
||||||
|
self.input.on_input_text:subscribe(update_text)
|
||||||
|
self.input.on_input_select:subscribe(on_select)
|
||||||
|
self.input.on_input_unselect:subscribe(on_unselect)
|
||||||
|
on_unselect(self)
|
||||||
|
update_text(self, "")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Set placeholder text
|
||||||
|
-- @tparam RichInput self @{RichInput}
|
||||||
|
-- @tparam string placeholder_text The placeholder text
|
||||||
|
function RichInput.set_placeholder(self, placeholder_text)
|
||||||
|
self.placeholder:set_to(placeholder_text)
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return RichInput
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
--- Druid lua event library
|
--- Druid lua event library
|
||||||
-- @module DruidEvent
|
-- @module DruidEvent
|
||||||
-- @alias druid_event
|
-- @alias druid.event
|
||||||
|
|
||||||
local class = require("druid.system.middleclass")
|
local class = require("druid.system.middleclass")
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ local DruidEvent = class("druid.event")
|
|||||||
|
|
||||||
|
|
||||||
--- Event constructur
|
--- Event constructur
|
||||||
-- @tparam DruidEvent self
|
-- @tparam DruidEvent self @{DruidEvent}
|
||||||
-- @tparam function initial_callback Subscribe the callback on new event, if callback exist
|
-- @tparam function initial_callback Subscribe the callback on new event, if callback exist
|
||||||
function DruidEvent.initialize(self, initial_callback)
|
function DruidEvent.initialize(self, initial_callback)
|
||||||
self._callbacks = {}
|
self._callbacks = {}
|
||||||
@ -22,7 +22,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Subscribe callback on event
|
--- Subscribe callback on event
|
||||||
-- @tparam DruidEvent self
|
-- @tparam DruidEvent self @{DruidEvent}
|
||||||
-- @tparam function callback Callback itself
|
-- @tparam function callback Callback itself
|
||||||
-- @tparam table context Additional context as first param to callback call
|
-- @tparam table context Additional context as first param to callback call
|
||||||
function DruidEvent.subscribe(self, callback, context)
|
function DruidEvent.subscribe(self, callback, context)
|
||||||
@ -39,7 +39,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Unsubscribe callback on event
|
--- Unsubscribe callback on event
|
||||||
-- @tparam DruidEvent self
|
-- @tparam DruidEvent self @{DruidEvent}
|
||||||
-- @tparam function callback Callback itself
|
-- @tparam function callback Callback itself
|
||||||
-- @tparam table context Additional context as first param to callback call
|
-- @tparam table context Additional context as first param to callback call
|
||||||
function DruidEvent.unsubscribe(self, callback, context)
|
function DruidEvent.unsubscribe(self, callback, context)
|
||||||
@ -53,7 +53,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return true, if event have at lease one handler
|
--- Return true, if event have at lease one handler
|
||||||
-- @tparam DruidEvent self
|
-- @tparam DruidEvent self @{DruidEvent}
|
||||||
-- @treturn bool True if event have handlers
|
-- @treturn bool True if event have handlers
|
||||||
function DruidEvent.is_exist(self)
|
function DruidEvent.is_exist(self)
|
||||||
return #self._callbacks > 0
|
return #self._callbacks > 0
|
||||||
@ -61,14 +61,14 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Clear the all event handlers
|
--- Clear the all event handlers
|
||||||
-- @tparam DruidEvent self
|
-- @tparam DruidEvent self @{DruidEvent}
|
||||||
function DruidEvent.clear(self)
|
function DruidEvent.clear(self)
|
||||||
self._callbacks = {}
|
self._callbacks = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Trigger the event and call all subscribed callbacks
|
--- Trigger the event and call all subscribed callbacks
|
||||||
-- @tparam DruidEvent self
|
-- @tparam DruidEvent self @{DruidEvent}
|
||||||
-- @tparam any ... All event params
|
-- @tparam any ... All event params
|
||||||
function DruidEvent.trigger(self, ...)
|
function DruidEvent.trigger(self, ...)
|
||||||
for index, callback_info in ipairs(self._callbacks) do
|
for index, callback_info in ipairs(self._callbacks) do
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
-- @alias druid.checkbox
|
-- @alias druid.checkbox
|
||||||
|
|
||||||
--- On change state callback(self, state)
|
--- On change state callback(self, state)
|
||||||
-- @tfield druid_event on_change_state
|
-- @tfield DruidEvent on_change_state @{DruidEvent}
|
||||||
|
|
||||||
--- Visual node
|
--- Visual node
|
||||||
-- @tfield node node
|
-- @tfield node node
|
||||||
@ -15,7 +15,7 @@
|
|||||||
-- @tfield[opt=node] node click_node
|
-- @tfield[opt=node] node click_node
|
||||||
|
|
||||||
--- Button component from click_node
|
--- Button component from click_node
|
||||||
-- @tfield Button button
|
-- @tfield Button button @{Button}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Checkbox self
|
-- @tparam Checkbox self @{Checkbox}
|
||||||
-- @tparam node node Gui node
|
-- @tparam node node Gui node
|
||||||
-- @tparam function callback Checkbox callback
|
-- @tparam function callback Checkbox callback
|
||||||
-- @tparam[opt=node] node click_node Trigger node, by default equals to node
|
-- @tparam[opt=node] node click_node Trigger node, by default equals to node
|
||||||
@ -68,7 +68,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set checkbox state
|
--- Set checkbox state
|
||||||
-- @tparam Checkbox self
|
-- @tparam Checkbox self @{Checkbox}
|
||||||
-- @tparam bool state Checkbox state
|
-- @tparam bool state Checkbox state
|
||||||
-- @tparam bool is_silent Don't trigger on_change_state if true
|
-- @tparam bool is_silent Don't trigger on_change_state if true
|
||||||
-- @tparam bool is_instant If instant checkbox change
|
-- @tparam bool is_instant If instant checkbox change
|
||||||
@ -85,7 +85,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return checkbox state
|
--- Return checkbox state
|
||||||
-- @tparam Checkbox self
|
-- @tparam Checkbox self @{Checkbox}
|
||||||
-- @treturn bool Checkbox state
|
-- @treturn bool Checkbox state
|
||||||
function Checkbox.get_state(self)
|
function Checkbox.get_state(self)
|
||||||
return self.state
|
return self.state
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
-- @alias druid.checkbox_group
|
-- @alias druid.checkbox_group
|
||||||
|
|
||||||
--- On any checkbox click callback(self, index)
|
--- On any checkbox click callback(self, index)
|
||||||
-- @tfield druid_event on_checkbox_click
|
-- @tfield DruidEvent on_checkbox_click @{DruidEvent}
|
||||||
|
|
||||||
--- Array of checkbox components
|
--- Array of checkbox components
|
||||||
-- @tfield table checkboxes
|
-- @tfield table checkboxes @{Checkbox}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ local CheckboxGroup = component.create("checkbox_group")
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam CheckboxGroup self
|
-- @tparam CheckboxGroup self @{CheckboxGroup}
|
||||||
-- @tparam node[] nodes Array of gui node
|
-- @tparam node[] nodes Array of gui node
|
||||||
-- @tparam function callback Checkbox callback
|
-- @tparam function callback Checkbox callback
|
||||||
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
|
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
|
||||||
@ -42,7 +42,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set checkbox group state
|
--- Set checkbox group state
|
||||||
-- @tparam CheckboxGroup self
|
-- @tparam CheckboxGroup self @{CheckboxGroup}
|
||||||
-- @tparam bool[] indexes Array of checkbox state
|
-- @tparam bool[] indexes Array of checkbox state
|
||||||
-- @tparam boolean is_instant If instant state change
|
-- @tparam boolean is_instant If instant state change
|
||||||
function CheckboxGroup.set_state(self, indexes, is_instant)
|
function CheckboxGroup.set_state(self, indexes, is_instant)
|
||||||
@ -55,7 +55,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return checkbox group state
|
--- Return checkbox group state
|
||||||
-- @tparam CheckboxGroup self
|
-- @tparam CheckboxGroup self @{CheckboxGroup}
|
||||||
-- @treturn bool[] Array if checkboxes state
|
-- @treturn bool[] Array if checkboxes state
|
||||||
function CheckboxGroup.get_state(self)
|
function CheckboxGroup.get_state(self)
|
||||||
local result = {}
|
local result = {}
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
|
|
||||||
--- The Druid scroll component
|
--- The Druid scroll component
|
||||||
-- @tfield druid.scroll scroll
|
-- @tfield Scroll scroll @{Scroll}
|
||||||
|
|
||||||
--- The Druid Grid component
|
--- The Druid Grid component
|
||||||
-- @tfield druid.static_grid grid
|
-- @tfield StaticGrid|DynamicGrid grid @{StaticGrid}, @{DynamicGrid}
|
||||||
|
|
||||||
--- The current visual top data index
|
--- The current visual top data index
|
||||||
-- @tfield number top_index
|
-- @tfield number top_index
|
||||||
@ -23,7 +23,7 @@
|
|||||||
-- @tfield number scroll_progress
|
-- @tfield number scroll_progress
|
||||||
|
|
||||||
--- Event triggered when scroll progress is changed; event(self, progress_value)
|
--- Event triggered when scroll progress is changed; event(self, progress_value)
|
||||||
-- @tfield druid_event on_scroll_progress_change
|
-- @tfield DruidEvent on_scroll_progress_change @{DruidEvent}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -36,9 +36,9 @@ local DataList = component.create("data_list")
|
|||||||
|
|
||||||
|
|
||||||
--- Data list constructor
|
--- Data list constructor
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam druid.scroll scroll The Scroll instance for Data List component
|
-- @tparam Scroll scroll The @{Scroll} instance for Data List component
|
||||||
-- @tparam druid.grid grid The Grid instance for Data List component
|
-- @tparam StaticGrid|DynamicGrid grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component
|
||||||
-- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component])
|
-- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component])
|
||||||
function DataList.init(self, scroll, grid, create_function)
|
function DataList.init(self, scroll, grid, create_function)
|
||||||
self.druid = self:get_druid()
|
self.druid = self:get_druid()
|
||||||
@ -65,14 +65,14 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Druid System on_remove function
|
--- Druid System on_remove function
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
function DataList.on_remove(self)
|
function DataList.on_remove(self)
|
||||||
self.scroll.on_scroll:unsubscribe(self._check_elements, self)
|
self.scroll.on_scroll:unsubscribe(self._check_elements, self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set new data set for DataList component
|
--- Set new data set for DataList component
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam table data The new data array
|
-- @tparam table data The new data array
|
||||||
-- @treturn druid.data_list Current DataList instance
|
-- @treturn druid.data_list Current DataList instance
|
||||||
function DataList.set_data(self, data)
|
function DataList.set_data(self, data)
|
||||||
@ -85,7 +85,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Add element to DataList. Currenly untested
|
--- Add element to DataList. Currenly untested
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam table data
|
-- @tparam table data
|
||||||
-- @tparam number index
|
-- @tparam number index
|
||||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
-- @tparam number shift_policy The constant from const.SHIFT.*
|
||||||
@ -113,7 +113,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Remove element from DataList. Currenly untested
|
--- Remove element from DataList. Currenly untested
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam number index
|
-- @tparam number index
|
||||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
-- @tparam number shift_policy The constant from const.SHIFT.*
|
||||||
-- @local
|
-- @local
|
||||||
@ -124,7 +124,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Remove element from DataList by data value. Currenly untested
|
--- Remove element from DataList by data value. Currenly untested
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam tabe data
|
-- @tparam tabe data
|
||||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
-- @tparam number shift_policy The constant from const.SHIFT.*
|
||||||
-- @local
|
-- @local
|
||||||
@ -138,7 +138,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Clear the DataList and refresh visuals
|
--- Clear the DataList and refresh visuals
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
function DataList.clear(self)
|
function DataList.clear(self)
|
||||||
self._data = {}
|
self._data = {}
|
||||||
self:_refresh()
|
self:_refresh()
|
||||||
@ -146,28 +146,28 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return first index from data. It not always equals to 1
|
--- Return first index from data. It not always equals to 1
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
function DataList.get_first_index(self)
|
function DataList.get_first_index(self)
|
||||||
return self._data_first_index
|
return self._data_first_index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Return last index from data
|
--- Return last index from data
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
function DataList.get_last_index(self)
|
function DataList.get_last_index(self)
|
||||||
return self._data_last_index
|
return self._data_last_index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Return amount of data
|
--- Return amount of data
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
function DataList.get_length(self)
|
function DataList.get_length(self)
|
||||||
return self._data_length
|
return self._data_length
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Return index for data value
|
--- Return index for data value
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam table data
|
-- @tparam table data
|
||||||
function DataList.get_index(self, data)
|
function DataList.get_index(self, data)
|
||||||
for index, value in pairs(self._data) do
|
for index, value in pairs(self._data) do
|
||||||
@ -181,7 +181,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Instant scroll to element with passed index
|
--- Instant scroll to element with passed index
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam number index
|
-- @tparam number index
|
||||||
function DataList.scroll_to_index(self, index)
|
function DataList.scroll_to_index(self, index)
|
||||||
local target = helper.clamp(index, self:get_first_index(), self:get_last_index())
|
local target = helper.clamp(index, self:get_first_index(), self:get_last_index())
|
||||||
@ -195,7 +195,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Add element at passed index
|
--- Add element at passed index
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam number index
|
-- @tparam number index
|
||||||
-- @local
|
-- @local
|
||||||
function DataList._add_at(self, index)
|
function DataList._add_at(self, index)
|
||||||
@ -213,7 +213,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Remove element from passed index
|
--- Remove element from passed index
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam number index
|
-- @tparam number index
|
||||||
-- @local
|
-- @local
|
||||||
function DataList._remove_at(self, index)
|
function DataList._remove_at(self, index)
|
||||||
@ -230,7 +230,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Fully refresh all DataList elements
|
--- Fully refresh all DataList elements
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @local
|
-- @local
|
||||||
function DataList._refresh(self)
|
function DataList._refresh(self)
|
||||||
for index, _ in pairs(self._data_visual) do
|
for index, _ in pairs(self._data_visual) do
|
||||||
@ -241,7 +241,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Check elements which should be created
|
--- Check elements which should be created
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @local
|
-- @local
|
||||||
function DataList._check_elements(self)
|
function DataList._check_elements(self)
|
||||||
for index, data in pairs(self._data_visual) do
|
for index, data in pairs(self._data_visual) do
|
||||||
@ -279,7 +279,7 @@ end
|
|||||||
|
|
||||||
--- Check elements which should be created.
|
--- Check elements which should be created.
|
||||||
-- Start from index with step until element is outside of scroll view
|
-- Start from index with step until element is outside of scroll view
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam number index
|
-- @tparam number index
|
||||||
-- @tparam number step
|
-- @tparam number step
|
||||||
-- @local
|
-- @local
|
||||||
@ -314,7 +314,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update actual data params
|
--- Update actual data params
|
||||||
-- @tparam DataList self
|
-- @tparam DataList self @{DataList}
|
||||||
-- @local
|
-- @local
|
||||||
function DataList._update_data_info(self)
|
function DataList._update_data_info(self)
|
||||||
self._data_first_index = false
|
self._data_first_index = false
|
||||||
|
@ -6,19 +6,19 @@
|
|||||||
-- @alias druid.dynamic_grid
|
-- @alias druid.dynamic_grid
|
||||||
|
|
||||||
--- On item add callback(self, node, index)
|
--- On item add callback(self, node, index)
|
||||||
-- @tfield druid_event on_add_item
|
-- @tfield DruidEvent on_add_item @{DruidEvent}
|
||||||
|
|
||||||
--- On item remove callback(self, index)
|
--- On item remove callback(self, index)
|
||||||
-- @tfield druid_event on_remove_item
|
-- @tfield DruidEvent on_remove_item @{DruidEvent}
|
||||||
|
|
||||||
--- On item add or remove callback(self, index)
|
--- On item add or remove callback(self, index)
|
||||||
-- @tfield druid_event on_change_items
|
-- @tfield DruidEvent on_change_items @{DruidEvent}
|
||||||
|
|
||||||
--- On grid clear callback(self)
|
--- On grid clear callback(self)
|
||||||
-- @tfield druid_event on_clear
|
-- @tfield DruidEvent on_clear @{DruidEvent}
|
||||||
|
|
||||||
--- On update item positions callback(self)
|
--- On update item positions callback(self)
|
||||||
-- @tfield druid_event on_update_positions
|
-- @tfield DruidEvent on_update_positions @{DruidEvent}
|
||||||
|
|
||||||
--- Parent gui node
|
--- Parent gui node
|
||||||
-- @tfield node parent
|
-- @tfield node parent
|
||||||
@ -64,7 +64,7 @@ local AVAILABLE_PIVOTS = {
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam node parent The gui node parent, where items will be placed
|
-- @tparam node parent The gui node parent, where items will be placed
|
||||||
function DynamicGrid.init(self, parent)
|
function DynamicGrid.init(self, parent)
|
||||||
self.parent = self:get_node(parent)
|
self.parent = self:get_node(parent)
|
||||||
@ -95,7 +95,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return pos for grid node index
|
--- Return pos for grid node index
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam number index The grid element index
|
-- @tparam number index The grid element index
|
||||||
-- @tparam node node The node to be placed
|
-- @tparam node node The node to be placed
|
||||||
-- @tparam[opt] number origin_index Index of nearby node
|
-- @tparam[opt] number origin_index Index of nearby node
|
||||||
@ -136,7 +136,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Add new node to the grid
|
--- Add new node to the grid
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam node node Gui node
|
-- @tparam node node Gui node
|
||||||
-- @tparam[opt] number index The node position. By default add as last node
|
-- @tparam[opt] number index The node position. By default add as last node
|
||||||
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
||||||
@ -179,11 +179,11 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Remove the item from the grid. Note that gui node will be not deleted
|
--- Remove the item from the grid. Note that gui node will be not deleted
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam number index The grid node index to remove
|
-- @tparam number index The grid node index to remove
|
||||||
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
|
||||||
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
|
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
|
||||||
-- @treturn Node The deleted gui node from grid
|
-- @treturn node The deleted gui node from grid
|
||||||
function DynamicGrid.remove(self, index, shift_policy, is_instant)
|
function DynamicGrid.remove(self, index, shift_policy, is_instant)
|
||||||
shift_policy = shift_policy or const.SHIFT.RIGHT
|
shift_policy = shift_policy or const.SHIFT.RIGHT
|
||||||
local delta = shift_policy -- -1 or 1 or 0
|
local delta = shift_policy -- -1 or 1 or 0
|
||||||
@ -216,7 +216,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return grid content size
|
--- Return grid content size
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam vector3 border
|
-- @tparam vector3 border
|
||||||
-- @treturn vector3 The grid content size
|
-- @treturn vector3 The grid content size
|
||||||
function DynamicGrid.get_size(self, border)
|
function DynamicGrid.get_size(self, border)
|
||||||
@ -229,7 +229,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return DynamicGrid offset, where DynamicGrid content starts.
|
--- Return DynamicGrid offset, where DynamicGrid content starts.
|
||||||
-- @tparam DynamicGrid self The DynamicGrid instance
|
-- @tparam DynamicGrid self @{DynamicGrid} The DynamicGrid instance
|
||||||
-- @treturn vector3 The DynamicGrid offset
|
-- @treturn vector3 The DynamicGrid offset
|
||||||
function DynamicGrid.get_offset(self)
|
function DynamicGrid.get_offset(self)
|
||||||
local size = self:get_size()
|
local size = self:get_size()
|
||||||
@ -244,7 +244,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return grid content borders
|
--- Return grid content borders
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @treturn vector3 The grid content borders
|
-- @treturn vector3 The grid content borders
|
||||||
function DynamicGrid.get_borders(self)
|
function DynamicGrid.get_borders(self)
|
||||||
return self.border
|
return self.border
|
||||||
@ -252,7 +252,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return grid index by node
|
--- Return grid index by node
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam node node The gui node in the grid
|
-- @tparam node node The gui node in the grid
|
||||||
-- @treturn number The node index
|
-- @treturn number The node index
|
||||||
function DynamicGrid.get_index_by_node(self, node)
|
function DynamicGrid.get_index_by_node(self, node)
|
||||||
@ -267,7 +267,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return array of all node positions
|
--- Return array of all node positions
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @treturn vector3[] All grid node positions
|
-- @treturn vector3[] All grid node positions
|
||||||
function DynamicGrid.get_all_pos(self)
|
function DynamicGrid.get_all_pos(self)
|
||||||
local result = {}
|
local result = {}
|
||||||
@ -281,7 +281,7 @@ end
|
|||||||
|
|
||||||
--- Change set position function for grid nodes. It will call on
|
--- Change set position function for grid nodes. It will call on
|
||||||
-- update poses on grid elements. Default: gui.set_position
|
-- update poses on grid elements. Default: gui.set_position
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam function callback Function on node set position
|
-- @tparam function callback Function on node set position
|
||||||
-- @treturn druid.dynamic_grid Current grid instance
|
-- @treturn druid.dynamic_grid Current grid instance
|
||||||
function DynamicGrid.set_position_function(self, callback)
|
function DynamicGrid.set_position_function(self, callback)
|
||||||
@ -292,7 +292,7 @@ end
|
|||||||
|
|
||||||
--- Clear grid nodes array. GUI nodes will be not deleted!
|
--- Clear grid nodes array. GUI nodes will be not deleted!
|
||||||
-- If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
|
-- If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @treturn druid.dynamic_grid Current grid instance
|
-- @treturn druid.dynamic_grid Current grid instance
|
||||||
function DynamicGrid.clear(self)
|
function DynamicGrid.clear(self)
|
||||||
self.nodes = {}
|
self.nodes = {}
|
||||||
@ -319,7 +319,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update grid inner state
|
--- Update grid inner state
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||||
-- @local
|
-- @local
|
||||||
function DynamicGrid._update(self, is_instant)
|
function DynamicGrid._update(self, is_instant)
|
||||||
@ -330,7 +330,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update first and last indexes of grid nodes
|
--- Update first and last indexes of grid nodes
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @local
|
-- @local
|
||||||
function DynamicGrid._update_indexes(self)
|
function DynamicGrid._update_indexes(self)
|
||||||
self.first_index = nil
|
self.first_index = nil
|
||||||
@ -346,7 +346,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update grid content borders, recalculate min and max values
|
--- Update grid content borders, recalculate min and max values
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @local
|
-- @local
|
||||||
function DynamicGrid._update_borders(self)
|
function DynamicGrid._update_borders(self)
|
||||||
if not self.first_index then
|
if not self.first_index then
|
||||||
@ -375,7 +375,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Update grid nodes position
|
--- Update grid nodes position
|
||||||
-- @tparam DynamicGrid self
|
-- @tparam DynamicGrid self @{DynamicGrid}
|
||||||
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
|
||||||
-- @local
|
-- @local
|
||||||
function DynamicGrid._update_pos(self, is_instant)
|
function DynamicGrid._update_pos(self, is_instant)
|
||||||
|
@ -8,28 +8,28 @@
|
|||||||
-- @alias druid.input
|
-- @alias druid.input
|
||||||
|
|
||||||
--- On input field select callback(self, button_node)
|
--- On input field select callback(self, button_node)
|
||||||
-- @tfield druid_event on_input_select
|
-- @tfield DruidEvent on_input_select @{DruidEvent}
|
||||||
|
|
||||||
--- On input field unselect callback(self, input_text)
|
--- On input field unselect callback(self, input_text)
|
||||||
-- @tfield druid_event on_input_unselect
|
-- @tfield DruidEvent on_input_unselect @{DruidEvent}
|
||||||
|
|
||||||
--- On input field text change callback(self, input_text)
|
--- On input field text change callback(self, input_text)
|
||||||
-- @tfield druid_event on_input_text
|
-- @tfield DruidEvent on_input_text @{DruidEvent}
|
||||||
|
|
||||||
--- On input field text change to empty string callback(self, input_text)
|
--- On input field text change to empty string callback(self, input_text)
|
||||||
-- @tfield druid_event on_input_empty
|
-- @tfield DruidEvent on_input_empty @{DruidEvent}
|
||||||
|
|
||||||
--- On input field text change to max length string callback(self, input_text)
|
--- On input field text change to max length string callback(self, input_text)
|
||||||
-- @tfield druid_event on_input_full
|
-- @tfield DruidEvent on_input_full @{DruidEvent}
|
||||||
|
|
||||||
--- On trying user input with not allowed character callback(self, params, button_instance)
|
--- On trying user input with not allowed character callback(self, params, button_instance)
|
||||||
-- @tfield druid_event on_input_wrong
|
-- @tfield DruidEvent on_input_wrong @{DruidEvent}
|
||||||
|
|
||||||
--- Text component
|
--- Text component
|
||||||
-- @tfield druid.text text
|
-- @tfield Text text @{Text}
|
||||||
|
|
||||||
--- Button component
|
--- Button component
|
||||||
-- @tfield druid.button button
|
-- @tfield Button button @{Button}
|
||||||
|
|
||||||
--- Is current input selected now
|
--- Is current input selected now
|
||||||
-- @tfield bool is_selected
|
-- @tfield bool is_selected
|
||||||
@ -110,8 +110,10 @@ function Input.on_style_change(self, style)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Component init function
|
||||||
|
-- @tparam Input self @{Input}
|
||||||
-- @tparam node click_node Button node to enabled input component
|
-- @tparam node click_node Button node to enabled input component
|
||||||
-- @tparam node|druid.text text_node Text node what will be changed on user input. You can pass text component instead of text node name
|
-- @tparam node|Text text_node Text node what will be changed on user input. You can pass text component instead of text node name @{Text}
|
||||||
-- @tparam[opt] number keyboard_type Gui keyboard type for input field
|
-- @tparam[opt] number keyboard_type Gui keyboard type for input field
|
||||||
function Input.init(self, click_node, text_node, keyboard_type)
|
function Input.init(self, click_node, text_node, keyboard_type)
|
||||||
self.druid = self:get_druid(self)
|
self.druid = self:get_druid(self)
|
||||||
@ -227,7 +229,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set text for input field
|
--- Set text for input field
|
||||||
-- @tparam Input self
|
-- @tparam Input self @{Input}
|
||||||
-- @tparam string input_text The string to apply for input field
|
-- @tparam string input_text The string to apply for input field
|
||||||
function Input.set_text(self, input_text)
|
function Input.set_text(self, input_text)
|
||||||
-- Case when update with marked text
|
-- Case when update with marked text
|
||||||
@ -274,7 +276,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Select input field. It will show the keyboard and trigger on_select events
|
--- Select input field. It will show the keyboard and trigger on_select events
|
||||||
-- @tparam Input self
|
-- @tparam Input self @{Input}
|
||||||
function Input.select(self)
|
function Input.select(self)
|
||||||
gui.reset_keyboard()
|
gui.reset_keyboard()
|
||||||
self.marked_value = ""
|
self.marked_value = ""
|
||||||
@ -297,7 +299,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Remove selection from input. It will hide the keyboard and trigger on_unselect events
|
--- Remove selection from input. It will hide the keyboard and trigger on_unselect events
|
||||||
-- @tparam Input self
|
-- @tparam Input self @{Input}
|
||||||
function Input.unselect(self)
|
function Input.unselect(self)
|
||||||
gui.reset_keyboard()
|
gui.reset_keyboard()
|
||||||
self.marked_value = ""
|
self.marked_value = ""
|
||||||
@ -315,7 +317,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return current input field text
|
--- Return current input field text
|
||||||
-- @tparam Input self
|
-- @tparam Input self @{Input}
|
||||||
-- @treturn string The current input field text
|
-- @treturn string The current input field text
|
||||||
function Input.get_text(self)
|
function Input.get_text(self)
|
||||||
return self.value .. self.marked_value
|
return self.value .. self.marked_value
|
||||||
@ -324,7 +326,7 @@ end
|
|||||||
|
|
||||||
--- Set maximum length for input field.
|
--- Set maximum length for input field.
|
||||||
-- Pass nil to make input field unliminted (by default)
|
-- Pass nil to make input field unliminted (by default)
|
||||||
-- @tparam Input self
|
-- @tparam Input self @{Input}
|
||||||
-- @tparam number max_length Maximum length for input text field
|
-- @tparam number max_length Maximum length for input text field
|
||||||
-- @treturn druid.input Current input instance
|
-- @treturn druid.input Current input instance
|
||||||
function Input.set_max_length(self, max_length)
|
function Input.set_max_length(self, max_length)
|
||||||
@ -336,7 +338,7 @@ end
|
|||||||
--- Set allowed charaters for input field.
|
--- Set allowed charaters for input field.
|
||||||
-- See: https://defold.com/ref/stable/string/
|
-- See: https://defold.com/ref/stable/string/
|
||||||
-- ex: [%a%d] for alpha and numeric
|
-- ex: [%a%d] for alpha and numeric
|
||||||
-- @tparam Input self
|
-- @tparam Input self @{Input}
|
||||||
-- @tparam string characters Regulax exp. for validate user input
|
-- @tparam string characters Regulax exp. for validate user input
|
||||||
-- @treturn druid.input Current input instance
|
-- @treturn druid.input Current input instance
|
||||||
function Input.set_allowed_characters(self, characters)
|
function Input.set_allowed_characters(self, characters)
|
||||||
@ -346,7 +348,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Reset current input selection and return previous value
|
--- Reset current input selection and return previous value
|
||||||
-- @tparam Input self
|
-- @tparam Input self @{Input}
|
||||||
function Input.reset_changes(self)
|
function Input.reset_changes(self)
|
||||||
self:set_text(self.previous_value)
|
self:set_text(self.previous_value)
|
||||||
self:unselect()
|
self:unselect()
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
-- @alias druid.lang_text
|
-- @alias druid.lang_text
|
||||||
|
|
||||||
--- On change text callback
|
--- On change text callback
|
||||||
-- @tfield druid_event on_change
|
-- @tfield DruidEvent on_change @{DruidEvent}
|
||||||
|
|
||||||
--- The text component
|
--- The text component
|
||||||
-- @tfield Text text
|
-- @tfield Text text @{Text}
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ local LangText = component.create("lang_text")
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam LangText self
|
-- @tparam LangText self @{LangText}
|
||||||
-- @tparam node node The text node
|
-- @tparam node node The text node
|
||||||
-- @tparam string locale_id Default locale id or text from node as default
|
-- @tparam string locale_id Default locale id or text from node as default
|
||||||
-- @tparam bool no_adjust If true, will not correct text size
|
-- @tparam bool no_adjust If true, will not correct text size
|
||||||
@ -48,7 +48,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Setup raw text to lang_text component
|
--- Setup raw text to lang_text component
|
||||||
-- @tparam LangText self
|
-- @tparam LangText self @{LangText}
|
||||||
-- @tparam string text Text for text node
|
-- @tparam string text Text for text node
|
||||||
-- @treturn LangText Current instance
|
-- @treturn LangText Current instance
|
||||||
function LangText.set_to(self, text)
|
function LangText.set_to(self, text)
|
||||||
@ -61,7 +61,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Translate the text by locale_id
|
--- Translate the text by locale_id
|
||||||
-- @tparam LangText self
|
-- @tparam LangText self @{LangText}
|
||||||
-- @tparam string locale_id Locale id
|
-- @tparam string locale_id Locale id
|
||||||
-- @tparam[opt] string a Optional param to string.format
|
-- @tparam[opt] string a Optional param to string.format
|
||||||
-- @tparam[opt] string b Optional param to string.format
|
-- @tparam[opt] string b Optional param to string.format
|
||||||
@ -81,7 +81,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Format string with new text params on localized text
|
--- Format string with new text params on localized text
|
||||||
-- @tparam LangText self
|
-- @tparam LangText self @{LangText}
|
||||||
-- @tparam[opt] string a Optional param to string.format
|
-- @tparam[opt] string a Optional param to string.format
|
||||||
-- @tparam[opt] string b Optional param to string.format
|
-- @tparam[opt] string b Optional param to string.format
|
||||||
-- @tparam[opt] string c Optional param to string.format
|
-- @tparam[opt] string c Optional param to string.format
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
-- @alias druid.progress
|
-- @alias druid.progress
|
||||||
|
|
||||||
--- On progress bar change callback(self, new_value)
|
--- On progress bar change callback(self, new_value)
|
||||||
-- @tfield druid_event on_change
|
-- @tfield DruidEvent on_change @{DruidEvent}
|
||||||
|
|
||||||
--- Progress bar fill node
|
--- Progress bar fill node
|
||||||
-- @tfield node node
|
-- @tfield node node
|
||||||
@ -93,7 +93,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Progress self
|
-- @tparam Progress self @{Progress}
|
||||||
-- @tparam string|node node Progress bar fill node or node name
|
-- @tparam string|node node Progress bar fill node or node name
|
||||||
-- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y
|
-- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y
|
||||||
-- @tparam[opt=1] number init_value Initial value of progress bar
|
-- @tparam[opt=1] number init_value Initial value of progress bar
|
||||||
@ -146,21 +146,21 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Fill a progress bar and stop progress animation
|
--- Fill a progress bar and stop progress animation
|
||||||
-- @tparam Progress self
|
-- @tparam Progress self @{Progress}
|
||||||
function Progress.fill(self)
|
function Progress.fill(self)
|
||||||
set_bar_to(self, 1, true)
|
set_bar_to(self, 1, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Empty a progress bar
|
--- Empty a progress bar
|
||||||
-- @tparam Progress self
|
-- @tparam Progress self @{Progress}
|
||||||
function Progress.empty(self)
|
function Progress.empty(self)
|
||||||
set_bar_to(self, 0, true)
|
set_bar_to(self, 0, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Instant fill progress bar to value
|
--- Instant fill progress bar to value
|
||||||
-- @tparam Progress self
|
-- @tparam Progress self @{Progress}
|
||||||
-- @tparam number to Progress bar value, from 0 to 1
|
-- @tparam number to Progress bar value, from 0 to 1
|
||||||
function Progress.set_to(self, to)
|
function Progress.set_to(self, to)
|
||||||
set_bar_to(self, to)
|
set_bar_to(self, to)
|
||||||
@ -168,14 +168,14 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return current progress bar value
|
--- Return current progress bar value
|
||||||
-- @tparam Progress self
|
-- @tparam Progress self @{Progress}
|
||||||
function Progress.get(self)
|
function Progress.get(self)
|
||||||
return self.last_value
|
return self.last_value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Set points on progress bar to fire the callback
|
--- Set points on progress bar to fire the callback
|
||||||
-- @tparam Progress self
|
-- @tparam Progress self @{Progress}
|
||||||
-- @tparam number[] steps Array of progress bar values
|
-- @tparam number[] steps Array of progress bar values
|
||||||
-- @tparam function callback Callback on intersect step value
|
-- @tparam function callback Callback on intersect step value
|
||||||
-- @usage progress:set_steps({0, 0.3, 0.6, 1}, function(self, step) end)
|
-- @usage progress:set_steps({0, 0.3, 0.6, 1}, function(self, step) end)
|
||||||
@ -186,7 +186,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Start animation of a progress bar
|
--- Start animation of a progress bar
|
||||||
-- @tparam Progress self
|
-- @tparam Progress self @{Progress}
|
||||||
-- @tparam number to value between 0..1
|
-- @tparam number to value between 0..1
|
||||||
-- @tparam[opt] function callback Callback on animation ends
|
-- @tparam[opt] function callback Callback on animation ends
|
||||||
function Progress.to(self, to, callback)
|
function Progress.to(self, to, callback)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
-- @alias druid.radio_group
|
-- @alias druid.radio_group
|
||||||
|
|
||||||
--- On any checkbox click
|
--- On any checkbox click
|
||||||
-- @tfield druid_event on_radio_click
|
-- @tfield DruidEvent on_radio_click @{DruidEvent}
|
||||||
|
|
||||||
--- Array of checkbox components
|
--- Array of checkbox components
|
||||||
-- @tfield Checkbox[] checkboxes
|
-- @tfield Checkbox[] checkboxes
|
||||||
@ -29,7 +29,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam RadioGroup self
|
-- @tparam RadioGroup self @{RadioGroup}
|
||||||
-- @tparam node[] nodes Array of gui node
|
-- @tparam node[] nodes Array of gui node
|
||||||
-- @tparam function callback Radio callback
|
-- @tparam function callback Radio callback
|
||||||
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
|
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
|
||||||
@ -51,7 +51,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set radio group state
|
--- Set radio group state
|
||||||
-- @tparam RadioGroup self
|
-- @tparam RadioGroup self @{RadioGroup}
|
||||||
-- @tparam number index Index in radio group
|
-- @tparam number index Index in radio group
|
||||||
-- @tparam boolean is_instant If is instant state change
|
-- @tparam boolean is_instant If is instant state change
|
||||||
function RadioGroup.set_state(self, index, is_instant)
|
function RadioGroup.set_state(self, index, is_instant)
|
||||||
@ -60,7 +60,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Return radio group state
|
--- Return radio group state
|
||||||
-- @tparam RadioGroup self
|
-- @tparam RadioGroup self @{RadioGroup}
|
||||||
-- @treturn number Index in radio group
|
-- @treturn number Index in radio group
|
||||||
function RadioGroup.get_state(self)
|
function RadioGroup.get_state(self)
|
||||||
local result = -1
|
local result = -1
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
-- @alias druid.slider
|
-- @alias druid.slider
|
||||||
|
|
||||||
--- On change value callback(self, value)
|
--- On change value callback(self, value)
|
||||||
-- @tfield druid_event on_change_value
|
-- @tfield DruidEvent on_change_value @{DruidEvent}
|
||||||
|
|
||||||
--- Slider pin node
|
--- Slider pin node
|
||||||
-- @tfield node node
|
-- @tfield node node
|
||||||
@ -55,7 +55,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Slider self
|
-- @tparam Slider self @{Slider}
|
||||||
-- @tparam node node Gui pin node
|
-- @tparam node node Gui pin node
|
||||||
-- @tparam vector3 end_pos The end position of slider
|
-- @tparam vector3 end_pos The end position of slider
|
||||||
-- @tparam[opt] function callback On slider change callback
|
-- @tparam[opt] function callback On slider change callback
|
||||||
@ -148,7 +148,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set value for slider
|
--- Set value for slider
|
||||||
-- @tparam Slider self
|
-- @tparam Slider self @{Slider}
|
||||||
-- @tparam number value Value from 0 to 1
|
-- @tparam number value Value from 0 to 1
|
||||||
-- @tparam[opt] bool is_silent Don't trigger event if true
|
-- @tparam[opt] bool is_silent Don't trigger event if true
|
||||||
function Slider.set(self, value, is_silent)
|
function Slider.set(self, value, is_silent)
|
||||||
@ -163,7 +163,7 @@ end
|
|||||||
|
|
||||||
--- Set slider steps. Pin node will
|
--- Set slider steps. Pin node will
|
||||||
-- apply closest step position
|
-- apply closest step position
|
||||||
-- @tparam Slider self
|
-- @tparam Slider self @{Slider}
|
||||||
-- @tparam number[] steps Array of steps
|
-- @tparam number[] steps Array of steps
|
||||||
-- @usage slider:set_steps({0, 0.2, 0.6, 1})
|
-- @usage slider:set_steps({0, 0.2, 0.6, 1})
|
||||||
function Slider.set_steps(self, steps)
|
function Slider.set_steps(self, steps)
|
||||||
|
@ -8,13 +8,13 @@
|
|||||||
-- @alias druid.timer
|
-- @alias druid.timer
|
||||||
|
|
||||||
--- On timer tick. Fire every second callback(self, value)
|
--- On timer tick. Fire every second callback(self, value)
|
||||||
-- @tfield druid_event on_tick
|
-- @tfield DruidEvent on_tick @{DruidEvent}
|
||||||
|
|
||||||
--- On timer change enabled state callback(self, is_enabled)
|
--- On timer change enabled state callback(self, is_enabled)
|
||||||
-- @tfield druid_event on_set_enabled
|
-- @tfield DruidEvent on_set_enabled @{DruidEvent}
|
||||||
|
|
||||||
--- On timer end callback
|
--- On timer end callback
|
||||||
-- @tfield druid_event on_timer_end(self, Timer)
|
-- @tfield DruidEvent on_timer_end(self, Timer) @{DruidEvent}
|
||||||
|
|
||||||
--- Trigger node
|
--- Trigger node
|
||||||
-- @tfield node node
|
-- @tfield node node
|
||||||
@ -39,7 +39,7 @@ local Timer = component.create("timer")
|
|||||||
|
|
||||||
|
|
||||||
--- Component init function
|
--- Component init function
|
||||||
-- @tparam Timer self
|
-- @tparam Timer self @{Timer}
|
||||||
-- @tparam node node Gui text node
|
-- @tparam node node Gui text node
|
||||||
-- @tparam number seconds_from Start timer value in seconds
|
-- @tparam number seconds_from Start timer value in seconds
|
||||||
-- @tparam[opt=0] number seconds_to End timer value in seconds
|
-- @tparam[opt=0] number seconds_to End timer value in seconds
|
||||||
@ -94,7 +94,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set text to text field
|
--- Set text to text field
|
||||||
-- @tparam Timer self
|
-- @tparam Timer self @{Timer}
|
||||||
-- @tparam number set_to Value in seconds
|
-- @tparam number set_to Value in seconds
|
||||||
function Timer.set_to(self, set_to)
|
function Timer.set_to(self, set_to)
|
||||||
self.last_value = set_to
|
self.last_value = set_to
|
||||||
@ -103,7 +103,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Called when update
|
--- Called when update
|
||||||
-- @tparam Timer self
|
-- @tparam Timer self @{Timer}
|
||||||
-- @tparam bool is_on Timer enable state
|
-- @tparam bool is_on Timer enable state
|
||||||
function Timer.set_state(self, is_on)
|
function Timer.set_state(self, is_on)
|
||||||
self.is_on = is_on
|
self.is_on = is_on
|
||||||
@ -113,7 +113,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Set time interval
|
--- Set time interval
|
||||||
-- @tparam Timer self
|
-- @tparam Timer self @{Timer}
|
||||||
-- @tparam number from Start time in seconds
|
-- @tparam number from Start time in seconds
|
||||||
-- @tparam number to Target time in seconds
|
-- @tparam number to Target time in seconds
|
||||||
function Timer.set_interval(self, from, to)
|
function Timer.set_interval(self, from, to)
|
||||||
|
@ -209,7 +209,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--- Check if device is mobile (Android or iOS)
|
--- Check if device is mobile (Android or iOS)
|
||||||
-- @function helper..is_mobile
|
-- @function helper.is_mobile
|
||||||
function M.is_mobile()
|
function M.is_mobile()
|
||||||
return const.CURRENT_SYSTEM_NAME == const.OS.IOS or
|
return const.CURRENT_SYSTEM_NAME == const.OS.IOS or
|
||||||
const.CURRENT_SYSTEM_NAME == const.OS.ANDROID
|
const.CURRENT_SYSTEM_NAME == const.OS.ANDROID
|
||||||
|
19
druid/workspace.code-workspace
Normal file
19
druid/workspace.code-workspace
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "../test"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../editor_scripts"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../example"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "../docs_md"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1247,3 +1247,66 @@ embedded_instances {
|
|||||||
z: 1.0
|
z: 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
embedded_instances {
|
||||||
|
id: "custom_rich_input"
|
||||||
|
data: "components {\n"
|
||||||
|
" id: \"screen_factory\"\n"
|
||||||
|
" component: \"/monarch/screen_factory.script\"\n"
|
||||||
|
" position {\n"
|
||||||
|
" x: 0.0\n"
|
||||||
|
" y: 0.0\n"
|
||||||
|
" z: 0.0\n"
|
||||||
|
" }\n"
|
||||||
|
" rotation {\n"
|
||||||
|
" x: 0.0\n"
|
||||||
|
" y: 0.0\n"
|
||||||
|
" z: 0.0\n"
|
||||||
|
" w: 1.0\n"
|
||||||
|
" }\n"
|
||||||
|
" properties {\n"
|
||||||
|
" id: \"screen_id\"\n"
|
||||||
|
" value: \"custom_rich_input\"\n"
|
||||||
|
" type: PROPERTY_TYPE_HASH\n"
|
||||||
|
" }\n"
|
||||||
|
" properties {\n"
|
||||||
|
" id: \"popup\"\n"
|
||||||
|
" value: \"true\"\n"
|
||||||
|
" type: PROPERTY_TYPE_BOOLEAN\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n"
|
||||||
|
"embedded_components {\n"
|
||||||
|
" id: \"collectionfactory\"\n"
|
||||||
|
" type: \"collectionfactory\"\n"
|
||||||
|
" data: \"prototype: \\\"/example/examples/custom/rich_input/rich_input.collection\\\"\\n"
|
||||||
|
"load_dynamically: false\\n"
|
||||||
|
"\"\n"
|
||||||
|
" position {\n"
|
||||||
|
" x: 0.0\n"
|
||||||
|
" y: 0.0\n"
|
||||||
|
" z: 0.0\n"
|
||||||
|
" }\n"
|
||||||
|
" rotation {\n"
|
||||||
|
" x: 0.0\n"
|
||||||
|
" y: 0.0\n"
|
||||||
|
" z: 0.0\n"
|
||||||
|
" w: 1.0\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n"
|
||||||
|
""
|
||||||
|
position {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
}
|
||||||
|
rotation {
|
||||||
|
x: 0.0
|
||||||
|
y: 0.0
|
||||||
|
z: 0.0
|
||||||
|
w: 1.0
|
||||||
|
}
|
||||||
|
scale3 {
|
||||||
|
x: 1.0
|
||||||
|
y: 1.0
|
||||||
|
z: 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -144,6 +144,9 @@ local function init_lobby(self)
|
|||||||
self.lobby_grid:add(get_button_disabled(self, "Add/remove elements", "data_list_add_remove_nodes"))
|
self.lobby_grid:add(get_button_disabled(self, "Add/remove elements", "data_list_add_remove_nodes"))
|
||||||
self.lobby_grid:add(get_button(self, "Navigate over elements", "data_list_navigate", "/data_list/navigate/navigate.gui_script"))
|
self.lobby_grid:add(get_button(self, "Navigate over elements", "data_list_navigate", "/data_list/navigate/navigate.gui_script"))
|
||||||
|
|
||||||
|
self.lobby_grid:add(get_title(self, "Custom components"))
|
||||||
|
self.lobby_grid:add(get_button(self, "Rich Input", "custom_rich_input", "/data_list/static_grid/static_grid.gui_script"))
|
||||||
|
|
||||||
self.lobby_grid:add(get_title(self, "System"))
|
self.lobby_grid:add(get_title(self, "System"))
|
||||||
self.lobby_grid:add(get_button_disabled(self, "Styles"))
|
self.lobby_grid:add(get_button_disabled(self, "Styles"))
|
||||||
self.lobby_grid:add(get_button(self, "Whitelist / Blacklist", "system_whitelist_blacklist", "/system/whitelist_blacklist/whitelist_blacklist.gui_script"))
|
self.lobby_grid:add(get_button(self, "Whitelist / Blacklist", "system_whitelist_blacklist", "/system/whitelist_blacklist/whitelist_blacklist.gui_script"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user