Update docs

This commit is contained in:
Insality
2023-08-05 19:32:47 +03:00
parent 37fff52aa5
commit d7dd4a86b8
16 changed files with 273 additions and 136 deletions

View File

@@ -96,7 +96,7 @@ local back_handler = self.druid:new_back_handler(callback, [params])
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_back">on_back</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a> Event on back handler action.</td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a> Event on back handler action.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#params">params</a></td>
@@ -116,7 +116,7 @@ local back_handler = self.druid:new_back_handler(callback, [params])
<strong>on_back</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a> Event on back handler action.
The <a href="../modules/DruidEvent.html#">DruidEvent</a> Event on back handler action.
<p> Trigger on input action ACTION_BACK or ACTION_BACKSPACE

View File

@@ -151,7 +151,7 @@ return AwesomeComponent
</tr>
<tr>
<td class="name" nowrap><a href="#component:set_nodes">component:set_nodes(self, nodes)</a></td>
<td class="summary">Set current component nodes</td>
<td class="summary">Set current component nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#component:set_style">component:set_style(self, druid_style)</a></td>
@@ -548,7 +548,8 @@ return AwesomeComponent
<strong>component:set_nodes(self, nodes)</strong>
</dt>
<dd>
Set current component nodes Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree.
Set current component nodes.
Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree.
<h3>Parameters:</h3>

View File

