mirror of
https://github.com/Insality/druid
synced 2025-09-28 18:42:20 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bce68d9c35 | ||
|
40b2837608 | ||
|
f182439f2a | ||
|
a561892fb6 | ||
|
3ba51f3e9d | ||
|
69dd2ce9e3 | ||
|
5f873c2305 | ||
|
80ad0dc3b5 | ||
|
29137614ab | ||
|
844f0dc356 | ||
|
409657c12b | ||
|
e8b1809321 | ||
|
2ef288402e | ||
|
bf81bdfae0 | ||
|
a2f8926cb0 | ||
|
e621edd654 | ||
|
474b97469e | ||
|
d3a56f717e | ||
|
f4f04a17df | ||
|
5035dcbb18 | ||
|
8231e30310 | ||
|
1c1659a1ea | ||
|
2db45b27e2 | ||
|
bcb7ae04b3 | ||
|
6253a4daea |
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2019 Alexey Gulev
|
Copyright (c) 2020 Maxim Tuprikov
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
[](https://github.com/Insality/druid/releases)
|
[](https://github.com/Insality/druid/releases)
|
||||||
|
|
||||||
**Druid** - powerful defold component UI library. Use basic **Druid** components or make your own game-specific components to make amazing GUI in your games.
|
**Druid** - powerful Defold component UI library. Use basic **Druid** components or make your own game-specific components to make amazing GUI in your games.
|
||||||
|
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
@@ -184,18 +184,19 @@ function on_message(self, message_id, message, sender)
|
|||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- *final* required function for correct druid lifecycle
|
||||||
- *on_input* used for almost all basic druid components
|
- *on_input* used for almost all basic druid components
|
||||||
- *update* used for progress bar, scroll and timer base components
|
- *update* used for progress bar, scroll and timer base components
|
||||||
- *on_message* used for specific druid events, like language change or layout change
|
- *on_message* used for specific druid events, like language change or layout change
|
||||||
- *final* used for custom components, what have to do several action before destroy
|
|
||||||
|
|
||||||
Recommended is fully integrate al druid lifecycles functions
|
Recommended is fully integrate all druid lifecycles functions
|
||||||
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Druid input goes as stack. Last created button will checked first. So create your GUI from back
|
- Druid input goes as stack. Last created button will checked first. So create your GUI from back
|
||||||
- Don't forget about `return` in `on_input`: `return self.druid:on_input()`. It need, if you have more than 1 acquire inputs (several druid, other input system, etc)
|
- Don't forget about `return` in `on_input`: `return self.druid:on_input()`. It need, if you have more than 1 acquire inputs (several druid, other input system, etc)
|
||||||
|
- Druid by default do _acquire_input_focus_. So you don't need do it manually. Buy only if you have components, which requires _on_input_
|
||||||
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
@@ -200,7 +200,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -510,7 +510,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -218,7 +218,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -237,7 +237,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -99,11 +99,11 @@
|
|||||||
<td class="summary">Return button enabled state</td>
|
<td class="summary">Return button enabled state</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(zone, Self)</a></td>
|
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(zone)</a></td>
|
||||||
<td class="summary">Strict button click area.</td>
|
<td class="summary">Strict button click area.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#set_key_trigger">set_key_trigger(key, Self)</a></td>
|
<td class="name" nowrap><a href="#set_key_trigger">set_key_trigger(key)</a></td>
|
||||||
<td class="summary">Set key-code to trigger this button</td>
|
<td class="summary">Set key-code to trigger this button</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -185,6 +185,12 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h3>Returns:</h3>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<span class="types"><span class="type">druid.button</span></span>
|
||||||
|
Current button instance
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -212,7 +218,7 @@
|
|||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "set_click_zone"></a>
|
<a name = "set_click_zone"></a>
|
||||||
<strong>set_click_zone(zone, Self)</strong>
|
<strong>set_click_zone(zone)</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Strict button click area. Useful for
|
Strict button click area. Useful for
|
||||||
@@ -225,12 +231,14 @@
|
|||||||
<span class="types"><span class="type">node</span></span>
|
<span class="types"><span class="type">node</span></span>
|
||||||
Gui node
|
Gui node
|
||||||
</li>
|
</li>
|
||||||
<li><span class="parameter">Self</span>
|
|
||||||
<span class="types"><span class="type">druid.button</span></span>
|
|
||||||
instance to make chain calls
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h3>Returns:</h3>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<span class="types"><span class="type">druid.button</span></span>
|
||||||
|
Current button instance
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -238,7 +246,7 @@
|
|||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "set_key_trigger"></a>
|
<a name = "set_key_trigger"></a>
|
||||||
<strong>set_key_trigger(key, Self)</strong>
|
<strong>set_key_trigger(key)</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Set key-code to trigger this button
|
Set key-code to trigger this button
|
||||||
@@ -250,12 +258,14 @@
|
|||||||
<span class="types"><span class="type">hash</span></span>
|
<span class="types"><span class="type">hash</span></span>
|
||||||
The action_id of the key
|
The action_id of the key
|
||||||
</li>
|
</li>
|
||||||
<li><span class="parameter">Self</span>
|
|
||||||
<span class="types"><span class="type">druid.button</span></span>
|
|
||||||
instance to make chain calls
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h3>Returns:</h3>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<span class="types"><span class="type">druid.button</span></span>
|
||||||
|
Current button instance
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -438,7 +448,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -282,7 +282,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -242,7 +242,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -282,7 +282,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -374,7 +374,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -298,7 +298,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -102,6 +102,14 @@
|
|||||||
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(zone)</a></td>
|
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(zone)</a></td>
|
||||||
<td class="summary">Strict hover click area.</td>
|
<td class="summary">Strict hover click area.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#set_enabled">set_enabled(state)</a></td>
|
||||||
|
<td class="summary">Set enable state of hover component.</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="name" nowrap><a href="#is_enabled">is_enabled()</a></td>
|
||||||
|
<td class="summary">Return current hover enabled state</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h2><a href="#Tables">Tables</a></h2>
|
<h2><a href="#Tables">Tables</a></h2>
|
||||||
<table class="function_list">
|
<table class="function_list">
|
||||||
@@ -206,6 +214,49 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "set_enabled"></a>
|
||||||
|
<strong>set_enabled(state)</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Set enable state of hover component.
|
||||||
|
If hover is not enabled, it will not generate
|
||||||
|
any hover events
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Parameters:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><span class="parameter">state</span>
|
||||||
|
<span class="types"><span class="type">bool</span></span>
|
||||||
|
The hover enabled state
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
<dt>
|
||||||
|
<a name = "is_enabled"></a>
|
||||||
|
<strong>is_enabled()</strong>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
Return current hover enabled state
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Returns:</h3>
|
||||||
|
<ol>
|
||||||
|
|
||||||
|
<span class="types"><span class="type">bool</span></span>
|
||||||
|
The hover enabled state
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
|
||||||
@@ -243,7 +294,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -329,7 +329,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -194,7 +194,7 @@
|
|||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><span class="type">druid.input</span></span>
|
<span class="types"><span class="type">druid.input</span></span>
|
||||||
Self instance to make chain calls
|
Current input instance
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><span class="type">druid.input</span></span>
|
<span class="types"><span class="type">druid.input</span></span>
|
||||||
Self instance to make chain calls
|
Current input instance
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -243,7 +243,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -386,7 +386,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -242,7 +242,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -122,7 +122,7 @@
|
|||||||
<td class="summary">Return if scroll have inertion.</td>
|
<td class="summary">Return if scroll have inertion.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name" nowrap><a href="#set_extra_strech_size">set_extra_strech_size([stretch_size=0])</a></td>
|
<td class="name" nowrap><a href="#set_extra_stretch_size">set_extra_stretch_size([stretch_size=0])</a></td>
|
||||||
<td class="summary">Set extra size for scroll stretching.</td>
|
<td class="summary">Set extra size for scroll stretching.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -311,7 +311,7 @@
|
|||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><span class="type">druid.scroll</span></span>
|
<span class="types"><span class="type">druid.scroll</span></span>
|
||||||
Self instance
|
Current scroll instance
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
@@ -340,7 +340,7 @@
|
|||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><span class="type">druid.scroll</span></span>
|
<span class="types"><span class="type">druid.scroll</span></span>
|
||||||
Self instance
|
Current scroll instance
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
@@ -368,8 +368,8 @@
|
|||||||
|
|
||||||
</dd>
|
</dd>
|
||||||
<dt>
|
<dt>
|
||||||
<a name = "set_extra_strech_size"></a>
|
<a name = "set_extra_stretch_size"></a>
|
||||||
<strong>set_extra_strech_size([stretch_size=0])</strong>
|
<strong>set_extra_stretch_size([stretch_size=0])</strong>
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
Set extra size for scroll stretching.
|
Set extra size for scroll stretching.
|
||||||
@@ -389,7 +389,7 @@
|
|||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><span class="type">druid.scroll</span></span>
|
<span class="types"><span class="type">druid.scroll</span></span>
|
||||||
Self instance
|
Current scroll instance
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@
|
|||||||
<ol>
|
<ol>
|
||||||
|
|
||||||
<span class="types"><span class="type">druid.scroll</span></span>
|
<span class="types"><span class="type">druid.scroll</span></span>
|
||||||
Self instance
|
Current scroll instance
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
|
|
||||||
@@ -586,7 +586,7 @@
|
|||||||
Scroll gui.animation speed for scroll_to function
|
Scroll gui.animation speed for scroll_to function
|
||||||
(<em>default</em> 0.2)
|
(<em>default</em> 0.2)
|
||||||
</li>
|
</li>
|
||||||
<li><span class="parameter">EXTRA_STRECH_SIZE</span>
|
<li><span class="parameter">EXTRA_STRETCH_SIZE</span>
|
||||||
<span class="types"><span class="type">number</span></span>
|
<span class="types"><span class="type">number</span></span>
|
||||||
extra size in pixels outside of scroll (stretch effect)
|
extra size in pixels outside of scroll (stretch effect)
|
||||||
(<em>default</em> 0)
|
(<em>default</em> 0)
|
||||||
@@ -610,7 +610,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -281,7 +281,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -256,7 +256,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -407,7 +407,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -296,7 +296,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -242,7 +242,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -913,7 +913,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -129,7 +129,8 @@ Where node name is name of node from GUI scene. You can use <code>node_name</cod
|
|||||||
- **on_double_click** - different callback, if tap button 2+ in row, don'</span>t trigger <span class="keyword">if</span> 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>
|
</pre>
|
||||||
|
|
||||||
<p>- If button have double click event and it is triggered, usual callback will be not invoked
|
<p>- Click event will not trigger, if between pressed and released state cursor was outside of node zone
|
||||||
|
- If button have double click event and it is triggered, usual callback will be not invoked
|
||||||
- If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use <a href="../modules/druid.button.html#set_click_zone">button:set_click_zone</a> to restrict button click zone
|
- If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use <a href="../modules/druid.button.html#set_click_zone">button:set_click_zone</a> to restrict button click zone
|
||||||
- Button can have key trigger to use then by key: <a href="../modules/druid.button.html#set_key_trigger">button:set_key_trigger</a>
|
- Button can have key trigger to use then by key: <a href="../modules/druid.button.html#set_key_trigger">button:set_key_trigger</a>
|
||||||
- Animation node can be used for example to animate small icon on big panel. Node name of trigger zone will be <code>big panel</code> and animation node will be <code>small icon</code></p>
|
- Animation node can be used for example to animate small icon on big panel. Node name of trigger zone will be <code>big panel</code> and animation node will be <code>small icon</code></p>
|
||||||
@@ -239,7 +240,7 @@ Where node name is name of node from GUI scene. You can use <code>node_name</cod
|
|||||||
|
|
||||||
<p>- You can adjust scroll content size by <code>scroll:set_size(node_size)</code>. It will setup new size to <em>content node</em>
|
<p>- You can adjust scroll content size by <code>scroll:set_size(node_size)</code>. It will setup new size to <em>content node</em>
|
||||||
- You can enabled or disable inertion mode via <code>scroll:set_intert(state)</code>
|
- You can enabled or disable inertion mode via <code>scroll:set_intert(state)</code>
|
||||||
- You can adjust extra stretch size via <code>scroll:set_extra_stretch_size</code>
|
- You can adjust extra stretch size via <a href="../modules/druid.scroll.html#set_extra_stretch_size">scroll:set_extra_stretch_size</a>
|
||||||
- Multitouch is required for scroll. Scroll is correctly handling touch_id swap while dragging scroll</p>
|
- Multitouch is required for scroll. Scroll is correctly handling touch_id swap while dragging scroll</p>
|
||||||
|
|
||||||
|
|
||||||
@@ -386,7 +387,8 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
|||||||
|
|
||||||
<h3>Notes</h3>
|
<h3>Notes</h3>
|
||||||
<p>- By default, hover handles <em>hover event</em> with pressed touch action_id. So it's mean, what mouse or touch have to be pressed
|
<p>- By default, hover handles <em>hover event</em> with pressed touch action_id. So it's mean, what mouse or touch have to be pressed
|
||||||
- On desktop platforms there is <em>on</em>mouse<em>hover</em> event. It's event on mouse hover without any action id</p>
|
- On desktop platforms there is <em>on</em>mouse<em>hover</em> event. It's event on mouse hover without any action id
|
||||||
|
- By default, assume what node is on not hovered state (both <em>hover</em> and <em>mouse</em>hover_)</p>
|
||||||
|
|
||||||
|
|
||||||
<p><a name="Swipe"></a></p>
|
<p><a name="Swipe"></a></p>
|
||||||
@@ -463,7 +465,7 @@ Key is value from druid const: const.SIDE.X (or just "x") or const.SIDE.Y (or ju
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -121,8 +121,8 @@
|
|||||||
</span><span class="keyword">function</span> M.on_message(self, message_id, message, sender)
|
</span><span class="keyword">function</span> M.on_message(self, message_id, message, sender)
|
||||||
<span class="keyword">end</span>
|
<span class="keyword">end</span>
|
||||||
|
|
||||||
<span class="comment">-- Call only if component with ON_LANGUAGE_CHANGE interest
|
<span class="comment">-- Call only if component with ON_ANGUAGECHANinterest
|
||||||
</span><span class="keyword">function</span> M.on_language_change(self)
|
</span><span class="keyword">function</span> M.on_anguagechanself)
|
||||||
<span class="keyword">end</span>
|
<span class="keyword">end</span>
|
||||||
|
|
||||||
<span class="comment">-- Call only if component with ON_LAYOUT_CHANGE interest
|
<span class="comment">-- Call only if component with ON_LAYOUT_CHANGE interest
|
||||||
@@ -245,7 +245,7 @@ There is next interests in druid:
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -155,7 +155,7 @@ You can pass <em>nil</em> or <em>empty</em>table_ to use default values for all
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -92,7 +92,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -90,7 +90,7 @@
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -90,7 +90,7 @@
|
|||||||
|
|
||||||
<p><a href="https://github.com/Insality/druid/releases"><img src="https://img.shields.io/github/v/release/insality/druid" alt="GitHub release (latest by date)"/></a></p>
|
<p><a href="https://github.com/Insality/druid/releases"><img src="https://img.shields.io/github/v/release/insality/druid" alt="GitHub release (latest by date)"/></a></p>
|
||||||
|
|
||||||
<p><strong>Druid</strong> - powerful defold component UI library. Use basic <strong>Druid</strong> components or make your own game-specific components to make amazing GUI in your games.</p>
|
<p><strong>Druid</strong> - powerful Defold component UI library. Use basic <strong>Druid</strong> components or make your own game-specific components to make amazing GUI in your games.</p>
|
||||||
|
|
||||||
|
|
||||||
<p><a name="Setup"></a></p>
|
<p><a name="Setup"></a></p>
|
||||||
@@ -271,13 +271,13 @@
|
|||||||
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><em>final</em> required function for correct druid lifecycle</li>
|
||||||
<li>*on_input* used for almost all basic druid components</li>
|
<li>*on_input* used for almost all basic druid components</li>
|
||||||
<li><em>update</em> used for progress bar, scroll and timer base components</li>
|
<li><em>update</em> used for progress bar, scroll and timer base components</li>
|
||||||
<li>*on_message* used for specific druid events, like language change or layout change</li>
|
<li>*on_message* used for specific druid events, like language change or layout change</li>
|
||||||
<li><em>final</em> used for custom components, what have to do several action before destroy</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>Recommended is fully integrate al druid lifecycles functions</p>
|
<p>Recommended is fully integrate all druid lifecycles functions</p>
|
||||||
|
|
||||||
|
|
||||||
<p><a name="Features"></a></p>
|
<p><a name="Features"></a></p>
|
||||||
@@ -286,6 +286,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<li>Druid input goes as stack. Last created button will checked first. So create your GUI from back</li>
|
<li>Druid input goes as stack. Last created button will checked first. So create your GUI from back</li>
|
||||||
<li>Don't forget about <code>return</code> in <code>on_input</code>: <code>return self.druid:on_input()</code>. It need, if you have more than 1 acquire inputs (several druid, other input system, etc)</li>
|
<li>Don't forget about <code>return</code> in <code>on_input</code>: <code>return self.druid:on_input()</code>. It need, if you have more than 1 acquire inputs (several druid, other input system, etc)</li>
|
||||||
|
<li>Druid by default do <em>acquire</em>input<em>focus</em>. So you don't need do it manually. Buy only if you have components, which requires <em>on</em>input_ </li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
@@ -339,7 +340,7 @@ https://insality.github.io/druid/</p>
|
|||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -72,8 +72,7 @@
|
|||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
|
||||||
|
Druid 0.3.0:</p>
|
||||||
<p>Druid 0.3.0:</p>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><p><code>Druid:final()</code> now is important function for correct working</p></li>
|
<li><p><code>Druid:final()</code> now is important function for correct working</p></li>
|
||||||
@@ -133,11 +132,11 @@
|
|||||||
- on_drag_start (self)
|
- on_drag_start (self)
|
||||||
- on_drag (self, dx, dy)
|
- on_drag (self, dx, dy)
|
||||||
- on_drag_end (self)
|
- on_drag_end (self)
|
||||||
- You can restriction side of draggin by changing _drag.can_x_ <span class="keyword">and</span> _drag.can_y_ fields
|
- You can restriction side of dragging by changing _drag.can_x_ <span class="keyword">and</span> _drag.can_y_ fields
|
||||||
- You can setup drag deadzone to detect, when dragging is started (by default <span class="number">10</span> pixels)
|
- You can setup drag deadzone to detect, when dragging is started (_by default <span class="number">10</span> pixels_)
|
||||||
</pre>
|
</pre>
|
||||||
</li>
|
</li>
|
||||||
<li><p>Druid <em>Scroll</em> component fully reworked. Input logic moved to <em>Drag</em> component</p>
|
<li><p>[Breaking changes] Druid <em>Scroll</em> component fully reworked. Input logic moved to <em>Drag</em> component</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
- Update scroll documentation
|
- Update scroll documentation
|
||||||
@@ -151,7 +150,7 @@
|
|||||||
- Different anchoring is supported (<span class="keyword">for</span> easier layouting)
|
- Different anchoring is supported (<span class="keyword">for</span> easier layouting)
|
||||||
- Function _scroll_to_ now accept position relative to _content node_. It's more easier <span class="keyword">for</span> handling. _Example:_ <span class="keyword">if</span> you have children node of _content_node_, you can pass this node position to scroll to this.
|
- Function _scroll_to_ now accept position relative to _content node_. It's more easier <span class="keyword">for</span> handling. _Example:_ <span class="keyword">if</span> you have children node of _content_node_, you can pass this node position to scroll to this.
|
||||||
- **Resolve #<span class="number">52</span>**: _Content node size_ now can be less than _view node size_. In this case, content will be scrolled only inside _view size_ (can be disabled via style field: _SMALL_CONTENT_SCROLL_)
|
- **Resolve #<span class="number">52</span>**: _Content node size_ now can be less than _view node size_. In this case, content will be scrolled only inside _view size_ (can be disabled via style field: _SMALL_CONTENT_SCROLL_)
|
||||||
- **Fix #<span class="number">50</span>**: If style:SOFT_ZONE_SIZE equals to [<span class="number">0.</span>.<span class="number">1</span>], scroll can be disappeared
|
- **Fix #<span class="number">50</span>**: If style.SOFT_ZONE_SIZE equals to [<span class="number">0.</span>.<span class="number">1</span>], scroll can be disappeared
|
||||||
</pre>
|
</pre>
|
||||||
</li>
|
</li>
|
||||||
<li><p>Druid <em>Grid</em> Update</p>
|
<li><p>Druid <em>Grid</em> Update</p>
|
||||||
@@ -172,9 +171,9 @@
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
- Styles <span class="global">table</span> now can be empty, every component have their default style values
|
- Styles <span class="global">table</span> now can be empty, every component have their default style values
|
||||||
- Remove <span class="backtick"><code>component:get_style</code></span> <span class="keyword">function</span>. Now style can be only set
|
- Remove <span class="backtick"><code>component:get_style</code></span> <span class="keyword">function</span>. Now you can only set styles
|
||||||
- To get style values <span class="keyword">in</span> component, add <span class="backtick"><code>component:on_style_change</code></span> <span class="keyword">function</span>. It's invoked on <span class="backtick"><a href="../modules/component.html#set_style">component:set_style</a></span> <span class="keyword">function</span>
|
- To get style values <span class="keyword">in</span> component, add <span class="backtick"><code>component:on_style_change</code></span> <span class="keyword">function</span>. It's invoked on <span class="backtick"><a href="../modules/component.html#set_style">component:set_style</a></span> <span class="keyword">function</span>
|
||||||
- You can look up default values inside <span class="backtick"><code>component:on_style_change</code></span> <span class="keyword">function</span> <span class="keyword">or</span> style component API on Druid API
|
- You can look up default values inside <span class="backtick"><code>component:on_style_change</code></span> <span class="keyword">function</span> <span class="keyword">or</span> style component API on [Druid API](https://insality.github.<span class="global">io</span>/druid/index.html)
|
||||||
</pre>
|
</pre>
|
||||||
</li>
|
</li>
|
||||||
<li><p>Druid update:</p>
|
<li><p>Druid update:</p>
|
||||||
@@ -183,17 +182,24 @@
|
|||||||
- Now <span class="keyword">function</span> <span class="backtick"><code>druid:remove</code></span> remove instance <span class="keyword">and</span> all instance children components. No more manual deleting child components (#<span class="number">41</span>)
|
- Now <span class="keyword">function</span> <span class="backtick"><code>druid:remove</code></span> remove instance <span class="keyword">and</span> all instance children components. No more manual deleting child components (#<span class="number">41</span>)
|
||||||
</pre>
|
</pre>
|
||||||
</li>
|
</li>
|
||||||
<li><p><strong>Fix:</strong> Blocker component bug (blocker had very high priority, so it's block even button components, created after bloker)</p></li>
|
<li><p><strong>Fix:</strong> Blocker component bug (blocker had very high priority, so it's block even button components, created after blocker)</p></li>
|
||||||
<li><p><strong>Fix #58:</strong> Bug, when druid instance should be always named <a href="../modules/druid.html#">druid</a> (ex: <code>self.druid = druid.new(self)</code>)</p></li>
|
<li><p><strong>Fix #58:</strong> Bug, when druid instance should be always named <a href="../modules/druid.html#">druid</a> (ex: <code>self.druid = druid.new(self)</code>)</p></li>
|
||||||
<li><p><strong>Fix #53:</strong> Bug with final <em>Druid instance</em> without any components</p></li>
|
<li><p><strong>Fix #53:</strong> Bug with final <em>Druid instance</em> without any components</p></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
|
<p>Druid 0.5.0:
|
||||||
|
- <strong>Fix #61:</strong> Button component: fix button animation node creation
|
||||||
|
- <strong>Fix #64:</strong> Hover component: wrong mouse_hover default state
|
||||||
|
- <strong>Fix #71:</strong> Blocker: blocker now correct block mouse hover event
|
||||||
|
- <strong>Fix #72:</strong> Fix <code>return nil</code> in some <code>on_input</code> functions
|
||||||
|
- <strong>Fix #74:</strong> Fix typo: strech -> stretch. Scroll function <code>set_extra_stretch_size</code> renamed
|
||||||
|
|
||||||
</div> <!-- id="content" -->
|
</div> <!-- id="content" -->
|
||||||
</div> <!-- id="main" -->
|
</div> <!-- id="main" -->
|
||||||
<div id="about">
|
<div id="about">
|
||||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||||
<i style="float:right;">Last updated 2020-05-09 16:07:15 </i>
|
<i style="float:right;">Last updated 2020-06-14 20:13:02 </i>
|
||||||
</div> <!-- id="about" -->
|
</div> <!-- id="about" -->
|
||||||
</div> <!-- id="container" -->
|
</div> <!-- id="container" -->
|
||||||
</body>
|
</body>
|
||||||
|
@@ -25,6 +25,7 @@ Where node name is name of node from GUI scene. You can use `node_name` as input
|
|||||||
- **on_long_click** - callback on long button tap, don't trigger if callback is empty
|
- **on_long_click** - callback on long button tap, don't trigger if callback is empty
|
||||||
- **on_hold_click** - hold callback, before long_click trigger, don't trigger if callback is empty
|
- **on_hold_click** - hold callback, before long_click trigger, don't trigger if callback is empty
|
||||||
- **on_double_click** - different callback, if tap button 2+ in row, don't trigger if callback is empty
|
- **on_double_click** - different callback, if tap button 2+ in row, don't trigger if callback is empty
|
||||||
|
- Click event will not trigger, if between pressed and released state cursor was outside of node zone
|
||||||
- If button have double click event and it is triggered, usual callback will be not invoked
|
- If button have double click event and it is triggered, usual callback will be not invoked
|
||||||
- If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use `button:set_click_zone` to restrict button click zone
|
- If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use `button:set_click_zone` to restrict button click zone
|
||||||
- Button can have key trigger to use then by key: `button:set_key_trigger`
|
- Button can have key trigger to use then by key: `button:set_key_trigger`
|
||||||
@@ -263,6 +264,7 @@ Create hover component with druid: `hover = druid:new_hover(node, callback)`
|
|||||||
### Notes
|
### Notes
|
||||||
- By default, hover handles _hover event_ with pressed touch action_id. So it's mean, what mouse or touch have to be pressed
|
- By default, hover handles _hover event_ with pressed touch action_id. So it's mean, what mouse or touch have to be pressed
|
||||||
- On desktop platforms there is _on_mouse_hover_ event. It's event on mouse hover without any action id
|
- On desktop platforms there is _on_mouse_hover_ event. It's event on mouse hover without any action id
|
||||||
|
- By default, assume what node is on not hovered state (both _hover_ and _mouse_hover_)
|
||||||
|
|
||||||
|
|
||||||
## Swipe
|
## Swipe
|
||||||
|
@@ -36,8 +36,8 @@ end
|
|||||||
function M.on_message(self, message_id, message, sender)
|
function M.on_message(self, message_id, message, sender)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Call only if component with ON_LANGUAGE_CHANGE interest
|
-- Call only if component with ON_ANGUAGECHANinterest
|
||||||
function M.on_language_change(self)
|
function M.on_anguagechanself)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Call only if component with ON_LAYOUT_CHANGE interest
|
-- Call only if component with ON_LAYOUT_CHANGE interest
|
||||||
|
@@ -54,10 +54,10 @@ Druid 0.4.0:
|
|||||||
- on_drag_start (self)
|
- on_drag_start (self)
|
||||||
- on_drag (self, dx, dy)
|
- on_drag (self, dx, dy)
|
||||||
- on_drag_end (self)
|
- on_drag_end (self)
|
||||||
- You can restriction side of draggin by changing _drag.can_x_ and _drag.can_y_ fields
|
- You can restriction side of dragging by changing _drag.can_x_ and _drag.can_y_ fields
|
||||||
- You can setup drag deadzone to detect, when dragging is started (by default 10 pixels)
|
- You can setup drag deadzone to detect, when dragging is started (_by default 10 pixels_)
|
||||||
|
|
||||||
- Druid _Scroll_ component fully reworked. Input logic moved to _Drag_ component
|
- [Breaking changes] Druid _Scroll_ component fully reworked. Input logic moved to _Drag_ component
|
||||||
- Update scroll documentation
|
- Update scroll documentation
|
||||||
- Change constructor order params
|
- Change constructor order params
|
||||||
- Change _scroll:set_border_ to _scroll:set_size_
|
- Change _scroll:set_border_ to _scroll:set_size_
|
||||||
@@ -69,7 +69,7 @@ Druid 0.4.0:
|
|||||||
- Different anchoring is supported (for easier layouting)
|
- Different anchoring is supported (for easier layouting)
|
||||||
- Function _scroll_to_ now accept position relative to _content node_. It's more easier for handling. _Example:_ if you have children node of _content_node_, you can pass this node position to scroll to this.
|
- Function _scroll_to_ now accept position relative to _content node_. It's more easier for handling. _Example:_ if you have children node of _content_node_, you can pass this node position to scroll to this.
|
||||||
- **Resolve #52**: _Content node size_ now can be less than _view node size_. In this case, content will be scrolled only inside _view size_ (can be disabled via style field: _SMALL_CONTENT_SCROLL_)
|
- **Resolve #52**: _Content node size_ now can be less than _view node size_. In this case, content will be scrolled only inside _view size_ (can be disabled via style field: _SMALL_CONTENT_SCROLL_)
|
||||||
- **Fix #50**: If style:SOFT_ZONE_SIZE equals to [0..1], scroll can be disappeared
|
- **Fix #50**: If style.SOFT_ZONE_SIZE equals to [0..1], scroll can be disappeared
|
||||||
|
|
||||||
- Druid _Grid_ Update
|
- Druid _Grid_ Update
|
||||||
- Anchor by default equals to node pivot (so, more component settings in _.gui_ settings) (#51)
|
- Anchor by default equals to node pivot (so, more component settings in _.gui_ settings) (#51)
|
||||||
@@ -81,13 +81,26 @@ Druid 0.4.0:
|
|||||||
|
|
||||||
- Styles update:
|
- Styles update:
|
||||||
- Styles table now can be empty, every component have their default style values
|
- Styles table now can be empty, every component have their default style values
|
||||||
- Remove `component:get_style` function. Now style can be only set
|
- Remove `component:get_style` function. Now you can only set styles
|
||||||
- To get style values in component, add `component:on_style_change` function. It's invoked on `component:set_style` function
|
- To get style values in component, add `component:on_style_change` function. It's invoked on `component:set_style` function
|
||||||
- You can look up default values inside `component:on_style_change` function or style component API on Druid API
|
- You can look up default values inside `component:on_style_change` function or style component API on [Druid API](https://insality.github.io/druid/index.html)
|
||||||
|
|
||||||
- Druid update:
|
- Druid update:
|
||||||
- Now function `druid:remove` remove instance and all instance children components. No more manual deleting child components (#41)
|
- Now function `druid:remove` remove instance and all instance children components. No more manual deleting child components (#41)
|
||||||
|
|
||||||
- **Fix:** Blocker component bug (blocker had very high priority, so it's block even button components, created after bloker)
|
- **Fix:** Blocker component bug (blocker had very high priority, so it's block even button components, created after blocker)
|
||||||
- **Fix #58:** Bug, when druid instance should be always named `druid` (ex: `self.druid = druid.new(self)`)
|
- **Fix #58:** Bug, when druid instance should be always named `druid` (ex: `self.druid = druid.new(self)`)
|
||||||
- **Fix #53:** Bug with final _Druid instance_ without any components
|
- **Fix #53:** Bug with final _Druid instance_ without any components
|
||||||
|
|
||||||
|
|
||||||
|
Druid 0.5.0:
|
||||||
|
- **Fix #61:** Button component: fix button animation node creation
|
||||||
|
- **Fix #64:** Hover component: wrong mouse_hover default state
|
||||||
|
- **Fix #71:** Blocker: blocker now correct block mouse hover event
|
||||||
|
- **Fix #72:** Fix `return nil` in some `on_input` functions
|
||||||
|
- **Fix #74:** Fix typo: strech -> stretch. Scroll function `set_extra_stretch_size` renamed
|
||||||
|
- **Fix #76:** Add params for lang text localization component
|
||||||
|
- **Fix #79:** Fix druid:remove inside on_input callback
|
||||||
|
- **Fix #80:** Fix hover set_enable typo function call
|
||||||
|
- Add `component.tempalte.lua` as template for Druid custom component
|
||||||
|
|
||||||
|
@@ -29,7 +29,9 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function M.on_input(self, action_id, action)
|
function M.on_input(self, action_id, action)
|
||||||
if action_id ~= const.ACTION_TOUCH and action_id ~= const.ACTION_MULTITOUCH then
|
if action_id ~= const.ACTION_TOUCH and
|
||||||
|
action_id ~= const.ACTION_MULTITOUCH and
|
||||||
|
action_id ~= nil then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -165,7 +165,7 @@ function M.init(self, node, callback, params, anim_node)
|
|||||||
self.druid = self:get_druid()
|
self.druid = self:get_druid()
|
||||||
self.node = self:get_node(node)
|
self.node = self:get_node(node)
|
||||||
|
|
||||||
self.anim_node = anim_node and helper:get_node(anim_node) or self.node
|
self.anim_node = anim_node and self:get_node(anim_node) or self.node
|
||||||
self.start_scale = gui.get_scale(self.anim_node)
|
self.start_scale = gui.get_scale(self.anim_node)
|
||||||
self.start_pos = gui.get_position(self.anim_node)
|
self.start_pos = gui.get_position(self.anim_node)
|
||||||
self.params = params
|
self.params = params
|
||||||
@@ -265,9 +265,13 @@ end
|
|||||||
--- Set enabled button component state
|
--- Set enabled button component state
|
||||||
-- @function button:set_enabled
|
-- @function button:set_enabled
|
||||||
-- @tparam bool state Enabled state
|
-- @tparam bool state Enabled state
|
||||||
|
-- @treturn druid.button Current button instance
|
||||||
function M.set_enabled(self, state)
|
function M.set_enabled(self, state)
|
||||||
self.disabled = not state
|
self.disabled = not state
|
||||||
|
self.hover:set_enabled(state)
|
||||||
self.style.on_set_enabled(self, self.node, state)
|
self.style.on_set_enabled(self, self.node, state)
|
||||||
|
|
||||||
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -283,10 +287,11 @@ end
|
|||||||
-- no click events outside stencil node
|
-- no click events outside stencil node
|
||||||
-- @function button:set_click_zone
|
-- @function button:set_click_zone
|
||||||
-- @tparam node zone Gui node
|
-- @tparam node zone Gui node
|
||||||
-- @tparam druid.button Self instance to make chain calls
|
-- @treturn druid.button Current button instance
|
||||||
function M.set_click_zone(self, zone)
|
function M.set_click_zone(self, zone)
|
||||||
self.click_zone = self:get_node(zone)
|
self.click_zone = self:get_node(zone)
|
||||||
self.hover:set_click_zone(zone)
|
self.hover:set_click_zone(zone)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -294,9 +299,10 @@ end
|
|||||||
--- Set key-code to trigger this button
|
--- Set key-code to trigger this button
|
||||||
-- @function button:set_key_trigger
|
-- @function button:set_key_trigger
|
||||||
-- @tparam hash key The action_id of the key
|
-- @tparam hash key The action_id of the key
|
||||||
-- @tparam druid.button Self instance to make chain calls
|
-- @treturn druid.button Current button instance
|
||||||
function M.set_key_trigger(self, key)
|
function M.set_key_trigger(self, key)
|
||||||
self.key_trigger = hash(key)
|
self.key_trigger = hash(key)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
64
druid/base/component.template.lua
Normal file
64
druid/base/component.template.lua
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
local const = require("druid.const")
|
||||||
|
local component = require("druid.component")
|
||||||
|
|
||||||
|
local M = component.create("my_component_name", { const.ON_UPDATE })
|
||||||
|
|
||||||
|
|
||||||
|
-- Component constructor
|
||||||
|
function M.init(self, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call only if exist interest: const.ON_UPDATE
|
||||||
|
function M.update(self, dt)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call only if exist interest: const.ON_INPUT or const.ON_INPUT_HIGH
|
||||||
|
function M.on_input(self, action_id, action)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call on component creation and on component:set_style() function
|
||||||
|
function M.on_style_change(self, style)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call only if exist interest: const.ON_MESSAGE
|
||||||
|
function M.on_message(self, message_id, message, sender)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call only if component with ON_LANGUAGE_CHANGE interest
|
||||||
|
function M.on_language_change(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call only if component with ON_LAYOUT_CHANGE interest
|
||||||
|
function M.on_layout_change(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call, if input was capturing before this component
|
||||||
|
-- Example: scroll is start scrolling, so you need unhover button
|
||||||
|
function M.on_input_interrupt(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call, if game lost focus. Need ON_FOCUS_LOST intereset
|
||||||
|
function M.on_focus_lost(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset
|
||||||
|
function M.on_focus_gained(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Call on component remove or on druid:final
|
||||||
|
function M.on_remove(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return M
|
@@ -172,7 +172,7 @@ end
|
|||||||
|
|
||||||
function M.on_input(self, action_id, action)
|
function M.on_input(self, action_id, action)
|
||||||
if action_id ~= const.ACTION_TOUCH and action_id ~= const.ACTION_MULTITOUCH then
|
if action_id ~= const.ACTION_TOUCH and action_id ~= const.ACTION_MULTITOUCH then
|
||||||
return
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if not helper.is_enabled(self.node) then
|
if not helper.is_enabled(self.node) then
|
||||||
|
@@ -22,6 +22,9 @@ function M.init(self, node, on_hover_callback)
|
|||||||
self.node = self:get_node(node)
|
self.node = self:get_node(node)
|
||||||
|
|
||||||
self._is_hovered = false
|
self._is_hovered = false
|
||||||
|
self._is_mouse_hovered = false
|
||||||
|
|
||||||
|
self._is_enabled = true
|
||||||
|
|
||||||
self.on_hover = Event(on_hover_callback)
|
self.on_hover = Event(on_hover_callback)
|
||||||
self.on_mouse_hover = Event()
|
self.on_mouse_hover = Event()
|
||||||
@@ -30,14 +33,14 @@ end
|
|||||||
|
|
||||||
function M.on_input(self, action_id, action)
|
function M.on_input(self, action_id, action)
|
||||||
if action_id ~= const.ACTION_TOUCH and action_id ~= nil then
|
if action_id ~= const.ACTION_TOUCH and action_id ~= nil then
|
||||||
return
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if not action_id and helper.is_mobile() then
|
if not action_id and helper.is_mobile() then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if not helper.is_enabled(self.node) then
|
if not helper.is_enabled(self.node) or not self._is_enabled then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -62,7 +65,7 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function M.on_input_interrupt(self)
|
function M.on_input_interrupt(self)
|
||||||
M.set_hover(self, false)
|
self:set_hover(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -96,4 +99,31 @@ function M.set_click_zone(self, zone)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Set enable state of hover component.
|
||||||
|
-- If hover is not enabled, it will not generate
|
||||||
|
-- any hover events
|
||||||
|
-- @function hover:set_enabled
|
||||||
|
-- @tparam bool state The hover enabled state
|
||||||
|
function M.set_enabled(self, state)
|
||||||
|
self._is_enabled = state
|
||||||
|
|
||||||
|
if not state then
|
||||||
|
if self._is_hovered then
|
||||||
|
self:set_hover(false)
|
||||||
|
end
|
||||||
|
if self._is_mouse_hovered then
|
||||||
|
self:set_mouse_hover(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Return current hover enabled state
|
||||||
|
-- @function hover:is_enabled
|
||||||
|
-- @treturn bool The hover enabled state
|
||||||
|
function M.is_enabled(self)
|
||||||
|
return self._is_enabled
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@@ -282,7 +282,7 @@ end
|
|||||||
-- Pass nil to make input field unliminted (by default)
|
-- Pass nil to make input field unliminted (by default)
|
||||||
-- @function input:set_max_length
|
-- @function input:set_max_length
|
||||||
-- @tparam number max_length Maximum length for input text field
|
-- @tparam number max_length Maximum length for input text field
|
||||||
-- @treturn druid.input Self instance to make chain calls
|
-- @treturn druid.input Current input instance
|
||||||
function M.set_max_length(self, max_length)
|
function M.set_max_length(self, max_length)
|
||||||
self.max_length = max_length
|
self.max_length = max_length
|
||||||
return self
|
return self
|
||||||
@@ -294,7 +294,7 @@ end
|
|||||||
-- ex: [%a%d] for alpha and numeric
|
-- ex: [%a%d] for alpha and numeric
|
||||||
-- @function input:set_allowerd_characters
|
-- @function input:set_allowerd_characters
|
||||||
-- @tparam string characters Regulax exp. for validate user input
|
-- @tparam string characters Regulax exp. for validate user input
|
||||||
-- @treturn druid.input Self instance to make chain calls
|
-- @treturn druid.input Current input instance
|
||||||
function M.set_allowed_characters(self, characters)
|
function M.set_allowed_characters(self, characters)
|
||||||
self.allowed_characters = characters
|
self.allowed_characters = characters
|
||||||
return self
|
return self
|
||||||
|
@@ -26,6 +26,7 @@ local M = component.create("lang_text", { const.ON_LANGUAGE_CHANGE })
|
|||||||
function M.init(self, node, locale_id, no_adjust)
|
function M.init(self, node, locale_id, no_adjust)
|
||||||
self.druid = self:get_druid()
|
self.druid = self:get_druid()
|
||||||
self.text = self.druid:new_text(node, locale_id, no_adjust)
|
self.text = self.druid:new_text(node, locale_id, no_adjust)
|
||||||
|
self.last_locale_args = {}
|
||||||
|
|
||||||
self.on_change = Event()
|
self.on_change = Event()
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ end
|
|||||||
|
|
||||||
function M.on_language_change(self)
|
function M.on_language_change(self)
|
||||||
if self.last_locale then
|
if self.last_locale then
|
||||||
M.translate(self)
|
M.translate(self, self.last_locale, unpack(self.last_locale_args))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,9 +56,10 @@ end
|
|||||||
--- Translate the text by locale_id
|
--- Translate the text by locale_id
|
||||||
-- @function lang_text:translate
|
-- @function lang_text:translate
|
||||||
-- @tparam string locale_id Locale id
|
-- @tparam string locale_id Locale id
|
||||||
function M.translate(self, locale_id)
|
function M.translate(self, locale_id, ...)
|
||||||
|
self.last_locale_args = {...}
|
||||||
self.last_locale = locale_id or self.last_locale
|
self.last_locale = locale_id or self.last_locale
|
||||||
self.text:set_to(settings.get_text(self.last_locale))
|
self.text:set_to(settings.get_text(self.last_locale, ...))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@@ -290,7 +290,7 @@ local function update_size(self)
|
|||||||
-- We add extra size only if scroll is available
|
-- We add extra size only if scroll is available
|
||||||
-- Even the content zone size less than view zone size
|
-- Even the content zone size less than view zone size
|
||||||
local content_border_extra = helper.get_border(self.content_node)
|
local content_border_extra = helper.get_border(self.content_node)
|
||||||
local stretch_size = self.style.EXTRA_STRECH_SIZE
|
local stretch_size = self.style.EXTRA_STRETCH_SIZE
|
||||||
|
|
||||||
if self.drag.can_x then
|
if self.drag.can_x then
|
||||||
local sign = content_size.x > view_size.x and 1 or -1
|
local sign = content_size.x > view_size.x and 1 or -1
|
||||||
@@ -325,11 +325,11 @@ end
|
|||||||
-- @tfield[opt=20] number POINTS_DEADZONE Speed to check points of interests in no_inertion mode
|
-- @tfield[opt=20] number POINTS_DEADZONE Speed to check points of interests in no_inertion mode
|
||||||
-- @tfield[opt=0.35] number BACK_SPEED Scroll back returning lerp speed
|
-- @tfield[opt=0.35] number BACK_SPEED Scroll back returning lerp speed
|
||||||
-- @tfield[opt=0.2] number ANIM_SPEED Scroll gui.animation speed for scroll_to function
|
-- @tfield[opt=0.2] number ANIM_SPEED Scroll gui.animation speed for scroll_to function
|
||||||
-- @tfield[opt=0] number EXTRA_STRECH_SIZE extra size in pixels outside of scroll (stretch effect)
|
-- @tfield[opt=0] number EXTRA_STRETCH_SIZE extra size in pixels outside of scroll (stretch effect)
|
||||||
-- @tfield[opt=false] bool SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled
|
-- @tfield[opt=false] bool SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled
|
||||||
function M.on_style_change(self, style)
|
function M.on_style_change(self, style)
|
||||||
self.style = {}
|
self.style = {}
|
||||||
self.style.EXTRA_STRECH_SIZE = style.EXTRA_STRECH_SIZE or 0
|
self.style.EXTRA_STRETCH_SIZE = style.EXTRA_STRETCH_SIZE or 0
|
||||||
self.style.ANIM_SPEED = style.ANIM_SPEED or 0.2
|
self.style.ANIM_SPEED = style.ANIM_SPEED or 0.2
|
||||||
self.style.BACK_SPEED = style.BACK_SPEED or 0.35
|
self.style.BACK_SPEED = style.BACK_SPEED or 0.35
|
||||||
|
|
||||||
@@ -473,7 +473,7 @@ end
|
|||||||
-- It will change content gui node size
|
-- It will change content gui node size
|
||||||
-- @function scroll:set_size
|
-- @function scroll:set_size
|
||||||
-- @tparam vector3 size The new size for content node
|
-- @tparam vector3 size The new size for content node
|
||||||
-- @treturn druid.scroll Self instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function M.set_size(self, size)
|
function M.set_size(self, size)
|
||||||
gui.set_size(self.content_node, size)
|
gui.set_size(self.content_node, size)
|
||||||
update_size(self)
|
update_size(self)
|
||||||
@@ -487,9 +487,10 @@ end
|
|||||||
-- If no points, just simple drag without inertion
|
-- If no points, just simple drag without inertion
|
||||||
-- @function scroll:set_inert
|
-- @function scroll:set_inert
|
||||||
-- @tparam bool state Inert scroll state
|
-- @tparam bool state Inert scroll state
|
||||||
-- @treturn druid.scroll Self instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function M.set_inert(self, state)
|
function M.set_inert(self, state)
|
||||||
self._is_inert = state
|
self._is_inert = state
|
||||||
|
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -504,11 +505,11 @@ 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
|
||||||
-- @function scroll:set_extra_strech_size
|
-- @function scroll:set_extra_stretch_size
|
||||||
-- @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 Self instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function M.set_extra_strech_size(self, stretch_size)
|
function M.set_extra_stretch_size(self, stretch_size)
|
||||||
self.style.EXTRA_STRECH_SIZE = stretch_size or 0
|
self.style.EXTRA_STRETCH_SIZE = stretch_size or 0
|
||||||
update_size(self)
|
update_size(self)
|
||||||
|
|
||||||
return self
|
return self
|
||||||
@@ -527,7 +528,7 @@ end
|
|||||||
-- Scroll will always centered on closer points
|
-- Scroll will always centered on closer points
|
||||||
-- @function scroll:set_points
|
-- @function scroll:set_points
|
||||||
-- @tparam table points Array of vector3 points
|
-- @tparam table points Array of vector3 points
|
||||||
-- @treturn druid.scroll Self instance
|
-- @treturn druid.scroll Current scroll instance
|
||||||
function M.set_points(self, points)
|
function M.set_points(self, points)
|
||||||
self.points = points
|
self.points = points
|
||||||
|
|
||||||
|
@@ -95,7 +95,7 @@ end
|
|||||||
|
|
||||||
function M.on_input(self, action_id, action)
|
function M.on_input(self, action_id, action)
|
||||||
if action_id ~= const.ACTION_TOUCH then
|
if action_id ~= const.ACTION_TOUCH then
|
||||||
return
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if not helper.is_enabled(self.node) then
|
if not helper.is_enabled(self.node) then
|
||||||
|
@@ -109,13 +109,15 @@ function Component.get_node(self, node_or_name)
|
|||||||
template_name = template_name .. "/"
|
template_name = template_name .. "/"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local node_type = type(node_or_name)
|
||||||
if nodes then
|
if nodes then
|
||||||
assert(type(node_or_name) == "strings", "You should pass node name instead of node")
|
assert(node_type == const.STRING, "You should pass node name instead of node")
|
||||||
return nodes[template_name .. node_or_name]
|
return nodes[template_name .. node_or_name]
|
||||||
else
|
else
|
||||||
if type(node_or_name) == const.STRING then
|
if node_type == const.STRING then
|
||||||
return gui.get_node(template_name .. node_or_name)
|
return gui.get_node(template_name .. node_or_name)
|
||||||
else
|
else
|
||||||
|
-- Assume it's already node from gui.get_node
|
||||||
return node_or_name
|
return node_or_name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -63,7 +63,7 @@ M["scroll"] = {
|
|||||||
FRICT_HOLD = 0.79, -- mult. for inert, while touching
|
FRICT_HOLD = 0.79, -- mult. for inert, while touching
|
||||||
INERT_THRESHOLD = 2.5, -- speed to stop inertion
|
INERT_THRESHOLD = 2.5, -- speed to stop inertion
|
||||||
INERT_SPEED = 30, -- koef. of inert speed
|
INERT_SPEED = 30, -- koef. of inert speed
|
||||||
EXTRA_STRECH_SIZE = 100, -- extra size in pixels outside of scroll (stretch effect)
|
EXTRA_STRETCH_SIZE = 100, -- extra size in pixels outside of scroll (stretch effect)
|
||||||
POINTS_DEADZONE = 20, -- Speed to check points of interests in no_inertion mode
|
POINTS_DEADZONE = 20, -- Speed to check points of interests in no_inertion mode
|
||||||
|
|
||||||
SCROLL_WHEEL_SPEED = 20,
|
SCROLL_WHEEL_SPEED = 20,
|
||||||
|
@@ -58,6 +58,18 @@ local function input_init(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function input_release(self)
|
||||||
|
if sys.get_config("druid.no_auto_input") == "1" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.input_inited then
|
||||||
|
self.input_inited = false
|
||||||
|
druid_input.remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Create the component itself
|
-- Create the component itself
|
||||||
local function create(self, instance_class)
|
local function create(self, instance_class)
|
||||||
local instance = instance_class()
|
local instance = instance_class()
|
||||||
@@ -123,6 +135,8 @@ function Druid.initialize(self, context, style)
|
|||||||
self._context = context
|
self._context = context
|
||||||
self._style = style or settings.default_style
|
self._style = style or settings.default_style
|
||||||
self._deleted = false
|
self._deleted = false
|
||||||
|
self._is_input_processing = false
|
||||||
|
self._late_remove = {}
|
||||||
self.url = msg.url()
|
self.url = msg.url()
|
||||||
|
|
||||||
self.components = {}
|
self.components = {}
|
||||||
@@ -160,6 +174,8 @@ function Druid.final(self)
|
|||||||
end
|
end
|
||||||
|
|
||||||
self._deleted = true
|
self._deleted = true
|
||||||
|
|
||||||
|
input_release(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -168,10 +184,15 @@ end
|
|||||||
-- @function druid:remove
|
-- @function druid:remove
|
||||||
-- @tparam Component component Component instance
|
-- @tparam Component component Component instance
|
||||||
function Druid.remove(self, component)
|
function Druid.remove(self, component)
|
||||||
|
if self._is_input_processing then
|
||||||
|
table.insert(self._late_remove, component)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
local all_components = self.components[const.ALL]
|
local all_components = self.components[const.ALL]
|
||||||
|
|
||||||
-- Recursive remove all children of component
|
-- Recursive remove all children of component
|
||||||
for i = 1, #all_components do
|
for i = #all_components, 1, -1 do
|
||||||
local inst = all_components[i]
|
local inst = all_components[i]
|
||||||
if inst:is_child_of(component) then
|
if inst:is_child_of(component) then
|
||||||
self:remove(inst)
|
self:remove(inst)
|
||||||
@@ -183,7 +204,7 @@ function Druid.remove(self, component)
|
|||||||
if component.on_remove then
|
if component.on_remove then
|
||||||
component:on_remove()
|
component:on_remove()
|
||||||
end
|
end
|
||||||
table.remove(self, i)
|
table.remove(all_components, i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -216,6 +237,8 @@ end
|
|||||||
-- @tparam hash action_id Action_id from on_input
|
-- @tparam hash action_id Action_id from on_input
|
||||||
-- @tparam table action Action from on_input
|
-- @tparam table action Action from on_input
|
||||||
function Druid.on_input(self, action_id, action)
|
function Druid.on_input(self, action_id, action)
|
||||||
|
self._is_input_processing = true
|
||||||
|
|
||||||
local is_input_consumed = false
|
local is_input_consumed = false
|
||||||
|
|
||||||
is_input_consumed = process_input(action_id, action,
|
is_input_consumed = process_input(action_id, action,
|
||||||
@@ -224,6 +247,15 @@ function Druid.on_input(self, action_id, action)
|
|||||||
is_input_consumed = process_input(action_id, action,
|
is_input_consumed = process_input(action_id, action,
|
||||||
self.components[const.ON_INPUT], is_input_consumed)
|
self.components[const.ON_INPUT], is_input_consumed)
|
||||||
|
|
||||||
|
self._is_input_processing = false
|
||||||
|
|
||||||
|
if #self._late_remove > 0 then
|
||||||
|
for i = 1, #self._late_remove do
|
||||||
|
self:remove(self._late_remove[i])
|
||||||
|
end
|
||||||
|
self._late_remove = {}
|
||||||
|
end
|
||||||
|
|
||||||
return is_input_consumed
|
return is_input_consumed
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -6,7 +6,8 @@ local M = {}
|
|||||||
|
|
||||||
M.default_style = nil
|
M.default_style = nil
|
||||||
|
|
||||||
function M.get_text(name)
|
|
||||||
|
function M.get_text(name, ...)
|
||||||
return "[Druid]: locales not inited"
|
return "[Druid]: locales not inited"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
76
editor_scripts/gui_scheme.editor_script
Normal file
76
editor_scripts/gui_scheme.editor_script
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
--- @license MIT, Insality 2020
|
||||||
|
--- @source https://github.com/Insality/druid
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
|
||||||
|
local function ends_with(str, ending)
|
||||||
|
return ending == "" or str:sub(-#ending) == ending
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function M.get_commands()
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
label = "Print gui scheme",
|
||||||
|
|
||||||
|
locations = { "Outline" },
|
||||||
|
|
||||||
|
query = {
|
||||||
|
selection = {type = "outline", cardinality = "many"}
|
||||||
|
},
|
||||||
|
|
||||||
|
active = function(opts)
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
|
||||||
|
run = function(opts)
|
||||||
|
print("local SCHEME = {")
|
||||||
|
|
||||||
|
for i = 1, #opts.selection do
|
||||||
|
local file = opts.selection[i]
|
||||||
|
if editor.can_get(file, "id") then
|
||||||
|
local id = editor.get(file, "id")
|
||||||
|
print("\t" .. string.upper(id) .. " = \"" .. id .. "\",")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
print("}")
|
||||||
|
print("")
|
||||||
|
end
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label = "Assign layers",
|
||||||
|
|
||||||
|
locations = {"Edit"},
|
||||||
|
|
||||||
|
query = {
|
||||||
|
selection = {type = "resource", cardinality = "one"}
|
||||||
|
},
|
||||||
|
|
||||||
|
active = function(opts)
|
||||||
|
local path = editor.get(opts.selection, "path")
|
||||||
|
return ends_with(path, ".gui")
|
||||||
|
end,
|
||||||
|
|
||||||
|
run = function(opts)
|
||||||
|
local file = opts.selection
|
||||||
|
print("Run script for", editor.get(file, "path"))
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
action = "shell",
|
||||||
|
command = {
|
||||||
|
"bash",
|
||||||
|
"./editor_scripts/setup_layers.sh",
|
||||||
|
"." .. editor.get(file, "path")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return M
|
44
editor_scripts/setup_layers.py
Normal file
44
editor_scripts/setup_layers.py
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
# @license MIT, Insality 2020
|
||||||
|
# @source https://github.com/Insality/druid
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import deftree
|
||||||
|
|
||||||
|
def main():
|
||||||
|
filename = sys.argv[1]
|
||||||
|
print("Auto setup layers for file", filename)
|
||||||
|
tree = deftree.parse(filename)
|
||||||
|
root = tree.get_root()
|
||||||
|
|
||||||
|
layers = []
|
||||||
|
for texture in root.iter_elements("textures"):
|
||||||
|
layers.append(texture.get_attribute("name").value)
|
||||||
|
|
||||||
|
for fonts in root.iter_elements("fonts"):
|
||||||
|
layers.append(fonts.get_attribute("name").value)
|
||||||
|
|
||||||
|
to_remove_layers = []
|
||||||
|
for layer in root.iter_elements("layers"):
|
||||||
|
to_remove_layers.append(layer)
|
||||||
|
for layer in to_remove_layers:
|
||||||
|
root.remove(layer)
|
||||||
|
|
||||||
|
for layer in layers:
|
||||||
|
new_layer = root.add_element("layers")
|
||||||
|
new_layer.add_attribute("name", layer)
|
||||||
|
|
||||||
|
for node in root.iter_elements("nodes"):
|
||||||
|
texture = node.get_attribute("texture")
|
||||||
|
font = node.get_attribute("font")
|
||||||
|
|
||||||
|
if texture:
|
||||||
|
layer = texture.value.split("/")[0]
|
||||||
|
node.set_attribute("layer", layer)
|
||||||
|
|
||||||
|
if font:
|
||||||
|
layer = font.value
|
||||||
|
node.set_attribute("layer", layer)
|
||||||
|
|
||||||
|
tree.write()
|
||||||
|
|
||||||
|
main()
|
8
editor_scripts/setup_layers.sh
Executable file
8
editor_scripts/setup_layers.sh
Executable file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# @license MIT, Insality 2020
|
||||||
|
# @source https://github.com/Insality/druid
|
||||||
|
|
||||||
|
echo "Run bash for $1"
|
||||||
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
|
/usr/local/bin/python3.7 $DIR/setup_layers.py $@
|
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ local button_page = require("example.page.button_page")
|
|||||||
local scroll_page = require("example.page.scroll_page")
|
local scroll_page = require("example.page.scroll_page")
|
||||||
local slider_page = require("example.page.slider_page")
|
local slider_page = require("example.page.slider_page")
|
||||||
local input_page = require("example.page.input_page")
|
local input_page = require("example.page.input_page")
|
||||||
|
local grid_page = require("example.page.grid_page")
|
||||||
|
|
||||||
local pages = {
|
local pages = {
|
||||||
"main_page",
|
"main_page",
|
||||||
@@ -17,6 +18,7 @@ local pages = {
|
|||||||
"scroll_page",
|
"scroll_page",
|
||||||
"slider_page",
|
"slider_page",
|
||||||
"input_page",
|
"input_page",
|
||||||
|
"grid_page",
|
||||||
}
|
}
|
||||||
|
|
||||||
local function on_control_button(self, delta)
|
local function on_control_button(self, delta)
|
||||||
@@ -70,6 +72,7 @@ function init(self)
|
|||||||
scroll_page.setup_page(self)
|
scroll_page.setup_page(self)
|
||||||
slider_page.setup_page(self)
|
slider_page.setup_page(self)
|
||||||
input_page.setup_page(self)
|
input_page.setup_page(self)
|
||||||
|
grid_page.setup_page(self)
|
||||||
|
|
||||||
init_top_panel(self)
|
init_top_panel(self)
|
||||||
|
|
||||||
|
@@ -7,8 +7,8 @@ local function setup_druid()
|
|||||||
sound.play("kenney:/sound#" .. name)
|
sound.play("kenney:/sound#" .. name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
druid.set_text_function(function(lang_id)
|
druid.set_text_function(function(lang_id, ...)
|
||||||
return lang.get_locale(lang_id)
|
return lang.get_locale(lang_id, ...)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
druid.on_language_change()
|
druid.on_language_change()
|
||||||
|
@@ -9,6 +9,7 @@ local en = {
|
|||||||
scroll_page = "Scroll page",
|
scroll_page = "Scroll page",
|
||||||
slider_page = "Slider page",
|
slider_page = "Slider page",
|
||||||
input_page = "Input page",
|
input_page = "Input page",
|
||||||
|
grid_page = "Grid page",
|
||||||
ui_section_button = "Button",
|
ui_section_button = "Button",
|
||||||
ui_section_text = "Text",
|
ui_section_text = "Text",
|
||||||
ui_section_timer = "Timer",
|
ui_section_timer = "Timer",
|
||||||
@@ -27,6 +28,7 @@ local ru = {
|
|||||||
scroll_page = "Скролл",
|
scroll_page = "Скролл",
|
||||||
slider_page = "Слайдеры",
|
slider_page = "Слайдеры",
|
||||||
input_page = "Текст. ввод",
|
input_page = "Текст. ввод",
|
||||||
|
grid_page = "Сетка",
|
||||||
ui_section_button = "Кнопка",
|
ui_section_button = "Кнопка",
|
||||||
ui_section_text = "Текст",
|
ui_section_text = "Текст",
|
||||||
ui_section_timer = "Таймер",
|
ui_section_timer = "Таймер",
|
||||||
@@ -42,8 +44,14 @@ local ru = {
|
|||||||
local data = en
|
local data = en
|
||||||
|
|
||||||
|
|
||||||
function M.get_locale(lang_id)
|
function M.get_locale(lang_id, ...)
|
||||||
return data[lang_id] or lang_id
|
local localized_text = data[lang_id] or lang_id
|
||||||
|
|
||||||
|
if #{...} > 0 then
|
||||||
|
localized_text = string.format(localized_text, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return localized_text
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@@ -42,6 +42,9 @@ local function setup_buttons(self)
|
|||||||
button_space:set_key_trigger("key_space")
|
button_space:set_key_trigger("key_space")
|
||||||
button_space.on_long_click:subscribe(long_tap_callback)
|
button_space.on_long_click:subscribe(long_tap_callback)
|
||||||
button_space.on_double_click:subscribe(double_tap_callback)
|
button_space.on_double_click:subscribe(double_tap_callback)
|
||||||
|
|
||||||
|
-- Button with another node for animating
|
||||||
|
self.druid:new_button("button_anim/button", usual_callback, nil, "anim_node_icon")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
57
example/page/grid_page.lua
Normal file
57
example/page/grid_page.lua
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
|
||||||
|
local function add_node(self)
|
||||||
|
local prefab = gui.get_node("grid_nodes_prefab")
|
||||||
|
local cloned = gui.clone_tree(prefab)
|
||||||
|
gui.set_enabled(cloned["grid_nodes_prefab"], true)
|
||||||
|
local index = #self.grid_nodes + 1
|
||||||
|
gui.set_text(cloned["grid_nodes_text"], index)
|
||||||
|
|
||||||
|
local button = self.druid:new_button(cloned["grid_nodes_prefab"], function()
|
||||||
|
print(index)
|
||||||
|
end)
|
||||||
|
table.insert(self.grid_node_buttons, button)
|
||||||
|
|
||||||
|
self.grid_nodes:add(cloned["grid_nodes_prefab"])
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function clear_nodes(self)
|
||||||
|
local nodes = self.grid_nodes.nodes
|
||||||
|
for i = 1, #nodes do
|
||||||
|
gui.delete_node(nodes[i])
|
||||||
|
end
|
||||||
|
|
||||||
|
for i = 1, #self.grid_node_buttons do
|
||||||
|
self.druid:remove(self.grid_node_buttons[i])
|
||||||
|
end
|
||||||
|
self.grid_node_buttons = {}
|
||||||
|
|
||||||
|
self.grid_nodes:clear()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function remove_node(self)
|
||||||
|
-- Remove is not implemented yet
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function M.setup_page(self)
|
||||||
|
self.grid_nodes = self.druid:new_grid("grid_nodes", "grid_nodes_prefab", 5)
|
||||||
|
self.grid_node_buttons = {}
|
||||||
|
gui.set_enabled(gui.get_node("grid_nodes_prefab"), false)
|
||||||
|
|
||||||
|
for i = 1, 15 do
|
||||||
|
add_node(self)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.druid:new_button("button_add/button", add_node)
|
||||||
|
self.druid:new_button("button_clear/button", clear_nodes)
|
||||||
|
|
||||||
|
local remove_button = self.druid:new_button("button_remove/button", remove_node)
|
||||||
|
gui.set_enabled(remove_button.node, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return M
|
@@ -54,7 +54,7 @@ function M.setup_page(self)
|
|||||||
|
|
||||||
-- Content with less size than view
|
-- Content with less size than view
|
||||||
self.druid:new_scroll("scroll_smaller_view", "scroll_smaller_content")
|
self.druid:new_scroll("scroll_smaller_view", "scroll_smaller_content")
|
||||||
:set_extra_strech_size(0)
|
:set_extra_stretch_size(0)
|
||||||
:set_inert(false)
|
:set_inert(false)
|
||||||
|
|
||||||
-- Scroll with points of interests
|
-- Scroll with points of interests
|
||||||
|
@@ -10,7 +10,7 @@ height = 900
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
title = druid
|
title = druid
|
||||||
version = 0.4.0
|
version = 0.4.3
|
||||||
|
|
||||||
[library]
|
[library]
|
||||||
include_dirs = druid
|
include_dirs = druid
|
||||||
|
Reference in New Issue
Block a user