mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
Update annotations
This commit is contained in:
parent
5848921cba
commit
ea80c874f6
@ -83,6 +83,10 @@
|
|||||||
|
|
||||||
<h2><a href="#Functions">Functions</a></h2>
|
<h2><a href="#Functions">Functions</a></h2>
|
||||||
<table class="function_list">
|
<table class="function_list">
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#add">add(self, data, index, shift_policy)</a></td>
|
||||||
|
<td class="summary">Add element to DataList.</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
|
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
|
||||||
<td class="summary">Clear the DataList and refresh visuals</td>
|
<td class="summary">Clear the DataList and refresh visuals</td>
|
||||||
@ -112,6 +116,14 @@
|
|||||||
<td class="summary">Druid System on_remove function</td>
|
<td class="summary">Druid System on_remove function</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#remove">remove(self, index, shift_policy)</a></td>
|
||||||
|
<td class="summary">Remove element from DataList.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#remove_by_data">remove_by_data(self, data, shift_policy)</a></td>
|
||||||
|
<td class="summary">Remove element from DataList by data value.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td class="name" nowrap><a href="#scroll_to_index">scroll_to_index(self, index)</a></td>
|
<td class="name" nowrap><a href="#scroll_to_index">scroll_to_index(self, index)</a></td>
|
||||||
<td class="summary">Instant scroll to element with passed index</td>
|
<td class="summary">Instant scroll to element with passed index</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -167,6 +179,39 @@
|
|||||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||||
|
|
||||||
<dl class="function">
|
<dl class="function">
|
||||||
|
<dt>
|
||||||
|
<a name = "add"></a>
|
||||||
|
<strong>add(self, data, index, shift_policy)</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Add element to DataList. Currenly untested
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Parameters:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><span class="parameter">self</span>
|
||||||
|
<span class="types"><span class="type">DataList</span></span>
|
||||||
|
<a href="../modules/DataList.html#">DataList</a>
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">data</span>
|
||||||
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">index</span>
|
||||||
|
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">shift_policy</span>
|
||||||
|
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
|
||||||
|
The constant from const.SHIFT.*
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "clear"></a>
|
<a name = "clear"></a>
|
||||||
<strong>clear(self)</strong>
|
<strong>clear(self)</strong>
|
||||||
@ -347,6 +392,64 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "remove"></a>
|
||||||
|
<strong>remove(self, index, shift_policy)</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Remove element from DataList. Currenly untested
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Parameters:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><span class="parameter">self</span>
|
||||||
|
<span class="types"><span class="type">DataList</span></span>
|
||||||
|
<a href="../modules/DataList.html#">DataList</a>
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">index</span>
|
||||||
|
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">shift_policy</span>
|
||||||
|
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
|
||||||
|
The constant from const.SHIFT.*
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "remove_by_data"></a>
|
||||||
|
<strong>remove_by_data(self, data, shift_policy)</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Remove element from DataList by data value. Currenly untested
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Parameters:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><span class="parameter">self</span>
|
||||||
|
<span class="types"><span class="type">DataList</span></span>
|
||||||
|
<a href="../modules/DataList.html#">DataList</a>
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">data</span>
|
||||||
|
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li><span class="parameter">shift_policy</span>
|
||||||
|
<span class="types"><span class="type">number</span> or <span class="type">nil</span></span>
|
||||||
|
The constant from const.SHIFT.*
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "scroll_to_index"></a>
|
<a name = "scroll_to_index"></a>
|
||||||
|
@ -81,19 +81,7 @@
|
|||||||
<b># Overview #</b>
|
<b># Overview #</b>
|
||||||
<p> This custom component is inspired by <a href="https://github.com/britzl/defold-richtext" target="_blank">defold-richtext</a> by britzl.
|
<p> This custom component is inspired by <a href="https://github.com/britzl/defold-richtext" target="_blank">defold-richtext</a> by britzl.
|
||||||
It uses a similar syntax for tags but currently supports fewer tags.
|
It uses a similar syntax for tags but currently supports fewer tags.
|
||||||
<p> All parameters for the Rich Text component are adjusted in the GUI scene.
|
<p> Create Rich Text on your GUI Text Node. All properties of the text node will be used as default for the text.
|
||||||
<p> This component uses GUI component template. (/druid/custom/rich_text/rich_text.gui).
|
|
||||||
<p> You able to customize it or make your own with the next node scructure:
|
|
||||||
<p> root
|
|
||||||
<p> - text_prefab
|
|
||||||
<p> - icon_prefab
|
|
||||||
<p> <b># Rich Text Setup #</b>
|
|
||||||
<p> • Root node size: Set the maximum width and height of the text.
|
|
||||||
<p> • Root anchor: Define the alignment of the Rich Text inside the root node size area.
|
|
||||||
<p> • Text prefab: Configure all default text parameters for the text node.
|
|
||||||
<p> • Text prefab anchor: Set the anchor for each text node (adjust this only if animating text).
|
|
||||||
<p> • Icon prefab: Configure all default node parameters for the icon node.
|
|
||||||
<p> • Icon prefab anchor: Set the anchor for each icon node (adjust this only if animating the icon).
|
|
||||||
<p> <b># Notes #</b>
|
<p> <b># Notes #</b>
|
||||||
<p> • Nested tags are supported
|
<p> • Nested tags are supported
|
||||||
<p> <a href="https://insality.github.io/druid/druid/index.html?example=custom_rich_text" target="_blank"><b>Example Link</b></a></p>
|
<p> <a href="https://insality.github.io/druid/druid/index.html?example=custom_rich_text" target="_blank"><b>Example Link</b></a></p>
|
||||||
@ -119,7 +107,6 @@ self.rich_text:set_text("Hello, Druid Rich Text!")
|
|||||||
outline: vector4,
|
outline: vector4,
|
||||||
font: string,
|
font: string,
|
||||||
image: druid.rich_text.image,
|
image: druid.rich_text.image,
|
||||||
default_animation: string,
|
|
||||||
br: boolean,
|
br: boolean,
|
||||||
nobr: boolean,
|
nobr: boolean,
|
||||||
}
|
}
|
||||||
|
@ -321,6 +321,14 @@ function druid__checkbox_group.set_state(self, indexes, is_instant) end
|
|||||||
---@field top_index number The current top index of visual elements
|
---@field top_index number The current top index of visual elements
|
||||||
local druid__data_list = {}
|
local druid__data_list = {}
|
||||||
|
|
||||||
|
--- Add element to DataList.
|
||||||
|
--- Currenly untested
|
||||||
|
---@param self druid.data_list @{DataList}
|
||||||
|
---@param data table
|
||||||
|
---@param index number|nil
|
||||||
|
---@param shift_policy number|nil The constant from const.SHIFT.*
|
||||||
|
function druid__data_list.add(self, data, index, shift_policy) end
|
||||||
|
|
||||||
--- Clear the DataList and refresh visuals
|
--- Clear the DataList and refresh visuals
|
||||||
---@param self druid.data_list @{DataList}
|
---@param self druid.data_list @{DataList}
|
||||||
function druid__data_list.clear(self) end
|
function druid__data_list.clear(self) end
|
||||||
@ -356,6 +364,20 @@ function druid__data_list.init(self, scroll, grid, create_function) end
|
|||||||
---@param self druid.data_list @{DataList}
|
---@param self druid.data_list @{DataList}
|
||||||
function druid__data_list.on_remove(self) end
|
function druid__data_list.on_remove(self) end
|
||||||
|
|
||||||
|
--- Remove element from DataList.
|
||||||
|
--- Currenly untested
|
||||||
|
---@param self druid.data_list @{DataList}
|
||||||
|
---@param index number|nil
|
||||||
|
---@param shift_policy number|nil The constant from const.SHIFT.*
|
||||||
|
function druid__data_list.remove(self, index, shift_policy) end
|
||||||
|
|
||||||
|
--- Remove element from DataList by data value.
|
||||||
|
--- Currenly untested
|
||||||
|
---@param self druid.data_list @{DataList}
|
||||||
|
---@param data table
|
||||||
|
---@param shift_policy number|nil The constant from const.SHIFT.*
|
||||||
|
function druid__data_list.remove_by_data(self, data, shift_policy) end
|
||||||
|
|
||||||
--- Instant scroll to element with passed index
|
--- Instant scroll to element with passed index
|
||||||
---@param self druid.data_list @{DataList}
|
---@param self druid.data_list @{DataList}
|
||||||
---@param index number
|
---@param index number
|
||||||
@ -1903,6 +1925,8 @@ function helper.table_to_string(t) end
|
|||||||
---@field height number
|
---@field height number
|
||||||
---@field offset_x number|nil
|
---@field offset_x number|nil
|
||||||
---@field offset_y number|nil
|
---@field offset_y number|nil
|
||||||
|
---@field max_ascent number
|
||||||
|
---@field max_descent number
|
||||||
---@field node_size vector3|nil @For images only
|
---@field node_size vector3|nil @For images only
|
||||||
|
|
||||||
---@class druid.rich_text.lines_metrics
|
---@class druid.rich_text.lines_metrics
|
||||||
@ -1967,12 +1991,22 @@ function helper.table_to_string(t) end
|
|||||||
---@field max_descent number
|
---@field max_descent number
|
||||||
|
|
||||||
---@class utf8
|
---@class utf8
|
||||||
---@field len fun(string: string): number
|
---@field len fun(s: string):number
|
||||||
---@field sub fun(string: string, i: number, j: number): string
|
---@field sub fun(s: string, start_index: number, length: number)
|
||||||
---@field gmatch fun(string: string, pattern: string): fun(): string
|
---@field reverse fun()
|
||||||
---@field gsub fun(string: string, pattern: string, repl: string, n: number): string
|
---@field char fun()
|
||||||
---@field char fun(...: number): string
|
---@field unicode fun()
|
||||||
---@field byte fun(string: string, i: number, j: number): number
|
---@field gensub fun()
|
||||||
|
---@field byte fun()
|
||||||
|
---@field find fun()
|
||||||
|
---@field match fun(s: string, m: string)
|
||||||
|
---@field gmatch fun(s: string, m: string)
|
||||||
|
---@field gsub fun()
|
||||||
|
---@field dump fun()
|
||||||
|
---@field format fun()
|
||||||
|
---@field lower fun()
|
||||||
|
---@field upper fun()
|
||||||
|
---@field rep fun()
|
||||||
|
|
||||||
|
|
||||||
---Add generics to some functions.
|
---Add generics to some functions.
|
||||||
|
@ -12,7 +12,6 @@ local utf8_lua = require("druid.system.utf8")
|
|||||||
local utf8 = utf8 or utf8_lua
|
local utf8 = utf8 or utf8_lua
|
||||||
|
|
||||||
local VECTOR_ZERO = vmath.vector3(0)
|
local VECTOR_ZERO = vmath.vector3(0)
|
||||||
local VECTOR_ONE = vmath.vector3(1)
|
|
||||||
local COLOR_WHITE = vmath.vector4(1)
|
local COLOR_WHITE = vmath.vector4(1)
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
@ -6,31 +6,7 @@
|
|||||||
-- This custom component is inspired by <a href="https://github.com/britzl/defold-richtext" target="_blank">defold-richtext</a> by britzl.
|
-- This custom component is inspired by <a href="https://github.com/britzl/defold-richtext" target="_blank">defold-richtext</a> by britzl.
|
||||||
-- It uses a similar syntax for tags but currently supports fewer tags.
|
-- It uses a similar syntax for tags but currently supports fewer tags.
|
||||||
--
|
--
|
||||||
-- All parameters for the Rich Text component are adjusted in the GUI scene.
|
-- Create Rich Text on your GUI Text Node. All properties of the text node will be used as default for the text.
|
||||||
--
|
|
||||||
-- This component uses GUI component template. (/druid/custom/rich_text/rich_text.gui).
|
|
||||||
--
|
|
||||||
-- You able to customize it or make your own with the next node scructure:
|
|
||||||
--
|
|
||||||
-- root
|
|
||||||
--
|
|
||||||
-- - text_prefab
|
|
||||||
--
|
|
||||||
-- - icon_prefab
|
|
||||||
--
|
|
||||||
-- <b># Rich Text Setup #</b>
|
|
||||||
--
|
|
||||||
-- • Root node size: Set the maximum width and height of the text.
|
|
||||||
--
|
|
||||||
-- • Root anchor: Define the alignment of the Rich Text inside the root node size area.
|
|
||||||
--
|
|
||||||
-- • Text prefab: Configure all default text parameters for the text node.
|
|
||||||
--
|
|
||||||
-- • Text prefab anchor: Set the anchor for each text node (adjust this only if animating text).
|
|
||||||
--
|
|
||||||
-- • Icon prefab: Configure all default node parameters for the icon node.
|
|
||||||
--
|
|
||||||
-- • Icon prefab anchor: Set the anchor for each icon node (adjust this only if animating the icon).
|
|
||||||
--
|
--
|
||||||
-- <b># Notes #</b>
|
-- <b># Notes #</b>
|
||||||
--
|
--
|
||||||
@ -58,7 +34,6 @@
|
|||||||
-- outline: vector4,
|
-- outline: vector4,
|
||||||
-- font: string,
|
-- font: string,
|
||||||
-- image: druid.rich_text.image,
|
-- image: druid.rich_text.image,
|
||||||
-- default_animation: string,
|
|
||||||
-- br: boolean,
|
-- br: boolean,
|
||||||
-- nobr: boolean,
|
-- nobr: boolean,
|
||||||
-- }
|
-- }
|
||||||
|
@ -115,9 +115,8 @@ end
|
|||||||
--- Add element to DataList. Currenly untested
|
--- Add element to DataList. Currenly untested
|
||||||
-- @tparam DataList self @{DataList}
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam table data
|
-- @tparam table data
|
||||||
-- @tparam number index
|
-- @tparam number|nil index
|
||||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
-- @tparam number|nil shift_policy The constant from const.SHIFT.*
|
||||||
-- @local
|
|
||||||
function DataList.add(self, data, index, shift_policy)
|
function DataList.add(self, data, index, shift_policy)
|
||||||
index = index or #self._data + 1
|
index = index or #self._data + 1
|
||||||
shift_policy = shift_policy or const.SHIFT.RIGHT
|
shift_policy = shift_policy or const.SHIFT.RIGHT
|
||||||
@ -129,9 +128,8 @@ end
|
|||||||
|
|
||||||
--- Remove element from DataList. Currenly untested
|
--- Remove element from DataList. Currenly untested
|
||||||
-- @tparam DataList self @{DataList}
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam number index
|
-- @tparam number|nil index
|
||||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
-- @tparam number|nil shift_policy The constant from const.SHIFT.*
|
||||||
-- @local
|
|
||||||
function DataList.remove(self, index, shift_policy)
|
function DataList.remove(self, index, shift_policy)
|
||||||
helper.remove_with_shift(self._data, index, shift_policy)
|
helper.remove_with_shift(self._data, index, shift_policy)
|
||||||
self:_refresh()
|
self:_refresh()
|
||||||
@ -140,9 +138,8 @@ end
|
|||||||
|
|
||||||
--- Remove element from DataList by data value. Currenly untested
|
--- Remove element from DataList by data value. Currenly untested
|
||||||
-- @tparam DataList self @{DataList}
|
-- @tparam DataList self @{DataList}
|
||||||
-- @tparam tabe data
|
-- @tparam table data
|
||||||
-- @tparam number shift_policy The constant from const.SHIFT.*
|
-- @tparam number|nil shift_policy The constant from const.SHIFT.*
|
||||||
-- @local
|
|
||||||
function DataList.remove_by_data(self, data, shift_policy)
|
function DataList.remove_by_data(self, data, shift_policy)
|
||||||
local index = helper.contains(self._data, data)
|
local index = helper.contains(self._data, data)
|
||||||
if index then
|
if index then
|
||||||
|
@ -297,9 +297,9 @@ function M.clear_layout(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @private
|
|
||||||
-- @tparam node node
|
-- @tparam node node
|
||||||
-- @treturn number, number
|
-- @treturn number, number
|
||||||
|
-- @local
|
||||||
function M.get_node_size(node)
|
function M.get_node_size(node)
|
||||||
if not gui.is_enabled(node, false) then
|
if not gui.is_enabled(node, false) then
|
||||||
return 0, 0
|
return 0, 0
|
||||||
@ -318,10 +318,10 @@ function M.get_node_size(node)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- @private
|
|
||||||
-- @tparam Layout self @{Layout}
|
-- @tparam Layout self @{Layout}
|
||||||
-- Calculate rows data for layout. Contains total width, height and rows info (width, height, count of elements in row)
|
-- Calculate rows data for layout. Contains total width, height and rows info (width, height, count of elements in row)
|
||||||
-- @treturn druid.layout.rows_data
|
-- @treturn druid.layout.rows_data
|
||||||
|
-- @local
|
||||||
function M.calculate_rows_data(self)
|
function M.calculate_rows_data(self)
|
||||||
local entities = self.entities
|
local entities = self.entities
|
||||||
local margin = self.margin
|
local margin = self.margin
|
||||||
@ -401,11 +401,11 @@ function M.calculate_rows_data(self)
|
|||||||
return rows_data
|
return rows_data
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @private
|
|
||||||
-- @tparam node node
|
-- @tparam node node
|
||||||
-- @tparam number x
|
-- @tparam number x
|
||||||
-- @tparam number y
|
-- @tparam number y
|
||||||
-- @treturn node
|
-- @treturn node
|
||||||
|
-- @local
|
||||||
function M:set_node_position(node, x, y)
|
function M:set_node_position(node, x, y)
|
||||||
local position = gui.get_position(node)
|
local position = gui.get_position(node)
|
||||||
position.x = x
|
position.x = x
|
||||||
|
@ -73,12 +73,22 @@
|
|||||||
---@field max_descent number
|
---@field max_descent number
|
||||||
|
|
||||||
---@class utf8
|
---@class utf8
|
||||||
---@field len fun(string: string): number
|
---@field len fun(s: string):number
|
||||||
---@field sub fun(string: string, i: number, j: number): string
|
---@field sub fun(s: string, start_index: number, length: number)
|
||||||
---@field gmatch fun(string: string, pattern: string): fun(): string
|
---@field reverse fun()
|
||||||
---@field gsub fun(string: string, pattern: string, repl: string, n: number): string
|
---@field char fun()
|
||||||
---@field char fun(...: number): string
|
---@field unicode fun()
|
||||||
---@field byte fun(string: string, i: number, j: number): number
|
---@field gensub fun()
|
||||||
|
---@field byte fun()
|
||||||
|
---@field find fun()
|
||||||
|
---@field match fun(s: string, m: string)
|
||||||
|
---@field gmatch fun(s: string, m: string)
|
||||||
|
---@field gsub fun()
|
||||||
|
---@field dump fun()
|
||||||
|
---@field format fun()
|
||||||
|
---@field lower fun()
|
||||||
|
---@field upper fun()
|
||||||
|
---@field rep fun()
|
||||||
|
|
||||||
|
|
||||||
---Add generics to some functions.
|
---Add generics to some functions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user