diff --git a/druid/base/button.lua b/druid/base/button.lua index 62b85ed..f2d0a9e 100755 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -1,20 +1,24 @@ -- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license ---- Druid Component to handle the user click interactions: click, long click, double click, etc. --- # Overview # +--- Druid Component for Handling User Click Interactions: Click, Long Click, Double Click, and More. + +-- ## Overview ## -- --- The most generic component you can use. Set any GUI node clickable and provide different callbacks. +-- This component provides a versatile solution for handling user click interactions. +-- It allows you to make any GUI node clickable and define various callbacks for different types of clicks. -- --- # Notes # +-- ## Notes ## -- --- • The click callback will not trigger if between pressed and released state cursor was outside of node zone +-- • The click callback will not trigger if the cursor moves outside the node's +-- area between the pressed and released states. -- --- • If button have double click event subscriber and it is triggered, usual callback will be not triggered +-- • If a button has a double click event subscriber and the double click event is triggered, +-- the regular click callback will not be triggered. -- --- • Button can have key trigger to use then by key: `button:set_key_trigger` --- --- • Animation node can be used for example to animate small icon on big panel. Node name of trigger zone will be `big panel` and animation node will be `small icon` +-- • Buttons can be triggered using a keyboard key by calling the button:set_key_trigger method. -- +-- • To animate a small icon on a big button panel, you can use an animation node. +-- The trigger node name should be set as "big panel," and the animation node should be set as "small icon." -- @usage -- local function on_button_click(self, args, button) -- print("Button has clicked with params: " .. args) diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index 39c3b6b..80b7841 100755 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -1,30 +1,35 @@ -- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license ---- Component to handle scroll content. --- # Overview # +-- ## Overview ## -- --- Scroll consist from two nodes: scroll parent and scroll input --- Scroll input the user input zone, it's static --- Scroll parent the scroll moving part, it will change position. --- Setup initial scroll size by changing scroll parent size. If scroll parent --- size will be less than scroll_input size, no scroll is available. +-- The Scroll component is designed to handle scrollable content and consists of two nodes: the scroll parent and the scroll input. -- --- # Notes # +-- The scroll input represents the user input zone and remains static. -- --- • Scroll by default style have inertion and extra size for strecthing effect. --- It can be adjust via scroll style settings +-- The scroll parent is the movable part of the scroll and changes its position. -- --- • You can setup "points of interest". Scroll always will be centered on closes point of interest. --- It is able to create slider without inertion and points of interest on each scroll element. +-- The initial scroll size can be set by adjusting the size of the scroll parent. +-- If the size of the scroll parent is smaller than the scroll input size, scrolling is not available. -- --- • You can adjust scroll content size by `scroll:set_size(node_size)`. --- It will setup new size to _content node_ +-- ## Notes ## -- --- • You can enabled or disable inertion mode via `scroll:set_inert(state)` +-- • By default, the scroll style includes inertia and extra size for a stretching effect. +-- These settings can be adjusted using the scroll style settings. +-- For more details, refer to the scroll style settings. -- --- • You can adjust extra stretch size via `scroll:set_extra_stretch_size` +-- • "Points of interest" can be set up for the scroll. +-- The scroll will always be centered on the closest point of interest. +-- This feature allows creating a slider without inertia and with points of interest on each scroll element. -- --- • Multitouch is required for scroll. Scroll is correctly handling touch_id swap while dragging scroll +-- • The scroll content size can be adjusted using the scroll:set_size(node_size) method. +-- This method sets a new size for the _content node. +-- +-- • Inertial scrolling mode can be enabled or disabled using the scroll:set_inert(state) method. +-- +-- • The extra stretch size can be adjusted using the scroll:set_extra_stretch_size method. +-- +-- • Multitouch is required for scrolling. The scroll component correctly handles +-- touch ID swaps while dragging the scroll. -- @module Scroll -- @within BaseComponent -- @alias druid.scroll diff --git a/druid/base/static_grid.lua b/druid/base/static_grid.lua index 938f604..54554cc 100644 --- a/druid/base/static_grid.lua +++ b/druid/base/static_grid.lua @@ -1,27 +1,34 @@ -- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle component's position by row and columns. --- # Overview # +-- ## Overview ## -- --- # Notes # +-- The Static Grid component allows for positioning components in rows and columns. +-- It provides a static grid layout with constant node sizes, allowing for pre-calculated +-- node positions and the option to include gaps between nodes. -- --- • Static grid have constant node size, so it possible to calculate node positions before placement. Nodes can be placed with gaps. +-- ## Notes ## -- --- • Static grid can shift elements on add/remove functions. +-- • In a static grid, the node size remains constant, enabling the calculation of node +-- positions before placement. Nodes can be placed with gaps between them. -- --- • On _add node_ grid will set node parent to _parent_node_ +-- • The static grid can automatically shift elements when nodes are added or removed. -- --- • You can get array of position of every element for setup points of interest in scroll component +-- • When a node is added, the grid will set the node's parent to the specified parent_node. -- --- • You can get size of all elements for setup size in scroll component +-- • You can obtain an array of positions for each element, which can be used to set +-- points of interest in a scroll component. -- --- • You can bind the grid to the scroll component for auto resize scroll content size +-- • The size of all elements can be retrieved for setting up the size in a scroll component. -- --- • Pivot of parent_node matter for node placement +-- • The grid can be bound to a scroll component for automatic resizing of the scroll content size. -- --- • Prefab node used to get node size and anchor +-- • The pivot of the parent_node affects the node placement within the grid. -- --- • You can point *position_function* for animations with _static_grid:set_position_function(node, pos)_ callback. Default - *gui.set_position()* +-- • A prefab node is used to determine the node size and anchor. +-- +-- • You can specify a position_function for animations using the +-- _static_grid:set_position_function(node, pos) callback. The default position function is gui.set_position(). -- @module StaticGrid -- @within BaseComponent -- @alias druid.static_grid diff --git a/druid/base/text.lua b/druid/base/text.lua index be74cd8..6372a79 100755 --- a/druid/base/text.lua +++ b/druid/base/text.lua @@ -1,29 +1,34 @@ -- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license ---- Component to wrap over GUI Text nodes. --- # Overview # +--- Component for Wrapping GUI Text Nodes: Druid Text -- --- Druid Text provide different adjust modes. Text will be scaled down to fit into Text Node area size. +-- ## Overview ## -- --- # Notes # +-- Druid Text is a component that provides various adjustment modes for text nodes. It allows text to be scaled down to fit within the size of the text node. -- --- • Text pivot can be changed with `text:set_pivot`. The anchoring will be inside text node area size. +-- ## Notes ## -- --- • There is several text adjust types. Default DOWNSCALE. You can change the default adjust type in the Text style. See all adjust types in example here. +-- • The text pivot can be changed using the text:set_pivot method. +-- The anchoring will be inside the text node's area size. -- --- - const.TEXT_ADJUST.DOWNSCALE - Change text's scale to fit into the text node size +-- • There are several text adjustment types available. The default is DOWNSCALE. +-- You can change the default adjustment type in the Text style. Refer to the example below to see all available adjustment types: -- --- - const.TEXT_ADJUST.TRIM - Trim the text with postfix (default - "...", override in styles) to fit in the text node size +-- - const.TEXT_ADJUST.DOWNSCALE: Changes the text's scale to fit within the text node's size. -- --- - const.TEXT_ADJUST.NO_ADJUST - No any adjust, like default Defold Text Node +-- - const.TEXT_ADJUST.TRIM: Trims the text with a postfix (default: "...", can be overridden in styles) +-- to fit within the text node's size. -- --- - const.TEXT_ADJUST.DOWNSCALE_LIMITED - Change text's scale list downscale, but there is limit for text's scale. --- Set minimal scale with `text:set_minimal_scale()` function. +-- - const.TEXT_ADJUST.NO_ADJUST: No adjustment is applied, similar +-- to the default Defold Text Node behavior. -- --- - const.TEXT_ADJUST.SCROLL - Change text's pivot to imitate scrolling in the text box. Use with stencil node for better effect. +-- - const.TEXT_ADJUST.DOWNSCALE_LIMITED: Changes the text's scale +-- with a limited downscale. You can set the minimum scale using the text:set_minimal_scale() function. -- --- - const.TEXT_ADJUST.SCALE_THEN_SCROLL - Combine two modes: first limited downscale, then scroll +-- - const.TEXT_ADJUST.SCROLL: Changes the text's pivot to imitate scrolling within the text box. +-- For better effect, use with a stencil node. -- +-- - const.TEXT_ADJUST.SCALE_THEN_SCROLL: Combines two modes: limited downscale first, then scroll. -- @module Text -- @within BaseComponent -- @alias druid.text diff --git a/druid/custom/rich_text/rich_text.lua b/druid/custom/rich_text/rich_text.lua index b84191f..54073ce 100644 --- a/druid/custom/rich_text/rich_text.lua +++ b/druid/custom/rich_text/rich_text.lua @@ -3,8 +3,6 @@ --- Druid Rich Text custom component. -- # Overview # -- --- --- -- # Notes # -- -- @usage diff --git a/druid/extended/lang_text.lua b/druid/extended/lang_text.lua index 5be7f6e..b1841fa 100755 --- a/druid/extended/lang_text.lua +++ b/druid/extended/lang_text.lua @@ -2,13 +2,15 @@ --- Component to wrap over GUI Text nodes with localization helpers -- --- # Overview # +-- ## Overview ## -- --- • The `druid.set_text_function` should be inited to get the localization by localization_id +-- • The initialization of druid.set_text_function is required to enable localization +-- using the localization ID. -- --- • The LangText supports up to 7 string format params, due the some issues with `...` args. +-- • The LangText component supports up to 7 string format parameters. +-- This limitation exists due to certain issues with using ... arguments. -- --- # Notes # +-- ## Notes ## -- -- @module LangText -- @within BaseComponent