Clean up todo, more docs

This commit is contained in:
Insality 2020-03-22 15:32:00 +03:00
parent 696622b42b
commit 7c22032004
33 changed files with 92 additions and 72 deletions

View File

@ -185,7 +185,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -117,6 +117,10 @@
<td class="summary">Get current component interests</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_node">get_node(node_or_name)</a></td>
<td class="summary">Get node for component by name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_druid">get_druid()</a></td>
<td class="summary">Return druid with context of calling component.</td>
</tr>
@ -320,6 +324,36 @@
</dd>
<dt>
<a name = "get_node"></a>
<strong>get_node(node_or_name)</strong>
</dt>
<dd>
Get node for component by name.
If component has nodes, node<em>or</em>name should be string
It auto pick node by template name or from nodes by clone<em>tree
if they was setup via component:set</em>nodes, component:set_template
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node_or_name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.3/manual.html#6.4">string</a> or <span class="type">node</span></span>
Node name or node itself
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">node</span></span>
Gui node
</ol>
</dd>
<dt>
<a name = "get_druid"></a>
@ -406,7 +440,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -215,7 +215,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -234,7 +234,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -305,6 +305,10 @@
<span class="types"><span class="type">druid_event</span></span>
On double tap button callback
</li>
<li><span class="parameter">on_hold_callback</span>
<span class="types"><span class="type">druid_event</span></span>
On button hold before long_click callback
</li>
</ul>
@ -331,7 +335,7 @@
Animation node
(<em>default</em> node)
</li>
<li><span class="parameter">scale_from</span>
<li><span class="parameter">start_scale</span>
<span class="types"><span class="type">vector3</span></span>
Initial scale of anim_node
</li>
@ -405,7 +409,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -277,7 +277,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -239,7 +239,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -370,7 +370,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -236,7 +236,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -211,7 +211,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -181,7 +181,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -86,7 +86,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -240,7 +240,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -378,7 +378,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -239,7 +239,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -507,7 +507,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -278,7 +278,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -352,7 +352,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -267,31 +267,17 @@
<span class="types"><span class="type">node</span></span>
Trigger node
</li>
<li><span class="parameter">anim_node</span>
<span class="types"><span class="type">node</span></span>
Animation node
(<em>default</em> node)
<li><span class="parameter">from</span>
<span class="types"><span class="type">number</span></span>
Initial timer value
</li>
<li><span class="parameter">scale_from</span>
<span class="types"><span class="type">vector3</span></span>
Initial scale of anim_node
<li><span class="parameter">target</span>
<span class="types"><span class="type">number</span></span>
Target timer value
</li>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
Initial pos of anim_node
</li>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
Params to click callbacks
</li>
<li><span class="parameter">hover</span>
<span class="types"><span class="type">druid.hover</span></span>
Druid hover logic component
</li>
<li><span class="parameter">click_zone</span>
<span class="types"><span class="type">node</span></span>
Restriction zone
(<em>optional</em>)
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
Current timer value
</li>
</ul>
@ -307,7 +293,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -239,7 +239,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -750,7 +750,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -111,7 +111,7 @@
- **on_click** - basic button callback
- **on_repeated_click** - repeated click callback, <span class="keyword">while</span> holding the button, don<span class="string">'t trigger if callback is empty
- **on_long_click** - callback on long button tap, don'</span>t trigger <span class="keyword">if</span> callback is empty
- **on_hold_click** - hold callback, before long_click trigger, don<span class="string">'t trigger if callback is empty
- **on_hold_callback** - hold callback, before long_click trigger, don<span class="string">'t trigger if callback is empty
- **on_double_click** - different callback, if tap button 2+ in row, don'</span>t trigger <span class="keyword">if</span> callback is empty
</pre>
</li>
@ -210,7 +210,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -202,7 +202,7 @@ There is next interests in druid:
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -138,7 +138,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -89,7 +89,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -87,7 +87,7 @@
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -291,7 +291,7 @@ https://insality.github.io/druid/</p>
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2020-03-22 15:19:02 </i>
<i style="float:right;">Last updated 2020-03-22 15:31:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>

View File

@ -13,7 +13,7 @@
-- @table Fields
-- @tfield node node Trigger node
-- @tfield[opt=node] node anim_node Animation node
-- @tfield vector3 scale_from Initial scale of anim_node
-- @tfield vector3 start_scale Initial scale of anim_node
-- @tfield vector3 pos Initial pos of anim_node
-- @tfield any params Params to click callbacks
-- @tfield druid.hover hover Druid hover logic component
@ -152,8 +152,7 @@ function M.init(self, node, callback, params, anim_node, event)
self.node = self:get_node(node)
self.anim_node = anim_node and helper:get_node(anim_node) or self.node
-- TODO: rename to start_scale
self.scale_from = gui.get_scale(self.anim_node)
self.start_scale = gui.get_scale(self.anim_node)
self.params = params
self.hover = self.druid:new_hover(node, on_button_hover)
self.click_zone = nil

View File

@ -12,12 +12,9 @@
--- Component fields
-- @table Fields
-- @tfield node node Trigger node
-- @tfield[opt=node] node anim_node Animation node
-- @tfield vector3 scale_from Initial scale of anim_node
-- @tfield vector3 pos Initial pos of anim_node
-- @tfield any params Params to click callbacks
-- @tfield druid.hover hover Druid hover logic component
-- @tfield[opt] node click_zone Restriction zone
-- @tfield number from Initial timer value
-- @tfield number target Target timer value
-- @tfield number value Current timer value
local Event = require("druid.event")
local const = require("druid.const")

View File

@ -86,10 +86,13 @@ function Component.get_interests(self)
end
-- TODO: Определиться с get_node и node
-- get_node - берет ноду по ноде или строке
-- node - может брать ноду у компонента по схеме (если есть
-- template или таблица нод после gui.clone_tree)
--- Get node for component by name.
-- If component has nodes, node_or_name should be string
-- It auto pick node by template name or from nodes by clone_tree
-- if they was setup via component:set_nodes, component:set_template
-- @function component:get_node
-- @tparam string|node node_or_name Node name or node itself
-- @treturn node Gui node
function Component.get_node(self, node_or_name)
local template_name = self:get_template() or const.EMPTY_STRING
local nodes = self:get_nodes()

View File

@ -31,13 +31,10 @@ local M = {}
-- @tparam table module lua table with component
function M.register(name, module)
-- TODO: Find better solution to creating elements?
-- Possibly: druid.new(druid.BUTTON, etc?)
-- Current way is very implicit
druid_instance["new_" .. name] = function(self, ...)
return druid_instance.create(self, module, ...)
end
-- print("Register component", name)
end

View File

@ -24,7 +24,7 @@ end
function M.tap_scale_animation(self, node, target_scale)
scale_to(self, node, target_scale,
function()
M.back_scale_animation(self, node, self.scale_from)
M.back_scale_animation(self, node, self.start_scale)
end
)
end

View File

@ -18,14 +18,14 @@ M["button"] = {
IS_HOVER = true,
on_hover = function(self, node, state)
local scale_to = self.scale_from + M.button.HOVER_SCALE
local scale_to = self.start_scale + M.button.HOVER_SCALE
local target_scale = state and scale_to or self.scale_from
local target_scale = state and scale_to or self.start_scale
anims.hover_scale(self, target_scale, M.button.HOVER_TIME)
end,
on_click = function(self, node)
local scale_to = self.scale_from + M.button.SCALE_CHANGE
local scale_to = self.start_scale + M.button.SCALE_CHANGE
anims.tap_scale_animation(self, node, scale_to)
settings.play_sound(M.button.BTN_SOUND)
end,