@@ -111,7 +111,7 @@ local button = self.druid:new_button(&quot;button_name&quot;, on_button_click, c
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, custom_args[, anim_node]])</a></td>
<td class="summary"><a href="../modules/Button.html#">Button</a> constructor</td>
<td class="summary">The <a href="../modules/Button.html#">Button</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
@@ -157,7 +157,7 @@ local button = self.druid:new_button(&quot;button_name&quot;, on_button_click, c
</tr>
<tr>
<td class="name" nowrap><a href="#hover">hover</a></td>
<td class="summary"><a href="../modules/Hover.html#">Hover</a>: Button Hover component</td>
<td class="summary">The <a href="../modules/Hover.html#">Hover</a>: Button Hover component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
@@ -169,31 +169,31 @@ local button = self.druid:new_button(&quot;button_name&quot;, on_button_click, c
</tr>
<tr>
<td class="name" nowrap><a href="#on_click">on_click</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on successful release action over button.</td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on successful release action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_click_outside">on_click_outside</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls if click event was outside of button.</td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls if click event was outside of button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_double_click">on_double_click</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on double tap action over button.</td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on double tap action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_hold_callback">on_hold_callback</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls every frame before on_long_click event.</td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls every frame before on_long_click event.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_long_click">on_long_click</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on long tap action over button.</td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on long tap action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_pressed">on_pressed</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event triggered if button was pressed by user.</td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event triggered if button was pressed by user.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_repeated_click">on_repeated_click</a></td>
<td class="summary"><a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on repeated action over button.</td>
<td class="summary">The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on repeated action over button.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#params">params</a></td>
@@ -244,7 +244,7 @@ local button = self.druid:new_button(&quot;button_name&quot;, on_button_click, c
<strong>init(self, node, callback[, custom_args[, anim_node]])</strong>
</dt>
<dd>
<a href="../modules/Button.html#">Button</a> constructor
The <a href="../modules/Button.html#">Button</a> constructor
<h3>Parameters:</h3>
@@ -607,7 +607,7 @@ button:set_enabled(<span class="keyword">true</span>)</pre>
<strong>hover</strong>
</dt>
<dd>
<a href="../modules/Hover.html#">Hover</a>: Button Hover component
The <a href="../modules/Hover.html#">Hover</a>: Button Hover component
<ul>
@@ -667,7 +667,7 @@ button:set_enabled(<span class="keyword">true</span>)</pre>
<strong>on_click</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on successful release action over button.
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on successful release action over button.
<ul>
@@ -694,7 +694,7 @@ button:set_enabled(<span class="keyword">true</span>)</pre>
<strong>on_click_outside</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls if click event was outside of button.
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls if click event was outside of button.
<p> This event will be triggered for each button what was not clicked on user click action
<p> Usecase: Hide the popup when click outside
@@ -723,7 +723,7 @@ button:set_enabled(<span class="keyword">true</span>)</pre>
<strong>on_double_click</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on double tap action over button.
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on double tap action over button.
<p> If secondary click was too fast after previous one, the double
click will be called instead usual click (if on_double_click subscriber exists)
@@ -752,7 +752,7 @@ button:set_enabled(<span class="keyword">true</span>)</pre>
<strong>on_hold_callback</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls every frame before on_long_click event.
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event calls every frame before on_long_click event.
<p> If long_click subscriber exists, the on_hold_callback will be called before long_click trigger.
<p> Usecase: Animate button progress of long tap
@@ -781,7 +781,7 @@ button:set_enabled(<span class="keyword">true</span>)</pre>
<strong>on_long_click</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on long tap action over button.
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on long tap action over button.
<p> This callback will be triggered if user pressed the button and hold the some amount of time.
The amount of time picked from button style param: LONGTAP_TIME
@@ -810,7 +810,7 @@ button:set_enabled(<span class="keyword">true</span>)</pre>
<strong>on_pressed</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event triggered if button was pressed by user.
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event triggered if button was pressed by user.
<ul>
@@ -837,7 +837,7 @@ button:set_enabled(<span class="keyword">true</span>)</pre>
<strong>on_repeated_click</strong>
</dt>
<dd>
<a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on repeated action over button.
The <a href="../modules/DruidEvent.html#">DruidEvent</a>: Event on repeated action over button.
<p> This callback will be triggered if user hold the button. The repeat rate pick from `input.repeat_interval` in game.project

View File

@@ -206,6 +206,10 @@ end
<td class="summary">Create <a href="../modules/RadioGroup.html#">RadioGroup</a> component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_rich_text">new_rich_text(self[, template[, nodes]])</a></td>
<td class="summary">Create <a href="../modules/RichText.html#">RichText</a> component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new_scroll">new_scroll(self, view_node, content_node)</a></td>
<td class="summary">Create <a href="../modules/Scroll.html#">Scroll</a> component</td>
</tr>
@@ -882,6 +886,44 @@ end
</dd>
<dt>
<a name = "new_rich_text"></a>
<strong>new_rich_text(self[, template[, nodes]])</strong>
</dt>
<dd>
Create <a href="../modules/RichText.html#">RichText</a> component.
As a template please check rich_text.gui layout.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidInstance</span></span>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Template name if used
(<em>optional</em>)
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Nodes table from gui.clone_tree
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">RichText</span></span>
<a href="../modules/RichText.html#">RichText</a> component
</ol>
</dd>
<dt>
<a name = "new_scroll"></a>
@@ -1238,6 +1280,12 @@ end
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">self</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</ol>
@@ -1266,6 +1314,12 @@ end
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">self</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</ol>

View File

@@ -86,6 +86,10 @@ helper.centrate_nodes(0, node_1, node_2)
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#helper.add_array">helper.add_array(target[, source])</a></td>
<td class="summary">Add all elements from source array to the target array</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_nodes">helper.centrate_nodes([margin=0], ...)</a></td>
<td class="summary">Centerate nodes by x position with margin.</td>
@@ -143,10 +147,6 @@ helper.centrate_nodes(0, node_1, node_2)
<td class="summary">Add value to array with shift policy</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_enabled">helper.is_enabled(node)</a></td>
<td class="summary">Check if node is enabled in GUI hierarchy.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_mobile">helper.is_mobile()</a></td>
<td class="summary">Check if device is native mobile (Android or iOS)</td>
</tr>
@@ -187,6 +187,38 @@ helper.centrate_nodes(0, node_1, node_2)
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "helper.add_array"></a>
<strong>helper.add_array(target[, source])</strong>
</dt>
<dd>
Add all elements from source array to the target array
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">target</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Array to put elements from source
</li>
<li><span class="parameter">source</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
The source array to get elements from
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">array</span></span>
The target array
</ol>
</dd>
<dt>
<a name = "helper.centrate_nodes"></a>
<strong>helper.centrate_nodes([margin=0], ...)</strong>
@@ -555,7 +587,7 @@ helper.centrate_nodes(0, node_1, node_2)
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">pepepe</span></span>
<span class="types"><span class="type">GUITextMetrics</span></span>
</ol>
@@ -611,34 +643,6 @@ helper.centrate_nodes(0, node_1, node_2)
</dd>
<dt>
<a name = "helper.is_enabled"></a>
<strong>helper.is_enabled(node)</strong>
</dt>
<dd>
Check if node is enabled in GUI hierarchy.
<p> Return false, if node or any his parent is disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
GUI node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is enabled in hierarchy
</ol>
</dd>
<dt>
<a name = "helper.is_mobile"></a>

View File

@@ -94,7 +94,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, node, locale_id[, adjust_type=downscale])</a></td>
<td class="summary"><a href="../modules/LangText.html#">LangText</a> constructor</td>
<td class="summary">The <a href="../modules/LangText.html#">LangText</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, text)</a></td>
@@ -191,7 +191,7 @@
<strong>init(self, node, locale_id[, adjust_type=downscale])</strong>
</dt>
<dd>
<a href="../modules/LangText.html#">LangText</a> constructor
The <a href="../modules/LangText.html#">LangText</a> constructor
<h3>Parameters:</h3>

View File

@@ -33,6 +33,7 @@
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Tables">Tables</a></li>
</ul>
@@ -118,7 +119,6 @@ self.rich_text:set_text(&quot;Hello, Druid Rich Text!&quot;)
font: string,
image: druid.rich_text.image,
default_animation: string,
anchor: number,
br: boolean,
nobr: boolean,
}
@@ -150,10 +150,14 @@ type druid.rich_text.metrics = {
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#clean">clean()</a></td>
<td class="name" nowrap><a href="#clear">clear()</a></td>
<td class="summary">Clear all created words.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_line_metric">get_line_metric()</a></td>
<td class="summary">Get current line metrics</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_words">get_words()</a></td>
<td class="summary">Get all current words.</td>
</tr>
@@ -167,7 +171,14 @@ type druid.rich_text.metrics = {
</tr>
<tr>
<td class="name" nowrap><a href="#tagged">tagged(tag)</a></td>
<td class="summary">Get all words, which has a passed tag</td>
<td class="summary">Get all words, which has a passed tag.</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#style">style</a></td>
<td class="summary">Component style params.</td>
</tr>
</table>
@@ -179,8 +190,8 @@ type druid.rich_text.metrics = {
<dl class="function">
<dt>
<a name = "clean"></a>
<strong>clean()</strong>
<a name = "clear"></a>
<strong>clear()</strong>
</dt>
<dd>
Clear all created words.
@@ -191,6 +202,26 @@ type druid.rich_text.metrics = {
</dd>
<dt>
<a name = "get_line_metric"></a>
<strong>get_line_metric()</strong>
</dt>
<dd>
Get current line metrics
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.rich_text.lines_metrics</span></span>
</ol>
</dd>
<dt>
<a name = "get_words"></a>
@@ -205,7 +236,7 @@ type druid.rich_text.metrics = {
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Words
druid.rich_text.word[]
</ol>
@@ -325,7 +356,7 @@ Words &lt;nobr&gt;inside tag&lt;/nobr&gt; won't <span class="keyword">break</spa
<strong>tagged(tag)</strong>
</dt>
<dd>
Get all words, which has a passed tag
Get all words, which has a passed tag.
<h3>Parameters:</h3>
@@ -339,13 +370,51 @@ Words &lt;nobr&gt;inside tag&lt;/nobr&gt; won't <span class="keyword">break</spa
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Words
<span class="types"><span class="type">druid.rich_text.word[]</span></span>
words
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "style"></a>
<strong>style</strong>
</dt>
<dd>
Component style params.
You can override this component styles params in Druid styles table
or create your own style
<h3>Fields:</h3>
<ul>
<li><span class="parameter">COLORS</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Rich Text color aliases
(<em>default</em> {})
</li>
<li><span class="parameter">ADJUST_STEPS</span>
<span class="types"><span class="type">number</span></span>
Amount steps of attemps text adjust by height
(<em>default</em> 20)
</li>
<li><span class="parameter">ADJUST_SCALE_DELTA</span>
<span class="types"><span class="type">number</span></span>
Scale step on each height adjust step
(<em>default</em> 0.02)
</li>
</ul>
</dd>
</dl>

View File

@@ -78,13 +78,14 @@
<h1>Module <code>StaticGrid</code></h1>
<p>Component to handle component's position by row and columns.</p>
<p>
## Overview ##
<b># Overview #</b>
<p> 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.
<p> ## Notes ##
<p> <b># Notes #</b>
<p> • 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.
positions before placement. If you want add gaps between nodes, increase the root prefab size,
including the padding and margin.
<p> • The static grid can automatically shift elements when nodes are added or removed.
<p> • When a node is added, the grid will set the node's parent to the specified parent_node.
<p> • You can obtain an array of positions for each element, which can be used to set
@@ -138,7 +139,7 @@
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, parent, element[, in_row=1])</a></td>
<td class="summary"><a href="../modules/StaticGrid.html#">StaticGrid</a> constructor</td>
<td class="summary">The <a href="../modules/StaticGrid.html#">StaticGrid</a> constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</a></td>
@@ -501,7 +502,7 @@
<strong>init(self, parent, element[, in_row=1])</strong>
</dt>
<dd>
<a href="../modules/StaticGrid.html#">StaticGrid</a> constructor
The <a href="../modules/StaticGrid.html#">StaticGrid</a> constructor
<h3>Parameters:</h3>