Merge pull request #180 from Insality/develop

Release 0.9.0
This commit is contained in:
Maxim Tuprikov 2022-03-12 12:07:50 +02:00 committed by GitHub
commit b5a77391a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
138 changed files with 17537 additions and 6062 deletions

View File

@ -57,13 +57,25 @@ input_scroll_down = scroll_down
By default, **Druid** will auto-capture input focus, if any input component will be created. So you don't need to call `msg.post(".", "acquire_input_focus")` By default, **Druid** will auto-capture input focus, if any input component will be created. So you don't need to call `msg.post(".", "acquire_input_focus")`
If you don't need this behaviour, you can disable it by settings `druid.no_auto_input` field in _game.project_: If you don't need this behaviour, you can disable it by setting `druid.no_auto_input` field in _game.project_:
``` ```
[druid] [druid]
no_auto_input = 1 no_auto_input = 1
``` ```
### Template name check [optional]
By default, **Druid** will auto check the parent component template name to build the full template name for component.
If for some reason you want to pass the full template name by yourself, you can disable it by setting `druid.no_auto_template` field in _game.project_:
```
[druid]
no_auto_template = 1
```
### Stencil check [optional] ### Stencil check [optional]
When creating input components inside stencil nodes, you probably will use `component:set_click_zone()` to restrict clicks outside this stencil zone. When creating input components inside stencil nodes, you probably will use `component:set_click_zone()` to restrict clicks outside this stencil zone.
@ -73,6 +85,7 @@ Druid can do it automatically on _late_init_ component step. To enable this feat
stencil_check = 1 stencil_check = 1
``` ```
### Code [optional] ### Code [optional]
Adjust **Druid** settings, if needed: Adjust **Druid** settings, if needed:
@ -245,11 +258,9 @@ It is recommended to fully integrate all **Druid** lifecycles functions.
## Examples ## Examples
See the [example folder](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid** See the [**example folder**](https://github.com/Insality/druid/tree/develop/example) for examples of how to use **Druid**
See the [druid-assets repository](https://github.com/insality/druid-assets) for examples of how to create custom components and styles Try the [**HTML5 version**](https://insality.github.io/druid/druid/) of the **Druid** example app
Try the [HTML5 version](https://insality.github.io/druid/druid/) of the example app
## Documentation ## Documentation
@ -259,17 +270,11 @@ To better understand **Druid**, read the following documentation:
- [Create custom components](docs_md/02-creating_custom_components.md) - [Create custom components](docs_md/02-creating_custom_components.md)
- [See FAQ article](docs_md/FAQ.md) - [See FAQ article](docs_md/FAQ.md)
- [Druid styles](docs_md/03-styles.md) - [Druid styles](docs_md/03-styles.md)
- [Druid asset store](docs_md/04-druid_assets.md)
You can fund the full **Druid** documentation here: You can fund the full **Druid** documentation here:
https://insality.github.io/druid/ https://insality.github.io/druid/
## Games powered by Druid
_You published your game and you using Druid? Note me!_
## License ## License
- Developed and supported by [Insality](https://github.com/Insality) - Developed and supported by [Insality](https://github.com/Insality)

View File

@ -4,11 +4,13 @@ description='Documentation for Druid Library'
file={"./druid", file={"./druid",
exclude = { exclude = {
"./druid/styles/", "./druid/styles/",
"./druid/system/middleclass.lua" "./druid/system/middleclass.lua",
"./druid/templates/",
"./druid/annotations.lua",
} }
} }
package='druid' package='druid'
sort=false sort=true
dir='./docs' dir='./docs'
style='!fixed' style='!fixed'
topics={} topics={}

View File

@ -4,3 +4,4 @@ date,sha,version,build_size,build_time,platform,mode,is_cache_using,commits_coun
2022-02-28T19:16:23Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521 2022-02-28T19:16:23Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-02-28T19:19:46Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521 2022-02-28T19:19:46Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-02-28T19:22:51Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521 2022-02-28T19:22:51Z,3b329f9c25c9672e4030edb039b0225fa46f7ce1,0.8.521,4356,11,armv7-android,debug,true,521
2022-03-12T10:01:30Z,d0f3d6641a08b0d6b719b13017aa85907d1667e5,0.8.564,2200,44,js-web,release,true,564

1 date sha version build_size build_time platform mode is_cache_using commits_count
4 2022-02-28T19:16:23Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
5 2022-02-28T19:19:46Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
6 2022-02-28T19:22:51Z 3b329f9c25c9672e4030edb039b0225fa46f7ce1 0.8.521 4356 11 armv7-android debug true 521
7 2022-03-12T10:01:30Z d0f3d6641a08b0d6b719b13017aa85907d1667e5 0.8.564 2200 44 js-web release true 564

View File

@ -1 +1 @@
{"content":[{"name":"game.projectc","size":3748,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":13488,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":948433,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":13875,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]} {"content":[{"name":"game.projectc","size":3808,"pieces":[{"name":"game.projectc0","offset":0}]},{"name":"game.arci","size":17168,"pieces":[{"name":"game.arci0","offset":0}]},{"name":"game.arcd","size":417873,"pieces":[{"name":"game.arcd0","offset":0}]},{"name":"game.dmanifest","size":17838,"pieces":[{"name":"game.dmanifest0","offset":0}]},{"name":"game.public.der","size":162,"pieces":[{"name":"game.public.der0","offset":0}]}]}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,12 +1,13 @@
[project] [project]
title = druid title = druid
version = 0.8.519 version = 0.8.564
write_log = 0 write_log = 0
compress_archive = 1 compress_archive = 1
publisher = Insality publisher = Insality
developer = Insality developer = Insality
commit_sha = 4e0fd264b169693d088a47f2bb53376a1808fb1e commit_sha = d0f3d6641a08b0d6b719b13017aa85907d1667e5
build_time = 2022-02-12T15:15:53Z build_date = 2022-03-12T10:01:30Z
title_as_file_name = druid
[display] [display]
width = 600 width = 600
@ -16,8 +17,8 @@ samples = 0
fullscreen = 0 fullscreen = 0
update_frequency = 0 update_frequency = 0
vsync = 1 vsync = 1
display_profiles = /builtins/render/default.display_profilesc display_profiles = /example/custom.display_profilesc
dynamic_orientation = 0 dynamic_orientation = 1
display_device_info = 0 display_device_info = 0
[render] [render]
@ -43,6 +44,7 @@ contact_impulse_limit = 0
ray_cast_limit_2d = 64 ray_cast_limit_2d = 64
ray_cast_limit_3d = 128 ray_cast_limit_3d = 128
trigger_overlap_capacity = 16 trigger_overlap_capacity = 16
velocity_threshold = 1
[bootstrap] [bootstrap]
main_collection = /example/example.collectionc main_collection = /example/example.collectionc
@ -85,9 +87,6 @@ use_accelerometer = 0
max_count = 128 max_count = 128
subpixels = 1 subpixels = 1
[spine]
max_count = 128
[model] [model]
max_count = 128 max_count = 128
@ -121,7 +120,7 @@ default_language = en
localizations = en localizations = en
[android] [android]
version_code = 519 version_code = 564
minimum_sdk_version = 16 minimum_sdk_version = 16
target_sdk_version = 30 target_sdk_version = 30
package = com.insality.druid package = com.insality.druid
@ -156,6 +155,7 @@ splash_image = /media/druid_logo.png
[particle_fx] [particle_fx]
max_count = 64 max_count = 64
max_emitter_count = 64
max_particle_count = 1024 max_particle_count = 1024
[iap] [iap]
@ -193,6 +193,7 @@ run_while_iconified = 0
[druid] [druid]
no_auto_input = 0 no_auto_input = 0
stencil_check = 0 stencil_check = 0
no_auto_template = 0
input_text = text input_text = text
input_touch = touch input_touch = touch
input_marked_text = marked_text input_marked_text = marked_text

Binary file not shown.

View File

@ -113,9 +113,9 @@ var EngineLoader = {
asmjs_from: 0, asmjs_from: 0,
asmjs_to: 50, asmjs_to: 50,
// load .wasm and set Module.instantiateWasm to use the loaded .wasm file stream_wasm: true,
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
loadWasmAsync: function(src, fromProgress, toProgress, callback) { loadAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size, FileLoader.load(src, "arraybuffer", EngineLoader.wasm_size,
function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); }, function(loaded, total) { Progress.calculateProgress(fromProgress, toProgress, loaded, total); },
function(error) { throw error; }, function(error) { throw error; },
@ -133,6 +133,31 @@ var EngineLoader = {
}); });
}, },
streamAndInstantiateWasmAsync: function(src, fromProgress, toProgress, callback) {
Module.instantiateWasm = function(imports, successCallback) {
WebAssembly.instantiateStreaming(fetch(src), imports).then(function(output) {
Progress.calculateProgress(fromProgress, toProgress, 1, 1);
successCallback(output.instance);
}).catch(function(e) {
console.log('wasm streaming instantiation failed! ' + e);
throw e;
});
return {}; // Compiling asynchronously, no exports.
}
callback();
},
// instantiate the .wasm file either by streaming it or first loading and then instantiate it
// https://github.com/emscripten-core/emscripten/blob/master/tests/manual_wasm_instantiate.html#L170
loadWasmAsync: function(src, fromProgress, toProgress, callback) {
if (EngineLoader.stream_wasm && (typeof WebAssembly.instantiateStreaming === "function")) {
EngineLoader.streamAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
}
else {
EngineLoader.loadAndInstantiateWasmAsync(src, fromProgress, toProgress, callback);
}
},
// load and start engine script (asm.js or wasm.js) // load and start engine script (asm.js or wasm.js)
loadScriptAsync: function(src, estimatedSize, fromProgress, toProgress) { loadScriptAsync: function(src, estimatedSize, fromProgress, toProgress) {
FileLoader.load(src, "text", estimatedSize, FileLoader.load(src, "text", estimatedSize,
@ -457,35 +482,6 @@ var Progress = {
} }
}; };
/* ********************************************************************* */
/* Default input override */
/* ********************************************************************* */
var CanvasInput = {
arrowKeysHandler : function(e) {
switch(e.keyCode) {
case 37: case 38: case 39: case 40: // Arrow keys
case 32: e.preventDefault(); e.stopPropagation(); // Space
default: break; // do not block other keys
}
},
onFocusIn : function(e) {
window.addEventListener("keydown", CanvasInput.arrowKeysHandler, false);
},
onFocusOut: function(e) {
window.removeEventListener("keydown", CanvasInput.arrowKeysHandler, false);
},
addToCanvas : function(canvas) {
canvas.addEventListener("focus", CanvasInput.onFocusIn, false);
canvas.addEventListener("blur", CanvasInput.onFocusOut, false);
canvas.focus();
CanvasInput.onFocusIn();
}
};
/* ********************************************************************* */ /* ********************************************************************* */
/* Module is Emscripten namespace */ /* Module is Emscripten namespace */
/* ********************************************************************* */ /* ********************************************************************* */
@ -578,30 +574,6 @@ var Module = {
return webgl_support; return webgl_support;
}, },
handleVisibilityChange: function () {
GLFW.onFocusChanged(document[Module.hiddenProperty] ? 0 : 1);
},
getHiddenProperty: function () {
if ('hidden' in document) return 'hidden';
var prefixes = ['webkit','moz','ms','o'];
for (var i = 0; i < prefixes.length; i++) {
if ((prefixes[i] + 'Hidden') in document)
return prefixes[i] + 'Hidden';
}
return null;
},
setupVisibilityChangeListener: function() {
Module.hiddenProperty = Module.getHiddenProperty();
if( Module.hiddenProperty ) {
var eventName = Module.hiddenProperty.replace(/[H|h]idden/,'') + 'visibilitychange';
document.addEventListener(eventName, Module.handleVisibilityChange, false);
} else {
console.log("No document.hidden property found. The focus events won't be enabled.")
}
},
setupCanvas: function(appCanvasId) { setupCanvas: function(appCanvasId) {
appCanvasId = (typeof appCanvasId === 'undefined') ? 'canvas' : appCanvasId; appCanvasId = (typeof appCanvasId === 'undefined') ? 'canvas' : appCanvasId;
Module.canvas = document.getElementById(appCanvasId); Module.canvas = document.getElementById(appCanvasId);
@ -672,10 +644,7 @@ var Module = {
Module.fullScreenContainer = fullScreenContainer || Module.canvas; Module.fullScreenContainer = fullScreenContainer || Module.canvas;
if (Module.hasWebGLSupport()) { if (Module.hasWebGLSupport()) {
// Override game keys Module.canvas.focus();
CanvasInput.addToCanvas(Module.canvas);
Module.setupVisibilityChangeListener();
// Add context menu hide-handler if requested // Add context menu hide-handler if requested
if (params["disable_context_menu"]) if (params["disable_context_menu"])

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags --> <!-- The above 4 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>druid 0.8.519</title> <title>druid 0.8.564</title>
<style type='text/css'> <style type='text/css'>
/* Disable user selection to avoid strange bug in Chrome on Windows: /* Disable user selection to avoid strange bug in Chrome on Windows:
* Selecting a text outside the canvas, then clicking+draging would * Selecting a text outside the canvas, then clicking+draging would

View File

@ -41,6 +41,8 @@
<li><a href="modules/Swipe.html">Swipe</a></li> <li><a href="modules/Swipe.html">Swipe</a></li>
<li><a href="modules/Text.html">Text</a></li> <li><a href="modules/Text.html">Text</a></li>
<li><a href="modules/BaseComponent.html">BaseComponent</a></li> <li><a href="modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="modules/PinKnob.html">PinKnob</a></li>
<li><a href="modules/RichInput.html">RichInput</a></li>
<li><a href="modules/druid.html">druid</a></li> <li><a href="modules/druid.html">druid</a></li>
<li><a href="modules/DruidEvent.html">DruidEvent</a></li> <li><a href="modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="modules/Checkbox.html">Checkbox</a></li> <li><a href="modules/Checkbox.html">Checkbox</a></li>
@ -53,7 +55,7 @@
<li><a href="modules/RadioGroup.html">RadioGroup</a></li> <li><a href="modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="modules/Slider.html">Slider</a></li> <li><a href="modules/Slider.html">Slider</a></li>
<li><a href="modules/Timer.html">Timer</a></li> <li><a href="modules/Timer.html">Timer</a></li>
<li><a href="modules/druid.helper.html">druid.helper</a></li> <li><a href="modules/Helper.html">Helper</a></li>
<li><a href="modules/DruidInstance.html">DruidInstance</a></li> <li><a href="modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
@ -106,13 +108,21 @@
<td class="name" nowrap><a href="modules/BaseComponent.html">BaseComponent</a></td> <td class="name" nowrap><a href="modules/BaseComponent.html">BaseComponent</a></td>
<td class="summary">Basic class for all Druid components.</td> <td class="summary">Basic class for all Druid components.</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="modules/PinKnob.html">PinKnob</a></td>
<td class="summary">Druid pin knob custom component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/RichInput.html">RichInput</a></td>
<td class="summary">Druid Rich Input custom component.</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="modules/druid.html">druid</a></td> <td class="name" nowrap><a href="modules/druid.html">druid</a></td>
<td class="summary">Druid UI Library.</td> <td class="summary">Druid UI Library.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="modules/DruidEvent.html">DruidEvent</a></td> <td class="name" nowrap><a href="modules/DruidEvent.html">DruidEvent</a></td>
<td class="summary">Lua event small library</td> <td class="summary">Druid lua event library</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="modules/Checkbox.html">Checkbox</a></td> <td class="name" nowrap><a href="modules/Checkbox.html">Checkbox</a></td>
@ -156,8 +166,8 @@
<td class="summary">Component to handle GUI timers.</td> <td class="summary">Component to handle GUI timers.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="modules/druid.helper.html">druid.helper</a></td> <td class="name" nowrap><a href="modules/Helper.html">Helper</a></td>
<td class="summary">Text node or icon node can be nil</td> <td class="summary">Druid helper module for gui layouts</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="modules/DruidInstance.html">DruidInstance</a></td> <td class="name" nowrap><a href="modules/DruidInstance.html">DruidInstance</a></td>
@ -168,8 +178,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><strong>BackHandler</strong></li> <li><strong>BackHandler</strong></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -116,7 +118,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BackHandler</span></span> <span class="types"><span class="type">BackHandler</span></span>
<a href="../modules/BackHandler.html#">BackHandler</a>
</li> </li>
<li><span class="parameter">callback</span> <li><span class="parameter">callback</span>
<span class="types"><span class="type">callback</span></span> <span class="types"><span class="type">callback</span></span>
@ -146,7 +148,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BackHandler</span></span> <span class="types"><span class="type">BackHandler</span></span>
<a href="../modules/BackHandler.html#">BackHandler</a>
</li> </li>
<li><span class="parameter">action_id</span> <li><span class="parameter">action_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
@ -177,8 +179,8 @@
<ul> <ul>
<li><span class="parameter">on_back</span> <li><span class="parameter">on_back</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -213,8 +215,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><strong>BaseComponent</strong></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><strong>BaseComponent</strong></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -78,64 +80,77 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#set_style">set_style(self, druid_style)</a></td> <td class="name" nowrap><a href="#get_childrens">get_childrens(self)</a></td>
<td class="summary">Set current component style table.</td> <td class="summary">Return all children components, recursive (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_template">set_template(self, template)</a></td>
<td class="summary">Set current component template name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_nodes">set_nodes(self, nodes)</a></td>
<td class="summary">Set current component nodes</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_context">get_context(self)</a></td> <td class="name" nowrap><a href="#get_context">get_context(self)</a></td>
<td class="summary">Get current component context</td> <td class="summary">Get current component context (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_node">get_node(self, node_or_name)</a></td>
<td class="summary">Get node for component by name.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_druid">get_druid(self)</a></td> <td class="name" nowrap><a href="#get_druid">get_druid(self)</a></td>
<td class="summary">Return druid with context of calling component.</td> <td class="summary">Return druid with context of calling component (protected).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_name">get_name(self)</a></td>
<td class="summary">Return component name</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_input_priority">get_input_priority(self)</a></td> <td class="name" nowrap><a href="#get_input_priority">get_input_priority(self)</a></td>
<td class="summary">Return component input priority</td> <td class="summary">Return component input priority</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_input_priority">set_input_priority(self, value)</a></td> <td class="name" nowrap><a href="#get_name">get_name(self)</a></td>
<td class="summary">Set component input priority</td> <td class="summary">Return component name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_node">get_node(self, node_or_name)</a></td>
<td class="summary">Get node for component by name.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_parent_component">get_parent_component(self)</a></td>
<td class="summary">Return the parent for current component (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_parent_name">get_parent_name(self)</a></td>
<td class="summary">Return parent component name</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_template">get_template(self)</a></td>
<td class="summary">Get current component template name (protected)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_uid">get_uid(self)</a></td>
<td class="summary">Return component uid (protected).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#log_message">log_message(self, message, context)</a></td>
<td class="summary">Print log information if debug mode is enabled (protected)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#reset_input_priority">reset_input_priority(self)</a></td> <td class="name" nowrap><a href="#reset_input_priority">reset_input_priority(self)</a></td>
<td class="summary">Reset component input priority to default value</td> <td class="summary">Reset component input priority to default value</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_uid">get_uid(self)</a></td> <td class="name" nowrap><a href="#set_debug">set_debug(self, is_debug)</a></td>
<td class="summary">Return component uid.</td> <td class="summary">Set debug logs for component enabled or disabled</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_input_enabled">set_input_enabled(self, state)</a></td> <td class="name" nowrap><a href="#set_input_enabled">set_input_enabled(self, state)</a></td>
<td class="summary">Set component input state.</td> <td class="summary">Set component input state.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_parent_component">get_parent_component(self)</a></td> <td class="name" nowrap><a href="#set_input_priority">set_input_priority(self, value)</a></td>
<td class="summary">Return the parent for current component</td> <td class="summary">Set component input priority</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#setup_component">setup_component(self, druid_instance, context, style)</a></td> <td class="name" nowrap><a href="#set_nodes">set_nodes(self, nodes)</a></td>
<td class="summary">Setup component context and his style table</td> <td class="summary">Set current component nodes (protected)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_childrens">get_childrens(self)</a></td> <td class="name" nowrap><a href="#set_style">set_style(self, druid_style)</a></td>
<td class="summary">Return all children components, recursive</td> <td class="summary">Set current component style table (protected).</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_template">set_template(self, template)</a></td>
<td class="summary">Set current component template name (protected)
It will check parent template name to build full template name</td>
</tr> </tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
@ -154,77 +169,27 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "set_style"></a> <a name = "get_childrens"></a>
<strong>set_style(self, druid_style)</strong> <strong>get_childrens(self)</strong>
</dt> </dt>
<dd> <dd>
Set current component style table. Return all children components, recursive (protected)
Invoke `on_style_change` on component, if exist. BaseComponent should handle
their style changing and store all style params
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
<li><span class="parameter">druid_style</span> </ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid style module Array of childrens if the Druid component instance
</li> </ol>
</ul>
</dd>
<dt>
<a name = "set_template"></a>
<strong>set_template(self, template)</strong>
</dt>
<dd>
Set current component template name
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
BaseComponent template name
</li>
</ul>
</dd>
<dt>
<a name = "set_nodes"></a>
<strong>set_nodes(self, nodes)</strong>
</dt>
<dd>
Set current component nodes
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
BaseComponent nodes table
</li>
</ul>
@ -235,14 +200,14 @@
<strong>get_context(self)</strong> <strong>get_context(self)</strong>
</dt> </dt>
<dd> <dd>
Get current component context Get current component context (protected)
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
</ul> </ul>
@ -256,6 +221,88 @@
</dd>
<dt>
<a name = "get_druid"></a>
<strong>get_druid(self)</strong>
</dt>
<dd>
Return druid with context of calling component (protected).
Use it to create component inside of other components.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Druid</span></span>
Druid instance with component context
</ol>
</dd>
<dt>
<a name = "get_input_priority"></a>
<strong>get_input_priority(self)</strong>
</dt>
<dd>
Return component input priority
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The component input priority
</ol>
</dd>
<dt>
<a name = "get_name"></a>
<strong>get_name(self)</strong>
</dt>
<dd>
Return component name
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The component name
</ol>
</dd> </dd>
<dt> <dt>
<a name = "get_node"></a> <a name = "get_node"></a>
@ -265,14 +312,15 @@
Get node for component by name. Get node for component by name.
If component has nodes, node_or_name should be string If component has nodes, node_or_name should be string
It auto pick node by template name or from nodes by clone_tree It auto pick node by template name or from nodes by clone_tree
if they was setup via component:set_nodes, component:set_template if they was setup via component:set_nodes, component:set_template.
If node is not found, the exception will fired
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
<li><span class="parameter">node_or_name</span> <li><span class="parameter">node_or_name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">node</span></span>
@ -292,27 +340,26 @@
</dd> </dd>
<dt> <dt>
<a name = "get_druid"></a> <a name = "get_parent_component"></a>
<strong>get_druid(self)</strong> <strong>get_parent_component(self)</strong>
</dt> </dt>
<dd> <dd>
Return druid with context of calling component. Return the parent for current component (protected)
Use it to create component inside of other components.
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
</ul> </ul>
<h3>Returns:</h3> <h3>Returns:</h3>
<ol> <ol>
<span class="types"><span class="type">Druid</span></span> <span class="types"><span class="type">BaseComponent</span> or <span class="type">nil</span></span>
Druid instance with component context The druid component instance or nil
</ol> </ol>
@ -320,18 +367,45 @@
</dd> </dd>
<dt> <dt>
<a name = "get_name"></a> <a name = "get_parent_name"></a>
<strong>get_name(self)</strong> <strong>get_parent_name(self)</strong>
</dt> </dt>
<dd> <dd>
Return component name Return parent component name
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <span class="type">nil</span></span>
The parent component name if exist or bil
</ol>
</dd>
<dt>
<a name = "get_template"></a>
<strong>get_template(self)</strong>
</dt>
<dd>
Get current component template name (protected)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
</ul> </ul>
@ -339,7 +413,7 @@
<ol> <ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The component name Component full template name
</ol> </ol>
@ -347,18 +421,19 @@
</dd> </dd>
<dt> <dt>
<a name = "get_input_priority"></a> <a name = "get_uid"></a>
<strong>get_input_priority(self)</strong> <strong>get_uid(self)</strong>
</dt> </dt>
<dd> <dd>
Return component input priority Return component uid (protected).
UID generated in component creation order
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
</ul> </ul>
@ -366,7 +441,7 @@
<ol> <ol>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
The component input priority The component uid
</ol> </ol>
@ -374,31 +449,29 @@
</dd> </dd>
<dt> <dt>
<a name = "set_input_priority"></a> <a name = "log_message"></a>
<strong>set_input_priority(self, value)</strong> <strong>log_message(self, message, context)</strong>
</dt> </dt>
<dd> <dd>
Set component input priority Print log information if debug mode is enabled (protected)
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li> </li>
<li><span class="parameter">value</span> <li><span class="parameter">context</span>
<span class="types"><span class="type">number</span></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
The new input priority value
</li> </li>
</ul> </ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The component input priority
</ol>
@ -416,7 +489,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
</ul> </ul>
@ -432,27 +505,25 @@
</dd> </dd>
<dt> <dt>
<a name = "get_uid"></a> <a name = "set_debug"></a>
<strong>get_uid(self)</strong> <strong>set_debug(self, is_debug)</strong>
</dt> </dt>
<dd> <dd>
Return component uid. UID generated in component creation order Set debug logs for component enabled or disabled
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">is_debug</span>
<span class="types"><span class="type">bool</span></span>
</li> </li>
</ul> </ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The component uid
</ol>
@ -471,7 +542,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
<li><span class="parameter">state</span> <li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">bool</span></span>
@ -491,26 +562,30 @@
</dd> </dd>
<dt> <dt>
<a name = "get_parent_component"></a> <a name = "set_input_priority"></a>
<strong>get_parent_component(self)</strong> <strong>set_input_priority(self, value)</strong>
</dt> </dt>
<dd> <dd>
Return the parent for current component Set component input priority
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
The new input priority value
</li> </li>
</ul> </ul>
<h3>Returns:</h3> <h3>Returns:</h3>
<ol> <ol>
<span class="types"><span class="type">druid.base_component</span> or <span class="type">nil</span></span> <span class="types"><span class="type">number</span></span>
The druid component instance or nil The component input priority
</ol> </ol>
@ -518,65 +593,89 @@
</dd> </dd>
<dt> <dt>
<a name = "setup_component"></a> <a name = "set_nodes"></a>
<strong>setup_component(self, druid_instance, context, style)</strong> <strong>set_nodes(self, nodes)</strong>
</dt> </dt>
<dd> <dd>
Setup component context and his style table Set current component nodes (protected)
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
BaseComponent nodes table
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</ol>
</dd>
<dt>
<a name = "set_style"></a>
<strong>set_style(self, druid_style)</strong>
</dt>
<dd>
Set current component style table (protected).
Invoke `on_style_change` on component, if exist. BaseComponent should handle
their style changing and store all style params
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li> </li>
<li><span class="parameter">druid_instance</span> <li><span class="parameter">druid_style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
The parent druid instance
</li>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid context. Usually it is self of script
</li>
<li><span class="parameter">style</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Druid style module Druid style module
</li> </li>
</ul> </ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">component</span></span>
BaseComponent itself
</ol>
</dd> </dd>
<dt> <dt>
<a name = "get_childrens"></a> <a name = "set_template"></a>
<strong>get_childrens(self)</strong> <strong>set_template(self, template)</strong>
</dt> </dt>
<dd> <dd>
Return all children components, recursive Set current component template name (protected)
It will check parent template name to build full template name
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">BaseComponent</span></span> <span class="types"><span class="type">BaseComponent</span></span>
<a href="../modules/BaseComponent.html#">BaseComponent</a>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
BaseComponent template name
</li> </li>
</ul> </ul>
<h3>Returns:</h3> <h3>Returns:</h3>
<ol> <ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span> <span class="types"><span class="type">BaseComponent</span></span>
Array of childrens if the Druid component instance <a href="../modules/BaseComponent.html#">BaseComponent</a>
</ol> </ol>
@ -607,8 +706,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><strong>Blocker</strong></li> <li><strong>Blocker</strong></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -81,13 +83,13 @@
<td class="summary">Component init function</td> <td class="summary">Component init function</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled blocker component state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td> <td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Return blocked enabled state</td> <td class="summary">Return blocked enabled state</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled blocker component state</td>
</tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
@ -116,7 +118,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span> <span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Blocker.html#node">node</a></span> <span class="types"><a class="type" href="../modules/Blocker.html#node">node</a></span>
@ -128,31 +130,6 @@
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled blocker component state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "is_enabled"></a> <a name = "is_enabled"></a>
@ -166,7 +143,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span> <span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li> </li>
</ul> </ul>
@ -180,6 +157,31 @@
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled blocker component state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Blocker</span></span>
<a href="../modules/Blocker.html#">Blocker</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
</dd> </dd>
</dl> </dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2> <h2 class="section-header "><a name="Fields"></a>Fields</h2>
@ -211,8 +213,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -41,29 +41,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><strong>Button</strong></li> <li><strong>Button</strong></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -78,33 +80,33 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, params[, anim_node]])</a></td> <td class="name" nowrap><a href="#get_key_trigger">get_key_trigger(self)</a></td>
<td class="summary">Component init function</td> <td class="summary">Get key-code to trigger this button</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_enabled">set_enabled(self, state)</a></td> <td class="name" nowrap><a href="#init">init(self, node, callback[, params[, anim_node]])</a></td>
<td class="summary">Set enabled button component state</td> <td class="summary">Component init function</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td> <td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<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_check_function">set_check_function(self[, check_function[, failure_callback]])</a></td>
<td class="summary">Set function for additional check for button click availability</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td> <td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, 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_enabled">set_enabled(self, state)</a></td>
<td class="summary">Set enabled button component state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_key_trigger">set_key_trigger(self, key)</a></td> <td class="name" nowrap><a href="#set_key_trigger">set_key_trigger(self, 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>
<td class="name" nowrap><a href="#get_key_trigger">get_key_trigger(self)</a></td>
<td class="summary">Get key-code to trigger this button</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_check_function">set_check_function([check_function[, failure_callback]])</a></td>
<td class="summary">Set function for additional check for button click availability</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">
@ -115,17 +117,33 @@
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#anim_node">anim_node</a></td>
<td class="summary">Animation node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td>
<td class="summary">Restriction zone</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hash">hash</a></td>
<td class="summary">The hash of trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hover">hover</a></td>
<td class="summary">Druid hover logic component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Trigger node</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_click">on_click</a></td> <td class="name" nowrap><a href="#on_click">on_click</a></td>
<td class="summary">On release button callback(self, params, button_instance)</td> <td class="summary">On release button callback(self, params, button_instance)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_repeated_click">on_repeated_click</a></td> <td class="name" nowrap><a href="#on_click_outside">on_click_outside</a></td>
<td class="summary">On repeated action button callback(self, params, button_instance, click_amount)</td> <td class="summary">On click outside of button(self, params, button_instance)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_long_click">on_long_click</a></td>
<td class="summary">On long tap button callback(self, params, button_instance, time)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_double_click">on_double_click</a></td> <td class="name" nowrap><a href="#on_double_click">on_double_click</a></td>
@ -136,44 +154,28 @@
<td class="summary">On button hold before long_click callback(self, params, button_instance, time)</td> <td class="summary">On button hold before long_click callback(self, params, button_instance, time)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_click_outside">on_click_outside</a></td> <td class="name" nowrap><a href="#on_long_click">on_long_click</a></td>
<td class="summary">On click outside of button(self, params, button_instance)</td> <td class="summary">On long tap button callback(self, params, button_instance, time)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#node">node</a></td> <td class="name" nowrap><a href="#on_repeated_click">on_repeated_click</a></td>
<td class="summary">Trigger node</td> <td class="summary">On repeated action button callback(self, params, button_instance, click_amount)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#hash">hash</a></td>
<td class="summary">The hash of trigger node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#anim_node">anim_node</a></td>
<td class="summary">Animation node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_scale">start_scale</a></td>
<td class="summary">Initial scale of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Initial pos of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Initial pos of anim_node</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#params">params</a></td> <td class="name" nowrap><a href="#params">params</a></td>
<td class="summary">Params to click callbacks</td> <td class="summary">Params to click callbacks</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#hover">hover</a></td> <td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Druid hover logic component</td> <td class="summary">Initial pos of anim_node</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td> <td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Restriction zone</td> <td class="summary">Initial pos of anim_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_scale">start_scale</a></td>
<td class="summary">Initial scale of anim_node</td>
</tr> </tr>
</table> </table>
@ -184,166 +186,6 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, node, callback[, params[, anim_node]])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Button callback
</li>
<li><span class="parameter">params</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Button callback params
(<em>optional</em>)
</li>
<li><span class="parameter">anim_node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Button anim node (node, if not provided)
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled button component state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Return button enabled state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True, if button is enabled
</ol>
</dd>
<dt>
<a name = "set_click_zone"></a>
<strong>set_click_zone(self, zone)</strong>
</dt>
<dd>
Strict button click area. Useful for
no click events outside stencil node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "set_key_trigger"></a>
<strong>set_key_trigger(self, key)</strong>
</dt>
<dd>
Set key-code to trigger this button
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="../modules/Button.html#hash">hash</a></span>
The action_id of the key
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt> <dt>
<a name = "get_key_trigger"></a> <a name = "get_key_trigger"></a>
<strong>get_key_trigger(self)</strong> <strong>get_key_trigger(self)</strong>
@ -370,10 +212,76 @@
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, node, callback[, params[, anim_node]])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Button callback
</li>
<li><span class="parameter">params</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Button callback params
(<em>optional</em>)
</li>
<li><span class="parameter">anim_node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Button anim node (node, if not provided)
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "is_enabled"></a>
<strong>is_enabled(self)</strong>
</dt>
<dd>
Return button enabled state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
True, if button is enabled
</ol>
</dd> </dd>
<dt> <dt>
<a name = "set_check_function"></a> <a name = "set_check_function"></a>
<strong>set_check_function([check_function[, failure_callback]])</strong> <strong>set_check_function(self[, check_function[, failure_callback]])</strong>
</dt> </dt>
<dd> <dd>
Set function for additional check for button click availability Set function for additional check for button click availability
@ -381,6 +289,10 @@
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
</li>
<li><span class="parameter">check_function</span> <li><span class="parameter">check_function</span>
<span class="types"><span class="type">function</span></span> <span class="types"><span class="type">function</span></span>
Should return true or false. If true - button can be pressed. Should return true or false. If true - button can be pressed.
@ -403,6 +315,100 @@
</dd>
<dt>
<a name = "set_click_zone"></a>
<strong>set_click_zone(self, zone)</strong>
</dt>
<dd>
Strict button click area. Useful for
no click events outside stencil node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "set_enabled"></a>
<strong>set_enabled(self, state)</strong>
</dt>
<dd>
Set enabled button component state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
Enabled state
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</ol>
</dd>
<dt>
<a name = "set_key_trigger"></a>
<strong>set_key_trigger(self, key)</strong>
</dt>
<dd>
Set key-code to trigger this button
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="../modules/Button.html#hash">hash</a></span>
The action_id of the key
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Button</span></span>
Current button instance
</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>
@ -467,137 +473,39 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_click"></a> <a name = "anim_node"></a>
<strong>on_click</strong> <strong>anim_node</strong>
</dt> </dt>
<dd> <dd>
On release button callback(self, params, button_instance) Animation node
<ul> <ul>
<li><span class="parameter">on_click</span> <li><span class="parameter">anim_node</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_repeated_click"></a>
<strong>on_repeated_click</strong>
</dt>
<dd>
On repeated action button callback(self, params, button_instance, click_amount)
<ul>
<li><span class="parameter">on_repeated_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_long_click"></a>
<strong>on_long_click</strong>
</dt>
<dd>
On long tap button callback(self, params, button_instance, time)
<ul>
<li><span class="parameter">on_long_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_double_click"></a>
<strong>on_double_click</strong>
</dt>
<dd>
On double tap button callback(self, params, button_instance, click_amount)
<ul>
<li><span class="parameter">on_double_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_hold_callback"></a>
<strong>on_hold_callback</strong>
</dt>
<dd>
On button hold before long_click callback(self, params, button_instance, time)
<ul>
<li><span class="parameter">on_hold_callback</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_click_outside"></a>
<strong>on_click_outside</strong>
</dt>
<dd>
On click outside of button(self, params, button_instance)
<ul>
<li><span class="parameter">on_click_outside</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Trigger node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span> <span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
(<em>default</em> node)
</li>
</ul>
</dd>
<dt>
<a name = "click_zone"></a>
<strong>click_zone</strong>
</dt>
<dd>
Restriction zone
<ul>
<li><span class="parameter">click_zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
(<em>optional</em>)
</li> </li>
</ul> </ul>
@ -627,18 +535,17 @@
</dd> </dd>
<dt> <dt>
<a name = "anim_node"></a> <a name = "hover"></a>
<strong>anim_node</strong> <strong>hover</strong>
</dt> </dt>
<dd> <dd>
Animation node Druid hover logic component
<ul> <ul>
<li><span class="parameter">anim_node</span> <li><span class="parameter">hover</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span> <span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
(<em>default</em> node)
</li> </li>
</ul> </ul>
@ -648,15 +555,175 @@
</dd> </dd>
<dt> <dt>
<a name = "start_scale"></a> <a name = "node"></a>
<strong>start_scale</strong> <strong>node</strong>
</dt> </dt>
<dd> <dd>
Initial scale of anim_node Trigger node
<ul> <ul>
<li><span class="parameter">start_scale</span> <li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_click"></a>
<strong>on_click</strong>
</dt>
<dd>
On release button callback(self, params, button_instance)
<ul>
<li><span class="parameter">on_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_click_outside"></a>
<strong>on_click_outside</strong>
</dt>
<dd>
On click outside of button(self, params, button_instance)
<ul>
<li><span class="parameter">on_click_outside</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_double_click"></a>
<strong>on_double_click</strong>
</dt>
<dd>
On double tap button callback(self, params, button_instance, click_amount)
<ul>
<li><span class="parameter">on_double_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_hold_callback"></a>
<strong>on_hold_callback</strong>
</dt>
<dd>
On button hold before long_click callback(self, params, button_instance, time)
<ul>
<li><span class="parameter">on_hold_callback</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_long_click"></a>
<strong>on_long_click</strong>
</dt>
<dd>
On long tap button callback(self, params, button_instance, time)
<ul>
<li><span class="parameter">on_long_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_repeated_click"></a>
<strong>on_repeated_click</strong>
</dt>
<dd>
On repeated action button callback(self, params, button_instance, click_amount)
<ul>
<li><span class="parameter">on_repeated_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "params"></a>
<strong>params</strong>
</dt>
<dd>
Params to click callbacks
<ul>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Initial pos of anim_node
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span> <span class="types"><span class="type">vector3</span></span>
</li> </li>
@ -688,15 +755,15 @@
</dd> </dd>
<dt> <dt>
<a name = "pos"></a> <a name = "start_scale"></a>
<strong>pos</strong> <strong>start_scale</strong>
</dt> </dt>
<dd> <dd>
Initial pos of anim_node Initial scale of anim_node
<ul> <ul>
<li><span class="parameter">pos</span> <li><span class="parameter">start_scale</span>
<span class="types"><span class="type">vector3</span></span> <span class="types"><span class="type">vector3</span></span>
</li> </li>
@ -706,67 +773,6 @@
</dd>
<dt>
<a name = "params"></a>
<strong>params</strong>
</dt>
<dd>
Params to click callbacks
<ul>
<li><span class="parameter">params</span>
<span class="types"><span class="type">any</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "hover"></a>
<strong>hover</strong>
</dt>
<dd>
Druid hover logic component
<ul>
<li><span class="parameter">hover</span>
<span class="types"><span class="type">druid.hover</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "click_zone"></a>
<strong>click_zone</strong>
</dt>
<dd>
Restriction zone
<ul>
<li><span class="parameter">click_zone</span>
<span class="types"><a class="type" href="../modules/Button.html#node">node</a></span>
(<em>optional</em>)
</li>
</ul>
</dd> </dd>
</dl> </dl>
@ -774,8 +780,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -41,29 +41,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><strong>Checkbox</strong></li> <li><strong>Checkbox</strong></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -77,6 +79,10 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox state</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, node, callback[, click_node=node[, initial_state=false]])</a></td> <td class="name" nowrap><a href="#init">init(self, node, callback[, click_node=node[, initial_state=false]])</a></td>
<td class="summary">Component init function</td> <td class="summary">Component init function</td>
@ -85,10 +91,6 @@
<td class="name" nowrap><a href="#set_state">set_state(self, state, is_silent, is_instant)</a></td> <td class="name" nowrap><a href="#set_state">set_state(self, state, is_silent, is_instant)</a></td>
<td class="summary">Set checkbox state</td> <td class="summary">Set checkbox state</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox 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">
@ -100,20 +102,20 @@
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#on_change_state">on_change_state</a></td> <td class="name" nowrap><a href="#button">button</a></td>
<td class="summary">On change state callback(self, state)</td> <td class="summary">Button component from click_node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Visual node</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#click_node">click_node</a></td> <td class="name" nowrap><a href="#click_node">click_node</a></td>
<td class="summary">Button trigger node</td> <td class="summary">Button trigger node</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#button">button</a></td> <td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Button component from click_node</td> <td class="summary">Visual node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_state">on_change_state</a></td>
<td class="summary">On change state callback(self, state)</td>
</tr> </tr>
</table> </table>
@ -124,6 +126,33 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Checkbox state
</ol>
</dd>
<dt> <dt>
<a name = "init"></a> <a name = "init"></a>
<strong>init(self, node, callback[, click_node=node[, initial_state=false]])</strong> <strong>init(self, node, callback[, click_node=node[, initial_state=false]])</strong>
@ -136,7 +165,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span> <span class="types"><span class="type">Checkbox</span></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span> <span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
@ -175,7 +204,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span> <span class="types"><span class="type">Checkbox</span></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li> </li>
<li><span class="parameter">state</span> <li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">bool</span></span>
@ -195,33 +224,6 @@
</dd>
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Checkbox</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Checkbox 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>
@ -255,37 +257,17 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_change_state"></a> <a name = "button"></a>
<strong>on_change_state</strong> <strong>button</strong>
</dt> </dt>
<dd> <dd>
On change state callback(self, state) Button component from click_node
<ul> <ul>
<li><span class="parameter">on_change_state</span> <li><span class="parameter">button</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Visual node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
</li> </li>
</ul> </ul>
@ -316,16 +298,16 @@
</dd> </dd>
<dt> <dt>
<a name = "button"></a> <a name = "node"></a>
<strong>button</strong> <strong>node</strong>
</dt> </dt>
<dd> <dd>
Button component from click_node Visual node
<ul> <ul>
<li><span class="parameter">button</span> <li><span class="parameter">node</span>
<span class="types"><span class="type">Button</span></span> <span class="types"><a class="type" href="../modules/Checkbox.html#node">node</a></span>
</li> </li>
</ul> </ul>
@ -334,6 +316,26 @@
</dd>
<dt>
<a name = "on_change_state"></a>
<strong>on_change_state</strong>
</dt>
<dd>
On change state callback(self, state)
<ul>
<li><span class="parameter">on_change_state</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd> </dd>
</dl> </dl>
@ -341,8 +343,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><strong>CheckboxGroup</strong></li> <li><strong>CheckboxGroup</strong></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -76,6 +78,10 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox group state</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, nodes, callback[, click_nodes=node])</a></td> <td class="name" nowrap><a href="#init">init(self, nodes, callback[, click_nodes=node])</a></td>
<td class="summary">Component init function</td> <td class="summary">Component init function</td>
@ -84,21 +90,17 @@
<td class="name" nowrap><a href="#set_state">set_state(self, indexes, is_instant)</a></td> <td class="name" nowrap><a href="#set_state">set_state(self, indexes, is_instant)</a></td>
<td class="summary">Set checkbox group state</td> <td class="summary">Set checkbox group state</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return checkbox group state</td>
</tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_checkbox_click">on_checkbox_click</a></td>
<td class="summary">On any checkbox click callback(self, index)</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#checkboxes">checkboxes</a></td> <td class="name" nowrap><a href="#checkboxes">checkboxes</a></td>
<td class="summary">Array of checkbox components</td> <td class="summary">Array of checkbox components</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#on_checkbox_click">on_checkbox_click</a></td>
<td class="summary">On any checkbox click callback(self, index)</td>
</tr>
</table> </table>
<br/> <br/>
@ -108,6 +110,33 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool[]</span></span>
Array if checkboxes state
</ol>
</dd>
<dt> <dt>
<a name = "init"></a> <a name = "init"></a>
<strong>init(self, nodes, callback[, click_nodes=node])</strong> <strong>init(self, nodes, callback[, click_nodes=node])</strong>
@ -120,7 +149,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span> <span class="types"><span class="type">CheckboxGroup</span></span>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li> </li>
<li><span class="parameter">nodes</span> <li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span> <span class="types"><span class="type">node[]</span></span>
@ -154,7 +183,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span> <span class="types"><span class="type">CheckboxGroup</span></span>
<a href="../modules/CheckboxGroup.html#">CheckboxGroup</a>
</li> </li>
<li><span class="parameter">indexes</span> <li><span class="parameter">indexes</span>
<span class="types"><span class="type">bool[]</span></span> <span class="types"><span class="type">bool[]</span></span>
@ -170,58 +199,11 @@
</dd>
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return checkbox group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">CheckboxGroup</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool[]</span></span>
Array if checkboxes state
</ol>
</dd> </dd>
</dl> </dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2> <h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "on_checkbox_click"></a>
<strong>on_checkbox_click</strong>
</dt>
<dd>
On any checkbox click callback(self, index)
<ul>
<li><span class="parameter">on_checkbox_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt> <dt>
<a name = "checkboxes"></a> <a name = "checkboxes"></a>
<strong>checkboxes</strong> <strong>checkboxes</strong>
@ -233,7 +215,27 @@
<ul> <ul>
<li><span class="parameter">checkboxes</span> <li><span class="parameter">checkboxes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
<a href="../modules/Checkbox.html#">Checkbox</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_checkbox_click"></a>
<strong>on_checkbox_click</strong>
</dt>
<dd>
On any checkbox click callback(self, index)
<ul>
<li><span class="parameter">on_checkbox_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -248,8 +250,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><strong>DataList</strong></li> <li><strong>DataList</strong></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -77,18 +79,6 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, scroll, grid, create_function)</a></td>
<td class="summary">Data list constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove">on_remove(self)</a></td>
<td class="summary">Druid System on_remove function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_data">set_data(self, data)</a></td>
<td class="summary">Set new data set for DataList component</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td> <td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear the DataList and refresh visuals</td> <td class="summary">Clear the DataList and refresh visuals</td>
@ -98,6 +88,10 @@
<td class="summary">Return first index from data.</td> <td class="summary">Return first index from data.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_index">get_index(self, data)</a></td>
<td class="summary">Return index for data value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_last_index">get_last_index(self)</a></td> <td class="name" nowrap><a href="#get_last_index">get_last_index(self)</a></td>
<td class="summary">Return last index from data</td> <td class="summary">Return last index from data</td>
</tr> </tr>
@ -106,39 +100,47 @@
<td class="summary">Return amount of data</td> <td class="summary">Return amount of data</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_index">get_index(self, data)</a></td> <td class="name" nowrap><a href="#init">init(self, scroll, grid, create_function)</a></td>
<td class="summary">Return index for data value</td> <td class="summary">Data list constructor</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove">on_remove(self)</a></td>
<td class="summary">Druid System on_remove function</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#scroll_to_index">scroll_to_index(self, index)</a></td> <td class="name" nowrap><a href="#scroll_to_index">scroll_to_index(self, index)</a></td>
<td class="summary">Instant scroll to element with passed index</td> <td class="summary">Instant scroll to element with passed index</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#set_data">set_data(self, data)</a></td>
<td class="summary">Set new data set for DataList component</td>
</tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#scroll">scroll</a></td>
<td class="summary">The Druid scroll component</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#grid">grid</a></td> <td class="name" nowrap><a href="#grid">grid</a></td>
<td class="summary">The Druid Grid component</td> <td class="summary">The Druid Grid component</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#top_index">top_index</a></td>
<td class="summary">The current visual top data index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#last_index">last_index</a></td> <td class="name" nowrap><a href="#last_index">last_index</a></td>
<td class="summary">The current visual last data index</td> <td class="summary">The current visual last data index</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_scroll_progress_change">on_scroll_progress_change</a></td>
<td class="summary">Event triggered when scroll progress is changed; event(self, progress_value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scroll">scroll</a></td>
<td class="summary">The Druid scroll component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scroll_progress">scroll_progress</a></td> <td class="name" nowrap><a href="#scroll_progress">scroll_progress</a></td>
<td class="summary">The current progress of scroll posititon</td> <td class="summary">The current progress of scroll posititon</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_scroll_progress_change">on_scroll_progress_change</a></td> <td class="name" nowrap><a href="#top_index">top_index</a></td>
<td class="summary">Event triggered when scroll progress is changed; event(self, progress_value)</td> <td class="summary">The current visual top data index</td>
</tr> </tr>
</table> </table>
@ -149,6 +151,115 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear the DataList and refresh visuals
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_first_index"></a>
<strong>get_first_index(self)</strong>
</dt>
<dd>
Return first index from data. It not always equals to 1
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_index"></a>
<strong>get_index(self, data)</strong>
</dt>
<dd>
Return index for data value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">data</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_last_index"></a>
<strong>get_last_index(self)</strong>
</dt>
<dd>
Return last index from data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_length"></a>
<strong>get_length(self)</strong>
</dt>
<dd>
Return amount of data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt> <dt>
<a name = "init"></a> <a name = "init"></a>
<strong>init(self, scroll, grid, create_function)</strong> <strong>init(self, scroll, grid, create_function)</strong>
@ -161,15 +272,15 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span> <span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li> </li>
<li><span class="parameter">scroll</span> <li><span class="parameter">scroll</span>
<span class="types"><span class="type">druid.scroll</span></span> <span class="types"><span class="type">Scroll</span></span>
The Scroll instance for Data List component The <a href="../modules/Scroll.html#">Scroll</a> instance for Data List component
</li> </li>
<li><span class="parameter">grid</span> <li><span class="parameter">grid</span>
<span class="types"><span class="type">druid.grid</span></span> <span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span>
The Grid instance for Data List component The <a href="../modules/StaticGrid.html#">StaticGrid</a> or <a href="../modules/DynamicGrid.html#">DynamicGrid</a> instance for Data List component
</li> </li>
<li><span class="parameter">create_function</span> <li><span class="parameter">create_function</span>
<span class="types"><span class="type">function</span></span> <span class="types"><span class="type">function</span></span>
@ -194,6 +305,31 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span> <span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
</ul>
</dd>
<dt>
<a name = "scroll_to_index"></a>
<strong>scroll_to_index(self, index)</strong>
</dt>
<dd>
Instant scroll to element with passed index
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
</li> </li>
</ul> </ul>
@ -215,7 +351,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span> <span class="types"><span class="type">DataList</span></span>
<a href="../modules/DataList.html#">DataList</a>
</li> </li>
<li><span class="parameter">data</span> <li><span class="parameter">data</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
@ -233,165 +369,11 @@
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear the DataList and refresh visuals
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_first_index"></a>
<strong>get_first_index(self)</strong>
</dt>
<dd>
Return first index from data. It not always equals to 1
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_last_index"></a>
<strong>get_last_index(self)</strong>
</dt>
<dd>
Return last index from data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_length"></a>
<strong>get_length(self)</strong>
</dt>
<dd>
Return amount of data
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "get_index"></a>
<strong>get_index(self, data)</strong>
</dt>
<dd>
Return index for data value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
<li><span class="parameter">data</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "scroll_to_index"></a>
<strong>scroll_to_index(self, index)</strong>
</dt>
<dd>
Instant scroll to element with passed index
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DataList</span></span>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd> </dd>
</dl> </dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2> <h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "scroll"></a>
<strong>scroll</strong>
</dt>
<dd>
The Druid scroll component
<ul>
<li><span class="parameter">scroll</span>
<span class="types"><span class="type">druid.scroll</span></span>
</li>
</ul>
</dd>
<dt> <dt>
<a name = "grid"></a> <a name = "grid"></a>
<strong>grid</strong> <strong>grid</strong>
@ -402,28 +384,8 @@
<ul> <ul>
<li><span class="parameter">grid</span> <li><span class="parameter">grid</span>
<span class="types"><span class="type">druid.static_grid</span></span> <span class="types"><span class="type">StaticGrid</span> or <span class="type">DynamicGrid</span></span>
<a href="../modules/StaticGrid.html#">StaticGrid</a>, <a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
</dd>
<dt>
<a name = "top_index"></a>
<strong>top_index</strong>
</dt>
<dd>
The current visual top data index
<ul>
<li><span class="parameter">top_index</span>
<span class="types"><span class="type">number</span></span>
</li> </li>
</ul> </ul>
@ -451,6 +413,46 @@
</dd>
<dt>
<a name = "on_scroll_progress_change"></a>
<strong>on_scroll_progress_change</strong>
</dt>
<dd>
Event triggered when scroll progress is changed; event(self, progress_value)
<ul>
<li><span class="parameter">on_scroll_progress_change</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "scroll"></a>
<strong>scroll</strong>
</dt>
<dd>
The Druid scroll component
<ul>
<li><span class="parameter">scroll</span>
<span class="types"><span class="type">Scroll</span></span>
<a href="../modules/Scroll.html#">Scroll</a>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "scroll_progress"></a> <a name = "scroll_progress"></a>
@ -473,16 +475,16 @@
</dd> </dd>
<dt> <dt>
<a name = "on_scroll_progress_change"></a> <a name = "top_index"></a>
<strong>on_scroll_progress_change</strong> <strong>top_index</strong>
</dt> </dt>
<dd> <dd>
Event triggered when scroll progress is changed; event(self, progress_value) The current visual top data index
<ul> <ul>
<li><span class="parameter">on_scroll_progress_change</span> <li><span class="parameter">top_index</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">number</span></span>
</li> </li>
</ul> </ul>
@ -498,8 +500,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -41,29 +41,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><strong>Drag</strong></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><strong>Drag</strong></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -99,16 +101,20 @@
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#on_touch_start">on_touch_start</a></td> <td class="name" nowrap><a href="#can_x">can_x</a></td>
<td class="summary">Event on touch start callback(self)</td> <td class="summary">Is drag component process vertical dragging.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_touch_end">on_touch_end</a></td> <td class="name" nowrap><a href="#can_y">can_y</a></td>
<td class="summary">Event on touch end callback(self)</td> <td class="summary">Is drag component process horizontal.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_drag_start">on_drag_start</a></td> <td class="name" nowrap><a href="#is_drag">is_drag</a></td>
<td class="summary">Event on drag start callback(self)</td> <td class="summary">Is component now dragging</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_touch">is_touch</a></td>
<td class="summary">Is component now touching</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_drag">on_drag</a></td> <td class="name" nowrap><a href="#on_drag">on_drag</a></td>
@ -119,20 +125,20 @@
<td class="summary">Event on drag end callback(self)</td> <td class="summary">Event on drag end callback(self)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#is_touch">is_touch</a></td> <td class="name" nowrap><a href="#on_drag_start">on_drag_start</a></td>
<td class="summary">Is component now touching</td> <td class="summary">Event on drag start callback(self)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#is_drag">is_drag</a></td> <td class="name" nowrap><a href="#on_touch_end">on_touch_end</a></td>
<td class="summary">Is component now dragging</td> <td class="summary">Event on touch end callback(self)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#can_x">can_x</a></td> <td class="name" nowrap><a href="#on_touch_start">on_touch_start</a></td>
<td class="summary">Is drag component process vertical dragging.</td> <td class="summary">Event on touch start callback(self)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#can_y">can_y</a></td> <td class="name" nowrap><a href="#touch_start_pos">touch_start_pos</a></td>
<td class="summary">Is drag component process horizontal.</td> <td class="summary">Touch start position</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#x">x</a></td> <td class="name" nowrap><a href="#x">x</a></td>
@ -142,10 +148,6 @@
<td class="name" nowrap><a href="#y">y</a></td> <td class="name" nowrap><a href="#y">y</a></td>
<td class="summary">Current touch y position</td> <td class="summary">Current touch y position</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#touch_start_pos">touch_start_pos</a></td>
<td class="summary">Touch start position</td>
</tr>
</table> </table>
<br/> <br/>
@ -167,7 +169,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Drag</span></span> <span class="types"><span class="type">Drag</span></span>
<a href="../modules/Drag.html#">Drag</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span> <span class="types"><span class="type">node</span></span>
@ -197,7 +199,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Drag</span></span> <span class="types"><span class="type">Drag</span></span>
<a href="../modules/Drag.html#">Drag</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span> <span class="types"><span class="type">node</span></span>
@ -243,16 +245,16 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_touch_start"></a> <a name = "can_x"></a>
<strong>on_touch_start</strong> <strong>can_x</strong>
</dt> </dt>
<dd> <dd>
Event on touch start callback(self) Is drag component process vertical dragging. Default - true
<ul> <ul>
<li><span class="parameter">on_touch_start</span> <li><span class="parameter">can_x</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">bool</span></span>
</li> </li>
</ul> </ul>
@ -263,95 +265,15 @@
</dd> </dd>
<dt> <dt>
<a name = "on_touch_end"></a> <a name = "can_y"></a>
<strong>on_touch_end</strong> <strong>can_y</strong>
</dt> </dt>
<dd> <dd>
Event on touch end callback(self) Is drag component process horizontal. Default - true
<ul> <ul>
<li><span class="parameter">on_touch_end</span> <li><span class="parameter">can_y</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_start"></a>
<strong>on_drag_start</strong>
</dt>
<dd>
Event on drag start callback(self)
<ul>
<li><span class="parameter">on_drag_start</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag"></a>
<strong>on_drag</strong>
</dt>
<dd>
on drag progress callback(self, dx, dy)
<ul>
<li><span class="parameter">on_drag</span>
<span class="types"><span class="type">druid_event</span></span>
Event
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_end"></a>
<strong>on_drag_end</strong>
</dt>
<dd>
Event on drag end callback(self)
<ul>
<li><span class="parameter">on_drag_end</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "is_touch"></a>
<strong>is_touch</strong>
</dt>
<dd>
Is component now touching
<ul>
<li><span class="parameter">is_touch</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">bool</span></span>
</li> </li>
@ -383,15 +305,15 @@
</dd> </dd>
<dt> <dt>
<a name = "can_x"></a> <a name = "is_touch"></a>
<strong>can_x</strong> <strong>is_touch</strong>
</dt> </dt>
<dd> <dd>
Is drag component process vertical dragging. Default - true Is component now touching
<ul> <ul>
<li><span class="parameter">can_x</span> <li><span class="parameter">is_touch</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">bool</span></span>
</li> </li>
@ -403,16 +325,116 @@
</dd> </dd>
<dt> <dt>
<a name = "can_y"></a> <a name = "on_drag"></a>
<strong>can_y</strong> <strong>on_drag</strong>
</dt> </dt>
<dd> <dd>
Is drag component process horizontal. Default - true on drag progress callback(self, dx, dy)
<ul> <ul>
<li><span class="parameter">can_y</span> <li><span class="parameter">on_drag</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">DruidEvent</span></span>
Event <a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_end"></a>
<strong>on_drag_end</strong>
</dt>
<dd>
Event on drag end callback(self)
<ul>
<li><span class="parameter">on_drag_end</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_drag_start"></a>
<strong>on_drag_start</strong>
</dt>
<dd>
Event on drag start callback(self)
<ul>
<li><span class="parameter">on_drag_start</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_touch_end"></a>
<strong>on_touch_end</strong>
</dt>
<dd>
Event on touch end callback(self)
<ul>
<li><span class="parameter">on_touch_end</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_touch_start"></a>
<strong>on_touch_start</strong>
</dt>
<dd>
Event on touch start callback(self)
<ul>
<li><span class="parameter">on_touch_start</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "touch_start_pos"></a>
<strong>touch_start_pos</strong>
</dt>
<dd>
Touch start position
<ul>
<li><span class="parameter">touch_start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li> </li>
</ul> </ul>
@ -461,26 +483,6 @@
</dd>
<dt>
<a name = "touch_start_pos"></a>
<strong>touch_start_pos</strong>
</dt>
<dd>
Touch start position
<ul>
<li><span class="parameter">touch_start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd> </dd>
</dl> </dl>
@ -488,8 +490,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -39,29 +39,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><strong>DruidEvent</strong></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><strong>DruidEvent</strong></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -69,36 +71,36 @@
<div id="content"> <div id="content">
<h1>Module <code>DruidEvent</code></h1> <h1>Module <code>DruidEvent</code></h1>
<p>Lua event small library</p> <p>Druid lua event library</p>
<p></p> <p></p>
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear the all event handlers</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#initialize">initialize(self, initial_callback)</a></td> <td class="name" nowrap><a href="#initialize">initialize(self, initial_callback)</a></td>
<td class="summary">Event constructur</td> <td class="summary">Event constructur</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#subscribe">subscribe(self, callback, context)</a></td>
<td class="summary">Subscribe callback on event</td>
</tr>
<tr>
<td class="name" nowrap><a href="#unsubscribe">unsubscribe(self, callback, context)</a></td>
<td class="summary">Unsubscribe callback on event</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_exist">is_exist(self)</a></td> <td class="name" nowrap><a href="#is_exist">is_exist(self)</a></td>
<td class="summary">Return true, if event have at lease one handler</td> <td class="summary">Return true, if event have at lease one handler</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td> <td class="name" nowrap><a href="#subscribe">subscribe(self, callback, context)</a></td>
<td class="summary">Clear the all event handlers</td> <td class="summary">Subscribe callback on event</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#trigger">trigger(self, ...)</a></td> <td class="name" nowrap><a href="#trigger">trigger(self, ...)</a></td>
<td class="summary">Trigger the event and call all subscribed callbacks</td> <td class="summary">Trigger the event and call all subscribed callbacks</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#unsubscribe">unsubscribe(self, callback, context)</a></td>
<td class="summary">Unsubscribe callback on event</td>
</tr>
</table> </table>
<br/> <br/>
@ -108,6 +110,27 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear the all event handlers
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt> <dt>
<a name = "initialize"></a> <a name = "initialize"></a>
<strong>initialize(self, initial_callback)</strong> <strong>initialize(self, initial_callback)</strong>
@ -120,7 +143,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
<li><span class="parameter">initial_callback</span> <li><span class="parameter">initial_callback</span>
<span class="types"><span class="type">function</span></span> <span class="types"><span class="type">function</span></span>
@ -132,64 +155,6 @@
</dd>
<dt>
<a name = "subscribe"></a>
<strong>subscribe(self, callback, context)</strong>
</dt>
<dd>
Subscribe callback on event
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Additional context as first param to callback call
</li>
</ul>
</dd>
<dt>
<a name = "unsubscribe"></a>
<strong>unsubscribe(self, callback, context)</strong>
</dt>
<dd>
Unsubscribe callback on event
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Additional context as first param to callback call
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "is_exist"></a> <a name = "is_exist"></a>
@ -203,7 +168,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -219,18 +184,26 @@
</dd> </dd>
<dt> <dt>
<a name = "clear"></a> <a name = "subscribe"></a>
<strong>clear(self)</strong> <strong>subscribe(self, callback, context)</strong>
</dt> </dt>
<dd> <dd>
Clear the all event handlers Subscribe callback on event
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Additional context as first param to callback call
</li> </li>
</ul> </ul>
@ -251,7 +224,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
<li><span class="parameter">...</span> <li><span class="parameter">...</span>
<span class="types"><span class="type">any</span></span> <span class="types"><span class="type">any</span></span>
@ -263,6 +236,35 @@
</dd>
<dt>
<a name = "unsubscribe"></a>
<strong>unsubscribe(self, callback, context)</strong>
</dt>
<dd>
Unsubscribe callback on event
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback itself
</li>
<li><span class="parameter">context</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Additional context as first param to callback call
</li>
</ul>
</dd> </dd>
</dl> </dl>
@ -270,8 +272,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

File diff suppressed because it is too large Load Diff

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><strong>DynamicGrid</strong></li> <li><strong>DynamicGrid</strong></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -77,28 +79,20 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, parent)</a></td> <td class="name" nowrap><a href="#_get_side_vector">_get_side_vector(self, side, is_forward)</a></td>
<td class="summary">Component init function</td> <td class="summary">Return side vector to correct node shifting</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_pos">get_pos(self, index, node[, origin_index])</a></td> <td class="name" nowrap><a href="#add">add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])</a></td>
<td class="summary">Return pos for grid node index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add">add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instance=false]]])</a></td>
<td class="summary">Add new node to the grid</td> <td class="summary">Add new node to the grid</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instance=false]])</a></td> <td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Remove the item from the grid.</td> <td class="summary">Clear grid nodes array.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_size">get_size(self, border)</a></td> <td class="name" nowrap><a href="#get_all_pos">get_all_pos(self)</a></td>
<td class="summary">Return grid content size</td> <td class="summary">Return array of all node positions</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_offset">get_offset(self)</a></td>
<td class="summary">Return DynamicGrid offset, where DynamicGrid content starts.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_borders">get_borders(self)</a></td> <td class="name" nowrap><a href="#get_borders">get_borders(self)</a></td>
@ -109,51 +103,35 @@
<td class="summary">Return grid index by node</td> <td class="summary">Return grid index by node</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_all_pos">get_all_pos(self)</a></td> <td class="name" nowrap><a href="#get_offset">get_offset(self)</a></td>
<td class="summary">Return array of all node positions</td> <td class="summary">Return DynamicGrid offset, where DynamicGrid content starts.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_pos">get_pos(self, index, node[, origin_index])</a></td>
<td class="summary">Return pos for grid node index</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_size">get_size(self, border)</a></td>
<td class="summary">Return grid content size</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, parent)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#remove">remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</a></td>
<td class="summary">Remove the item from the grid.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_position_function">set_position_function(self, callback)</a></td> <td class="name" nowrap><a href="#set_position_function">set_position_function(self, callback)</a></td>
<td class="summary">Change set position function for grid nodes.</td> <td class="summary">Change set position function for grid nodes.</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#clear">clear(self)</a></td>
<td class="summary">Clear grid nodes array.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#_get_side_vector">_get_side_vector(self, side, is_forward)</a></td>
<td class="summary">Return side vector to correct node shifting</td>
</tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#on_add_item">on_add_item</a></td> <td class="name" nowrap><a href="#border">border</a></td>
<td class="summary">On item add callback(self, node, index)</td> <td class="summary">The size of item content</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove_item">on_remove_item</a></td>
<td class="summary">On item remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_items">on_change_items</a></td>
<td class="summary">On item add or remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_clear">on_clear</a></td>
<td class="summary">On grid clear callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_positions">on_update_positions</a></td>
<td class="summary">On update item positions callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parent">parent</a></td>
<td class="summary">Parent gui node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#nodes">nodes</a></td>
<td class="summary">List of all grid elements.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#first_index">first_index</a></td> <td class="name" nowrap><a href="#first_index">first_index</a></td>
@ -168,8 +146,32 @@
<td class="summary">Item size</td> <td class="summary">Item size</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#border">border</a></td> <td class="name" nowrap><a href="#nodes">nodes</a></td>
<td class="summary">The size of item content</td> <td class="summary">List of all grid elements.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_add_item">on_add_item</a></td>
<td class="summary">On item add callback(self, node, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_items">on_change_items</a></td>
<td class="summary">On item add or remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_clear">on_clear</a></td>
<td class="summary">On grid clear callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_remove_item">on_remove_item</a></td>
<td class="summary">On item remove callback(self, index)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_positions">on_update_positions</a></td>
<td class="summary">On update item positions callback(self)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#parent">parent</a></td>
<td class="summary">Parent gui node</td>
</tr> </tr>
</table> </table>
@ -181,22 +183,63 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "init"></a> <a name = "_get_side_vector"></a>
<strong>init(self, parent)</strong> <strong>_get_side_vector(self, side, is_forward)</strong>
</dt> </dt>
<dd> <dd>
Component init function Return side vector to correct node shifting
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
</li>
<li><span class="parameter">side</span>
</li>
<li><span class="parameter">is_forward</span>
</li>
</ul>
</dd>
<dt>
<a name = "add"></a>
<strong>add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]])</strong>
</dt>
<dd>
Add new node to the grid
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span> <span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li> </li>
<li><span class="parameter">parent</span> <li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span> <span class="types"><span class="type">node</span></span>
The gui node parent, where items will be placed Gui node
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The node position. By default add as last node
(<em>optional</em>)
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li> </li>
</ul> </ul>
@ -204,6 +247,146 @@
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear grid nodes array. GUI nodes will be not deleted!
If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.dynamic_grid</span></span>
Current grid instance
</ol>
</dd>
<dt>
<a name = "get_all_pos"></a>
<strong>get_all_pos(self)</strong>
</dt>
<dd>
Return array of all node positions
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3[]</span></span>
All grid node positions
</ol>
</dd>
<dt>
<a name = "get_borders"></a>
<strong>get_borders(self)</strong>
</dt>
<dd>
Return grid content borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content borders
</ol>
</dd>
<dt>
<a name = "get_index_by_node"></a>
<strong>get_index_by_node(self, node)</strong>
</dt>
<dd>
Return grid index by node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The gui node in the grid
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The node index
</ol>
</dd>
<dt>
<a name = "get_offset"></a>
<strong>get_offset(self)</strong>
</dt>
<dd>
Return DynamicGrid offset, where DynamicGrid content starts.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a> The DynamicGrid instance
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The DynamicGrid offset
</ol>
</dd> </dd>
<dt> <dt>
<a name = "get_pos"></a> <a name = "get_pos"></a>
@ -217,7 +400,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span> <span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li> </li>
<li><span class="parameter">index</span> <li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
@ -244,87 +427,6 @@
</dd>
<dt>
<a name = "add"></a>
<strong>add(self, node[, index[, shift_policy=SHIFT.RIGHT[, is_instance=false]]])</strong>
</dt>
<dd>
Add new node to the grid
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The node position. By default add as last node
(<em>optional</em>)
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instance</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
</dd>
<dt>
<a name = "remove"></a>
<strong>remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instance=false]])</strong>
</dt>
<dd>
Remove the item from the grid. Note that gui node will be not deleted
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The grid node index to remove
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instance</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Node</span></span>
The deleted gui node from grid
</ol>
</dd> </dd>
<dt> <dt>
<a name = "get_size"></a> <a name = "get_size"></a>
@ -338,7 +440,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span> <span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li> </li>
<li><span class="parameter">border</span> <li><span class="parameter">border</span>
<span class="types"><span class="type">vector3</span></span> <span class="types"><span class="type">vector3</span></span>
@ -358,111 +460,65 @@
</dd> </dd>
<dt> <dt>
<a name = "get_offset"></a> <a name = "init"></a>
<strong>get_offset(self)</strong> <strong>init(self, parent)</strong>
</dt> </dt>
<dd> <dd>
Return DynamicGrid offset, where DynamicGrid content starts. Component init function
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span> <span class="types"><span class="type">DynamicGrid</span></span>
The DynamicGrid instance <a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li> </li>
</ul> <li><span class="parameter">parent</span>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The DynamicGrid offset
</ol>
</dd>
<dt>
<a name = "get_borders"></a>
<strong>get_borders(self)</strong>
</dt>
<dd>
Return grid content borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
The grid content borders
</ol>
</dd>
<dt>
<a name = "get_index_by_node"></a>
<strong>get_index_by_node(self, node)</strong>
</dt>
<dd>
Return grid index by node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span> <span class="types"><span class="type">node</span></span>
The gui node in the grid The gui node parent, where items will be placed
</li> </li>
</ul> </ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The node index
</ol>
</dd> </dd>
<dt> <dt>
<a name = "get_all_pos"></a> <a name = "remove"></a>
<strong>get_all_pos(self)</strong> <strong>remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]])</strong>
</dt> </dt>
<dd> <dd>
Return array of all node positions Remove the item from the grid. Note that gui node will be not deleted
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span> <span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li>
<li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span>
The grid node index to remove
</li>
<li><span class="parameter">shift_policy</span>
<span class="types"><span class="type">number</span></span>
How shift nodes, if required. See const.SHIFT
(<em>default</em> SHIFT.RIGHT)
</li>
<li><span class="parameter">is_instant</span>
<span class="types"><span class="type">boolean</span></span>
If true, update node positions instantly
(<em>default</em> false)
</li> </li>
</ul> </ul>
<h3>Returns:</h3> <h3>Returns:</h3>
<ol> <ol>
<span class="types"><span class="type">vector3[]</span></span> <span class="types"><span class="type">node</span></span>
All grid node positions The deleted gui node from grid
</ol> </ol>
@ -482,7 +538,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span> <span class="types"><span class="type">DynamicGrid</span></span>
<a href="../modules/DynamicGrid.html#">DynamicGrid</a>
</li> </li>
<li><span class="parameter">callback</span> <li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span> <span class="types"><span class="type">function</span></span>
@ -500,196 +556,22 @@
</dd>
<dt>
<a name = "clear"></a>
<strong>clear(self)</strong>
</dt>
<dd>
Clear grid nodes array. GUI nodes will be not deleted!
If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">DynamicGrid</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.dynamic_grid</span></span>
Current grid instance
</ol>
</dd>
<dt>
<a name = "_get_side_vector"></a>
<strong>_get_side_vector(self, side, is_forward)</strong>
</dt>
<dd>
Return side vector to correct node shifting
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
</li>
<li><span class="parameter">side</span>
</li>
<li><span class="parameter">is_forward</span>
</li>
</ul>
</dd> </dd>
</dl> </dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2> <h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_add_item"></a> <a name = "border"></a>
<strong>on_add_item</strong> <strong>border</strong>
</dt> </dt>
<dd> <dd>
On item add callback(self, node, index) The size of item content
<ul> <ul>
<li><span class="parameter">on_add_item</span> <li><span class="parameter">border</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">vector4</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_remove_item"></a>
<strong>on_remove_item</strong>
</dt>
<dd>
On item remove callback(self, index)
<ul>
<li><span class="parameter">on_remove_item</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_items"></a>
<strong>on_change_items</strong>
</dt>
<dd>
On item add or remove callback(self, index)
<ul>
<li><span class="parameter">on_change_items</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_clear"></a>
<strong>on_clear</strong>
</dt>
<dd>
On grid clear callback(self)
<ul>
<li><span class="parameter">on_clear</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_update_positions"></a>
<strong>on_update_positions</strong>
</dt>
<dd>
On update item positions callback(self)
<ul>
<li><span class="parameter">on_update_positions</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "parent"></a>
<strong>parent</strong>
</dt>
<dd>
Parent gui node
<ul>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "nodes"></a>
<strong>nodes</strong>
</dt>
<dd>
List of all grid elements. Contains from node, pos, size, pivot
<ul>
<li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span>
</li> </li>
</ul> </ul>
@ -760,16 +642,136 @@
</dd> </dd>
<dt> <dt>
<a name = "border"></a> <a name = "nodes"></a>
<strong>border</strong> <strong>nodes</strong>
</dt> </dt>
<dd> <dd>
The size of item content List of all grid elements. Contains from node, pos, size, pivot
<ul> <ul>
<li><span class="parameter">border</span> <li><span class="parameter">nodes</span>
<span class="types"><span class="type">vector4</span></span> <span class="types"><span class="type">node[]</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_add_item"></a>
<strong>on_add_item</strong>
</dt>
<dd>
On item add callback(self, node, index)
<ul>
<li><span class="parameter">on_add_item</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_items"></a>
<strong>on_change_items</strong>
</dt>
<dd>
On item add or remove callback(self, index)
<ul>
<li><span class="parameter">on_change_items</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_clear"></a>
<strong>on_clear</strong>
</dt>
<dd>
On grid clear callback(self)
<ul>
<li><span class="parameter">on_clear</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_remove_item"></a>
<strong>on_remove_item</strong>
</dt>
<dd>
On item remove callback(self, index)
<ul>
<li><span class="parameter">on_remove_item</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_update_positions"></a>
<strong>on_update_positions</strong>
</dt>
<dd>
On update item positions callback(self)
<ul>
<li><span class="parameter">on_update_positions</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "parent"></a>
<strong>parent</strong>
</dt>
<dd>
Parent gui node
<ul>
<li><span class="parameter">parent</span>
<span class="types"><span class="type">node</span></span>
</li> </li>
</ul> </ul>
@ -785,8 +787,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

427
docs/modules/Helper.html Normal file
View File

@ -0,0 +1,427 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><strong>Helper</strong></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>Helper</code></h1>
<p>Druid helper module for gui layouts</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#helper.centrate_icon_with_text">helper.centrate_icon_with_text([icon_node[, text_node[, margin=0]]])</a></td>
<td class="summary">Center two nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_nodes">helper.centrate_nodes([margin=0[, ...]])</a></td>
<td class="summary">Center several nodes nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.centrate_text_with_icon">helper.centrate_text_with_icon([text_node][, icon_node], margin)</a></td>
<td class="summary">Center two nodes.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.deprecated">helper.deprecated(message)</a></td>
<td class="summary">Show deprecated message.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_border">helper.get_border(node, offset)</a></td>
<td class="summary">Distance from node position to his borders</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_closest_stencil_node">helper.get_closest_stencil_node(node)</a></td>
<td class="summary">Return closest non inverted clipping parent node for node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.get_pivot_offset">helper.get_pivot_offset(pivot)</a></td>
<td class="summary">Get node offset for given gui pivot</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_enabled">helper.is_enabled(node)</a></td>
<td class="summary">Check if node is enabled in gui hierarchy.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_mobile">helper.is_mobile()</a></td>
<td class="summary">Check if device is mobile (Android or iOS)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#helper.is_web">helper.is_web()</a></td>
<td class="summary">Check if device is HTML5</td>
</tr>
<tr>
<td class="name" nowrap><a href="#table_to_string">table_to_string(t)</a></td>
<td class="summary">Transform table to oneline string</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "helper.centrate_icon_with_text"></a>
<strong>helper.centrate_icon_with_text([icon_node[, text_node[, margin=0]]])</strong>
</dt>
<dd>
Center two nodes.
Nodes will be center around 0 x position
icon_node will be first (at left side)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">icon_node</span>
<span class="types"><span class="type">box</span></span>
Gui box node
(<em>optional</em>)
</li>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">text</span></span>
Gui text node
(<em>optional</em>)
</li>
<li><span class="parameter">margin</span>
<span class="types"><span class="type">number</span></span>
Offset between nodes
(<em>default</em> 0)
</li>
</ul>
</dd>
<dt>
<a name = "helper.centrate_nodes"></a>
<strong>helper.centrate_nodes([margin=0[, ...]])</strong>
</dt>
<dd>
Center several nodes nodes.
Nodes will be center around 0 x position
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">margin</span>
<span class="types"><span class="type">number</span></span>
Offset between nodes
(<em>default</em> 0)
</li>
<li><span class="parameter">...</span>
<span class="types"><span class="type">Node</span></span>
Any count of gui Node
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "helper.centrate_text_with_icon"></a>
<strong>helper.centrate_text_with_icon([text_node][, icon_node], margin)</strong>
</dt>
<dd>
Center two nodes.
Nodes will be center around 0 x position
text_node will be first (at left side)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">text</span></span>
Gui text node
(<em>optional</em>)
</li>
<li><span class="parameter">icon_node</span>
<span class="types"><span class="type">box</span></span>
Gui box node
(<em>optional</em>)
</li>
<li><span class="parameter">margin</span>
<span class="types"><span class="type">number</span></span>
Offset between nodes
</li>
</ul>
</dd>
<dt>
<a name = "helper.deprecated"></a>
<strong>helper.deprecated(message)</strong>
</dt>
<dd>
Show deprecated message. Once time per message
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">message</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The deprecated message
</li>
</ul>
</dd>
<dt>
<a name = "helper.get_border"></a>
<strong>helper.get_border(node, offset)</strong>
</dt>
<dd>
Distance from node position to his borders
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
The gui node to check
</li>
<li><span class="parameter">offset</span>
<span class="types"><span class="type">vector3</span></span>
The offset to add to result
</li>
</ul>
<h3>Returns:</h3>
<ol>
vector4 Vector with distance to node border: (left, top, right, down)
</ol>
</dd>
<dt>
<a name = "helper.get_closest_stencil_node"></a>
<strong>helper.get_closest_stencil_node(node)</strong>
</dt>
<dd>
Return closest non inverted clipping parent node for node
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">node</span> or <span class="type">nil</span></span>
The clipping node
</ol>
</dd>
<dt>
<a name = "helper.get_pivot_offset"></a>
<strong>helper.get_pivot_offset(pivot)</strong>
</dt>
<dd>
Get node offset for given gui pivot
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">pivot</span>
<span class="types"><span class="type">gui.pivot</span></span>
The node pivot
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">vector3</span></span>
Vector offset with [-1..1] values
</ol>
</dd>
<dt>
<a name = "helper.is_enabled"></a>
<strong>helper.is_enabled(node)</strong>
</dt>
<dd>
Check if node is enabled in gui hierarchy.
Return false, if node or any his parent is disabled
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span>
Gui node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is enabled in hierarchy
</ol>
</dd>
<dt>
<a name = "helper.is_mobile"></a>
<strong>helper.is_mobile()</strong>
</dt>
<dd>
Check if device is mobile (Android or iOS)
</dd>
<dt>
<a name = "helper.is_web"></a>
<strong>helper.is_web()</strong>
</dt>
<dd>
Check if device is HTML5
</dd>
<dt>
<a name = "table_to_string"></a>
<strong>table_to_string(t)</strong>
</dt>
<dd>
Transform table to oneline string
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">t</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</ol>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><strong>Hover</strong></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><strong>Hover</strong></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -81,12 +83,8 @@
<td class="summary">Component init function</td> <td class="summary">Component init function</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_hover">set_hover(self, state)</a></td> <td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td>
<td class="summary">Set hover state</td> <td class="summary">Return current hover enabled state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_mouse_hover">set_mouse_hover(self, state)</a></td>
<td class="summary">Set mouse hover state</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td> <td class="name" nowrap><a href="#set_click_zone">set_click_zone(self, zone)</a></td>
@ -97,8 +95,12 @@
<td class="summary">Set enable state of hover component.</td> <td class="summary">Set enable state of hover component.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#is_enabled">is_enabled(self)</a></td> <td class="name" nowrap><a href="#set_hover">set_hover(self, state)</a></td>
<td class="summary">Return current hover enabled state</td> <td class="summary">Set hover state</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_mouse_hover">set_mouse_hover(self, state)</a></td>
<td class="summary">Set mouse hover state</td>
</tr> </tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
@ -132,7 +134,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span> <span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span> <span class="types"><span class="type">node</span></span>
@ -150,50 +152,27 @@
</dd> </dd>
<dt> <dt>
<a name = "set_hover"></a> <a name = "is_enabled"></a>
<strong>set_hover(self, state)</strong> <strong>is_enabled(self)</strong>
</dt> </dt>
<dd> <dd>
Set hover state Return current hover enabled state
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span> <span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The hover state
</li> </li>
</ul> </ul>
<h3>Returns:</h3>
<ol>
</dd>
<dt>
<a name = "set_mouse_hover"></a>
<strong>set_mouse_hover(self, state)</strong>
</dt>
<dd>
Set mouse hover state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">bool</span></span>
The mouse hover state The hover enabled state
</li> </ol>
</ul>
@ -212,7 +191,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span> <span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li> </li>
<li><span class="parameter">zone</span> <li><span class="parameter">zone</span>
<span class="types"><span class="type">node</span></span> <span class="types"><span class="type">node</span></span>
@ -239,7 +218,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span> <span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li> </li>
<li><span class="parameter">state</span> <li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">bool</span></span>
@ -253,27 +232,50 @@
</dd> </dd>
<dt> <dt>
<a name = "is_enabled"></a> <a name = "set_hover"></a>
<strong>is_enabled(self)</strong> <strong>set_hover(self, state)</strong>
</dt> </dt>
<dd> <dd>
Return current hover enabled state Set hover state
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span> <span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span>
The hover state
</li> </li>
</ul> </ul>
<h3>Returns:</h3>
<ol>
</dd>
<dt>
<a name = "set_mouse_hover"></a>
<strong>set_mouse_hover(self, state)</strong>
</dt>
<dd>
Set mouse hover state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Hover</span></span>
<a href="../modules/Hover.html#">Hover</a>
</li>
<li><span class="parameter">state</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">bool</span></span>
The hover enabled state The mouse hover state
</ol> </li>
</ul>
@ -293,8 +295,8 @@
<ul> <ul>
<li><span class="parameter">on_hover</span> <li><span class="parameter">on_hover</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -313,8 +315,8 @@
<ul> <ul>
<li><span class="parameter">on_mouse_hover</span> <li><span class="parameter">on_mouse_hover</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -329,8 +331,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -41,29 +41,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><strong>Input</strong></li> <li><strong>Input</strong></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -83,32 +85,36 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#set_text">set_text(self, input_text)</a></td> <td class="name" nowrap><a href="#get_text">get_text(self)</a></td>
<td class="summary">Set text for input field</td> <td class="summary">Return current input field text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#init">init(self, click_node, text_node[, keyboard_type])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#reset_changes">reset_changes(self)</a></td>
<td class="summary">Reset current input selection and return previous value</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#select">select(self)</a></td> <td class="name" nowrap><a href="#select">select(self)</a></td>
<td class="summary">Select input field.</td> <td class="summary">Select input field.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#unselect">unselect(self)</a></td> <td class="name" nowrap><a href="#set_allowed_characters">set_allowed_characters(self, characters)</a></td>
<td class="summary">Remove selection from input.</td> <td class="summary">Set allowed charaters for input field.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_text">get_text(self)</a></td>
<td class="summary">Return current input field text</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_max_length">set_max_length(self, max_length)</a></td> <td class="name" nowrap><a href="#set_max_length">set_max_length(self, max_length)</a></td>
<td class="summary">Set maximum length for input field.</td> <td class="summary">Set maximum length for input field.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_allowed_characters">set_allowed_characters(self, characters)</a></td> <td class="name" nowrap><a href="#set_text">set_text(self, input_text)</a></td>
<td class="summary">Set allowed charaters for input field.</td> <td class="summary">Set text for input field</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#reset_changes">reset_changes(self)</a></td> <td class="name" nowrap><a href="#unselect">unselect(self)</a></td>
<td class="summary">Reset current input selection and return previous value</td> <td class="summary">Remove selection from input.</td>
</tr> </tr>
</table> </table>
<h2><a href="#Tables">Tables</a></h2> <h2><a href="#Tables">Tables</a></h2>
@ -121,16 +127,28 @@
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#on_input_select">on_input_select</a></td> <td class="name" nowrap><a href="#allowerd_characters">allowerd_characters</a></td>
<td class="summary">On input field select callback(self, button_node)</td> <td class="summary">Pattern matching for user input</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_input_unselect">on_input_unselect</a></td> <td class="name" nowrap><a href="#button">button</a></td>
<td class="summary">On input field unselect callback(self, input_text)</td> <td class="summary">Button component</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_input_text">on_input_text</a></td> <td class="name" nowrap><a href="#is_empty">is_empty</a></td>
<td class="summary">On input field text change callback(self, input_text)</td> <td class="summary">Is current input is empty now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_selected">is_selected</a></td>
<td class="summary">Is current input selected now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#keyboard_type">keyboard_type</a></td>
<td class="summary">Gui keyboard type for input field</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_length">max_length</a></td>
<td class="summary">Max length for input text</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_input_empty">on_input_empty</a></td> <td class="name" nowrap><a href="#on_input_empty">on_input_empty</a></td>
@ -141,6 +159,18 @@
<td class="summary">On input field text change to max length string callback(self, input_text)</td> <td class="summary">On input field text change to max length string callback(self, input_text)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_input_select">on_input_select</a></td>
<td class="summary">On input field select callback(self, button_node)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_text">on_input_text</a></td>
<td class="summary">On input field text change callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_unselect">on_input_unselect</a></td>
<td class="summary">On input field unselect callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_input_wrong">on_input_wrong</a></td> <td class="name" nowrap><a href="#on_input_wrong">on_input_wrong</a></td>
<td class="summary">On trying user input with not allowed character callback(self, params, button_instance)</td> <td class="summary">On trying user input with not allowed character callback(self, params, button_instance)</td>
</tr> </tr>
@ -148,30 +178,6 @@
<td class="name" nowrap><a href="#text">text</a></td> <td class="name" nowrap><a href="#text">text</a></td>
<td class="summary">Text component</td> <td class="summary">Text component</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#button">button</a></td>
<td class="summary">Button component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_selected">is_selected</a></td>
<td class="summary">Is current input selected now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_empty">is_empty</a></td>
<td class="summary">Is current input is empty now</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_length">max_length</a></td>
<td class="summary">Max length for input text</td>
</tr>
<tr>
<td class="name" nowrap><a href="#allowerd_characters">allowerd_characters</a></td>
<td class="summary">Pattern matching for user input</td>
</tr>
<tr>
<td class="name" nowrap><a href="#keyboard_type">keyboard_type</a></td>
<td class="summary">Gui keyboard type for input field</td>
</tr>
</table> </table>
<br/> <br/>
@ -182,22 +188,79 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "set_text"></a> <a name = "get_text"></a>
<strong>set_text(self, input_text)</strong> <strong>get_text(self)</strong>
</dt> </dt>
<dd> <dd>
Set text for input field Return current input field text
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span> <span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li> </li>
<li><span class="parameter">input_text</span> </ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The string to apply for input field The current input field text
</ol>
</dd>
<dt>
<a name = "init"></a>
<strong>init(self, click_node, text_node[, keyboard_type])</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">click_node</span>
<span class="types"><span class="type">node</span></span>
Button node to enabled input component
</li>
<li><span class="parameter">text_node</span>
<span class="types"><span class="type">node</span> or <span class="type">Text</span></span>
Text node what will be changed on user input. You can pass text component instead of text node name <a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">keyboard_type</span>
<span class="types"><span class="type">number</span></span>
Gui keyboard type for input field
(<em>optional</em>)
</li>
</ul>
</dd>
<dt>
<a name = "reset_changes"></a>
<strong>reset_changes(self)</strong>
</dt>
<dd>
Reset current input selection and return previous value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li> </li>
</ul> </ul>
@ -218,7 +281,97 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span> <span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
</dd>
<dt>
<a name = "set_allowed_characters"></a>
<strong>set_allowed_characters(self, characters)</strong>
</dt>
<dd>
Set allowed charaters for input field.
See: https://defold.com/ref/stable/string/
ex: [%a%d] for alpha and numeric
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">characters</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Regulax exp. for validate user input
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "set_max_length"></a>
<strong>set_max_length(self, max_length)</strong>
</dt>
<dd>
Set maximum length for input field.
Pass nil to make input field unliminted (by default)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">max_length</span>
<span class="types"><span class="type">number</span></span>
Maximum length for input text field
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "set_text"></a>
<strong>set_text(self, input_text)</strong>
</dt>
<dd>
Set text for input field
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
<li><span class="parameter">input_text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The string to apply for input field
</li> </li>
</ul> </ul>
@ -239,120 +392,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span> <span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
</dd>
<dt>
<a name = "get_text"></a>
<strong>get_text(self)</strong>
</dt>
<dd>
Return current input field text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The current input field text
</ol>
</dd>
<dt>
<a name = "set_max_length"></a>
<strong>set_max_length(self, max_length)</strong>
</dt>
<dd>
Set maximum length for input field.
Pass nil to make input field unliminted (by default)
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li>
<li><span class="parameter">max_length</span>
<span class="types"><span class="type">number</span></span>
Maximum length for input text field
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "set_allowed_characters"></a>
<strong>set_allowed_characters(self, characters)</strong>
</dt>
<dd>
Set allowed charaters for input field.
See: https://defold.com/ref/stable/string/
ex: [%a%d] for alpha and numeric
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li>
<li><span class="parameter">characters</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Regulax exp. for validate user input
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">druid.input</span></span>
Current input instance
</ol>
</dd>
<dt>
<a name = "reset_changes"></a>
<strong>reset_changes(self)</strong>
</dt>
<dd>
Reset current input selection and return previous value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Input</span></span>
</li> </li>
</ul> </ul>
@ -420,137 +460,18 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_input_select"></a> <a name = "allowerd_characters"></a>
<strong>on_input_select</strong> <strong>allowerd_characters</strong>
</dt> </dt>
<dd> <dd>
On input field select callback(self, button_node) Pattern matching for user input
<ul> <ul>
<li><span class="parameter">on_input_select</span> <li><span class="parameter">allowerd_characters</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_unselect"></a>
<strong>on_input_unselect</strong>
</dt>
<dd>
On input field unselect callback(self, input_text)
<ul>
<li><span class="parameter">on_input_unselect</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_text"></a>
<strong>on_input_text</strong>
</dt>
<dd>
On input field text change callback(self, input_text)
<ul>
<li><span class="parameter">on_input_text</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_empty"></a>
<strong>on_input_empty</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">on_input_empty</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_full"></a>
<strong>on_input_full</strong>
</dt>
<dd>
On input field text change to max length string callback(self, input_text)
<ul>
<li><span class="parameter">on_input_full</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_wrong"></a>
<strong>on_input_wrong</strong>
</dt>
<dd>
On trying user input with not allowed character callback(self, params, button_instance)
<ul>
<li><span class="parameter">on_input_wrong</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "text"></a>
<strong>text</strong>
</dt>
<dd>
Text component
<ul>
<li><span class="parameter">text</span>
<span class="types"><span class="type">druid.text</span></span>
(<em>optional</em>)
</li> </li>
</ul> </ul>
@ -569,7 +490,27 @@
<ul> <ul>
<li><span class="parameter">button</span> <li><span class="parameter">button</span>
<span class="types"><span class="type">druid.button</span></span> <span class="types"><span class="type">Button</span></span>
<a href="../modules/Button.html#">Button</a>
</li>
</ul>
</dd>
<dt>
<a name = "is_empty"></a>
<strong>is_empty</strong>
</dt>
<dd>
Is current input is empty now
<ul>
<li><span class="parameter">is_empty</span>
<span class="types"><span class="type">bool</span></span>
</li> </li>
</ul> </ul>
@ -600,16 +541,16 @@
</dd> </dd>
<dt> <dt>
<a name = "is_empty"></a> <a name = "keyboard_type"></a>
<strong>is_empty</strong> <strong>keyboard_type</strong>
</dt> </dt>
<dd> <dd>
Is current input is empty now Gui keyboard type for input field
<ul> <ul>
<li><span class="parameter">is_empty</span> <li><span class="parameter">keyboard_type</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">number</span></span>
</li> </li>
</ul> </ul>
@ -641,18 +582,17 @@
</dd> </dd>
<dt> <dt>
<a name = "allowerd_characters"></a> <a name = "on_input_empty"></a>
<strong>allowerd_characters</strong> <strong>on_input_empty</strong>
</dt> </dt>
<dd> <dd>
Pattern matching for user input On input field text change to empty string callback(self, input_text)
<ul> <ul>
<li><span class="parameter">allowerd_characters</span> <li><span class="parameter">on_input_empty</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
(<em>optional</em>)
</li> </li>
</ul> </ul>
@ -662,17 +602,117 @@
</dd> </dd>
<dt> <dt>
<a name = "keyboard_type"></a> <a name = "on_input_full"></a>
<strong>keyboard_type</strong> <strong>on_input_full</strong>
</dt> </dt>
<dd> <dd>
Gui keyboard type for input field On input field text change to max length string callback(self, input_text)
<ul> <ul>
<li><span class="parameter">keyboard_type</span> <li><span class="parameter">on_input_full</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_select"></a>
<strong>on_input_select</strong>
</dt>
<dd>
On input field select callback(self, button_node)
<ul>
<li><span class="parameter">on_input_select</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_text"></a>
<strong>on_input_text</strong>
</dt>
<dd>
On input field text change callback(self, input_text)
<ul>
<li><span class="parameter">on_input_text</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_unselect"></a>
<strong>on_input_unselect</strong>
</dt>
<dd>
On input field unselect callback(self, input_text)
<ul>
<li><span class="parameter">on_input_unselect</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_input_wrong"></a>
<strong>on_input_wrong</strong>
</dt>
<dd>
On trying user input with not allowed character callback(self, params, button_instance)
<ul>
<li><span class="parameter">on_input_wrong</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "text"></a>
<strong>text</strong>
</dt>
<dd>
Text component
<ul>
<li><span class="parameter">text</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li> </li>
</ul> </ul>
@ -687,8 +727,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><strong>LangText</strong></li> <li><strong>LangText</strong></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -77,6 +79,10 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#format">format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]])</a></td>
<td class="summary">Format string with new text params on localized text</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, node, locale_id, no_adjust)</a></td> <td class="name" nowrap><a href="#init">init(self, node, locale_id, no_adjust)</a></td>
<td class="summary">Component init function</td> <td class="summary">Component init function</td>
@ -86,13 +92,9 @@
<td class="summary">Setup raw text to lang_text component</td> <td class="summary">Setup raw text to lang_text component</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#translate">translate(self, locale_id, ...)</a></td> <td class="name" nowrap><a href="#translate">translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]])</a></td>
<td class="summary">Translate the text by locale_id</td> <td class="summary">Translate the text by locale_id</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#format">format(self, ...)</a></td>
<td class="summary">Format string with new text params on localized text</td>
</tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
@ -113,6 +115,68 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "format"></a>
<strong>format(self[, a[, b[, c[, d[, e[, f[, g]]]]]]])</strong>
</dt>
<dd>
Format string with new text params on localized text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li>
<li><span class="parameter">a</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">b</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">c</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">d</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">e</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">f</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">g</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</dd>
<dt> <dt>
<a name = "init"></a> <a name = "init"></a>
<strong>init(self, node, locale_id, no_adjust)</strong> <strong>init(self, node, locale_id, no_adjust)</strong>
@ -125,7 +189,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span> <span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><span class="type">node</span></span> <span class="types"><span class="type">node</span></span>
@ -158,7 +222,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span> <span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li> </li>
<li><span class="parameter">text</span> <li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
@ -179,7 +243,7 @@
</dd> </dd>
<dt> <dt>
<a name = "translate"></a> <a name = "translate"></a>
<strong>translate(self, locale_id, ...)</strong> <strong>translate(self, locale_id[, a[, b[, c[, d[, e[, f[, g]]]]]]])</strong>
</dt> </dt>
<dd> <dd>
Translate the text by locale_id Translate the text by locale_id
@ -189,46 +253,46 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span> <span class="types"><span class="type">LangText</span></span>
<a href="../modules/LangText.html#">LangText</a>
</li> </li>
<li><span class="parameter">locale_id</span> <li><span class="parameter">locale_id</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Locale id Locale id
</li> </li>
<li><span class="parameter">...</span> <li><span class="parameter">a</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Locale arguments to pass in text function Optional param to string.format
(<em>optional</em>)
</li> </li>
</ul> <li><span class="parameter">b</span>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">LangText</span></span>
Current instance
</ol>
</dd>
<dt>
<a name = "format"></a>
<strong>format(self, ...)</strong>
</dt>
<dd>
Format string with new text params on localized text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">LangText</span></span>
</li>
<li><span class="parameter">...</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Locale arguments to pass in text function Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">c</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">d</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">e</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">f</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li>
<li><span class="parameter">g</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Optional param to string.format
(<em>optional</em>)
</li> </li>
</ul> </ul>
@ -257,8 +321,8 @@
<ul> <ul>
<li><span class="parameter">on_change</span> <li><span class="parameter">on_change</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -278,7 +342,7 @@
<ul> <ul>
<li><span class="parameter">text</span> <li><span class="parameter">text</span>
<span class="types"><span class="type">Text</span></span> <span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li> </li>
</ul> </ul>
@ -293,8 +357,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

297
docs/modules/PinKnob.html Normal file
View File

@ -0,0 +1,297 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><strong>PinKnob</strong></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>PinKnob</code></h1>
<p>Druid pin knob custom component.</p>
<p>
It's simple rotating input element</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, callback, template, nodes)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_angle">set_angle(self, cur_value, min, max)</a></td>
<td class="summary">Set current and min/max angles for component</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_friction">set_friction(self[, value=1])</a></td>
<td class="summary">Set current and min/max angles for component</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#druid">druid</a></td>
<td class="summary">The component druid instance</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_drag">is_drag</a></td>
<td class="summary">Is currently under user control</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">The pin node</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, callback, template, nodes)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Callback(self, value) on value changed
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The template string name
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Nodes table from gui.clone_tree
</li>
</ul>
</dd>
<dt>
<a name = "set_angle"></a>
<strong>set_angle(self, cur_value, min, max)</strong>
</dt>
<dd>
Set current and min/max angles for component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</li>
<li><span class="parameter">cur_value</span>
<span class="types"><span class="type">number</span></span>
The new value for pin knob
</li>
<li><span class="parameter">min</span>
<span class="types"><span class="type">number</span></span>
The minimum value for pin knob
</li>
<li><span class="parameter">max</span>
<span class="types"><span class="type">number</span></span>
The maximum value for pin knob
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</ol>
</dd>
<dt>
<a name = "set_friction"></a>
<strong>set_friction(self[, value=1])</strong>
</dt>
<dd>
Set current and min/max angles for component
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</li>
<li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span>
The spin speed multiplier
(<em>default</em> 1)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">PinKnob</span></span>
<a href="../modules/PinKnob.html#">PinKnob</a>
</ol>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "druid"></a>
<strong>druid</strong>
</dt>
<dd>
The component druid instance
<ul>
<li><span class="parameter">druid</span>
<span class="types"><span class="type">DruidInstance</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</li>
</ul>
</dd>
<dt>
<a name = "is_drag"></a>
<strong>is_drag</strong>
</dt>
<dd>
Is currently under user control
<ul>
<li><span class="parameter">is_drag</span>
<span class="types"><span class="type">bool</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
The pin node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/PinKnob.html#node">node</a></span>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@ -41,29 +41,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><strong>Progress</strong></li> <li><strong>Progress</strong></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -79,30 +81,30 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, node, key[, init_value=1])</a></td> <td class="name" nowrap><a href="#empty">empty(self)</a></td>
<td class="summary">Component init function</td> <td class="summary">Empty a progress bar</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#fill">fill(self)</a></td> <td class="name" nowrap><a href="#fill">fill(self)</a></td>
<td class="summary">Fill a progress bar and stop progress animation</td> <td class="summary">Fill a progress bar and stop progress animation</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#empty">empty(self)</a></td>
<td class="summary">Empty a progress bar</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, to)</a></td>
<td class="summary">Instant fill progress bar to value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get">get(self)</a></td> <td class="name" nowrap><a href="#get">get(self)</a></td>
<td class="summary">Return current progress bar value</td> <td class="summary">Return current progress bar value</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, node, key[, init_value=1])</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_steps">set_steps(self, steps, callback)</a></td> <td class="name" nowrap><a href="#set_steps">set_steps(self, steps, callback)</a></td>
<td class="summary">Set points on progress bar to fire the callback</td> <td class="summary">Set points on progress bar to fire the callback</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_to">set_to(self, to)</a></td>
<td class="summary">Instant fill progress bar to value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#to">to(self, to[, callback])</a></td> <td class="name" nowrap><a href="#to">to(self, to[, callback])</a></td>
<td class="summary">Start animation of a progress bar</td> <td class="summary">Start animation of a progress bar</td>
</tr> </tr>
@ -117,16 +119,20 @@
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#on_change">on_change</a></td> <td class="name" nowrap><a href="#key">key</a></td>
<td class="summary">On progress bar change callback(self, new_value)</td> <td class="summary">The progress bar direction</td>
</tr>
<tr>
<td class="name" nowrap><a href="#max_size">max_size</a></td>
<td class="summary">Maximum size of progress bar</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#node">node</a></td> <td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Progress bar fill node</td> <td class="summary">Progress bar fill node</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#key">key</a></td> <td class="name" nowrap><a href="#on_change">on_change</a></td>
<td class="summary">The progress bar direction</td> <td class="summary">On progress bar change callback(self, new_value)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#scale">scale</a></td> <td class="name" nowrap><a href="#scale">scale</a></td>
@ -137,10 +143,6 @@
<td class="summary">Current progress bar size</td> <td class="summary">Current progress bar size</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#max_size">max_size</a></td>
<td class="summary">Maximum size of progress bar</td>
</tr>
<tr>
<td class="name" nowrap><a href="#slice">slice</a></td> <td class="name" nowrap><a href="#slice">slice</a></td>
<td class="summary">Progress bar slice9 settings</td> <td class="summary">Progress bar slice9 settings</td>
</tr> </tr>
@ -153,6 +155,69 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "empty"></a>
<strong>empty(self)</strong>
</dt>
<dd>
Empty a progress bar
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
</ul>
</dd>
<dt>
<a name = "fill"></a>
<strong>fill(self)</strong>
</dt>
<dd>
Fill a progress bar and stop progress animation
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
</ul>
</dd>
<dt>
<a name = "get"></a>
<strong>get(self)</strong>
</dt>
<dd>
Return current progress bar value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
</ul>
</dd>
<dt> <dt>
<a name = "init"></a> <a name = "init"></a>
<strong>init(self, node, key[, init_value=1])</strong> <strong>init(self, node, key[, init_value=1])</strong>
@ -165,7 +230,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span> <span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/Progress.html#node">node</a></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a> or <a class="type" href="../modules/Progress.html#node">node</a></span>
@ -186,94 +251,6 @@
</dd>
<dt>
<a name = "fill"></a>
<strong>fill(self)</strong>
</dt>
<dd>
Fill a progress bar and stop progress animation
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "empty"></a>
<strong>empty(self)</strong>
</dt>
<dd>
Empty a progress bar
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, to)</strong>
</dt>
<dd>
Instant fill progress bar to value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Progress bar value, from 0 to 1
</li>
</ul>
</dd>
<dt>
<a name = "get"></a>
<strong>get(self)</strong>
</dt>
<dd>
Return current progress bar value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "set_steps"></a> <a name = "set_steps"></a>
@ -287,7 +264,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span> <span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li> </li>
<li><span class="parameter">steps</span> <li><span class="parameter">steps</span>
<span class="types"><span class="type">number[]</span></span> <span class="types"><span class="type">number[]</span></span>
@ -307,6 +284,31 @@
<pre class="example">progress:set_steps({<span class="number">0</span>, <span class="number">0.3</span>, <span class="number">0.6</span>, <span class="number">1</span>}, <span class="keyword">function</span>(self, step) <span class="keyword">end</span>)</pre> <pre class="example">progress:set_steps({<span class="number">0</span>, <span class="number">0.3</span>, <span class="number">0.6</span>, <span class="number">1</span>}, <span class="keyword">function</span>(self, step) <span class="keyword">end</span>)</pre>
</ul> </ul>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, to)</strong>
</dt>
<dd>
Instant fill progress bar to value
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Progress bar value, from 0 to 1
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "to"></a> <a name = "to"></a>
@ -320,7 +322,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Progress</span></span> <span class="types"><span class="type">Progress</span></span>
<a href="../modules/Progress.html#">Progress</a>
</li> </li>
<li><span class="parameter">to</span> <li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
@ -376,16 +378,36 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_change"></a> <a name = "key"></a>
<strong>on_change</strong> <strong>key</strong>
</dt> </dt>
<dd> <dd>
On progress bar change callback(self, new_value) The progress bar direction
<ul> <ul>
<li><span class="parameter">on_change</span> <li><span class="parameter">key</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "max_size"></a>
<strong>max_size</strong>
</dt>
<dd>
Maximum size of progress bar
<ul>
<li><span class="parameter">max_size</span>
<span class="types"><span class="type">number</span></span>
</li> </li>
</ul> </ul>
@ -416,17 +438,17 @@
</dd> </dd>
<dt> <dt>
<a name = "key"></a> <a name = "on_change"></a>
<strong>key</strong> <strong>on_change</strong>
</dt> </dt>
<dd> <dd>
The progress bar direction On progress bar change callback(self, new_value)
<ul> <ul>
<li><span class="parameter">key</span> <li><span class="parameter">on_change</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -474,26 +496,6 @@
</dd>
<dt>
<a name = "max_size"></a>
<strong>max_size</strong>
</dt>
<dd>
Maximum size of progress bar
<ul>
<li><span class="parameter">max_size</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "slice"></a> <a name = "slice"></a>
@ -521,8 +523,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><strong>RadioGroup</strong></li> <li><strong>RadioGroup</strong></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -76,6 +78,10 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return radio group state</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, nodes, callback[, click_nodes=node])</a></td> <td class="name" nowrap><a href="#init">init(self, nodes, callback[, click_nodes=node])</a></td>
<td class="summary">Component init function</td> <td class="summary">Component init function</td>
@ -84,21 +90,17 @@
<td class="name" nowrap><a href="#set_state">set_state(self, index, is_instant)</a></td> <td class="name" nowrap><a href="#set_state">set_state(self, index, is_instant)</a></td>
<td class="summary">Set radio group state</td> <td class="summary">Set radio group state</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#get_state">get_state(self)</a></td>
<td class="summary">Return radio group state</td>
</tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#on_radio_click">on_radio_click</a></td>
<td class="summary">On any checkbox click</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#checkboxes">checkboxes</a></td> <td class="name" nowrap><a href="#checkboxes">checkboxes</a></td>
<td class="summary">Array of checkbox components</td> <td class="summary">Array of checkbox components</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#on_radio_click">on_radio_click</a></td>
<td class="summary">On any checkbox click</td>
</tr>
</table> </table>
<br/> <br/>
@ -108,6 +110,33 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return radio group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Index in radio group
</ol>
</dd>
<dt> <dt>
<a name = "init"></a> <a name = "init"></a>
<strong>init(self, nodes, callback[, click_nodes=node])</strong> <strong>init(self, nodes, callback[, click_nodes=node])</strong>
@ -120,7 +149,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span> <span class="types"><span class="type">RadioGroup</span></span>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li> </li>
<li><span class="parameter">nodes</span> <li><span class="parameter">nodes</span>
<span class="types"><span class="type">node[]</span></span> <span class="types"><span class="type">node[]</span></span>
@ -154,7 +183,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span> <span class="types"><span class="type">RadioGroup</span></span>
<a href="../modules/RadioGroup.html#">RadioGroup</a>
</li> </li>
<li><span class="parameter">index</span> <li><span class="parameter">index</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
@ -170,58 +199,11 @@
</dd>
<dt>
<a name = "get_state"></a>
<strong>get_state(self)</strong>
</dt>
<dd>
Return radio group state
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RadioGroup</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
Index in radio group
</ol>
</dd> </dd>
</dl> </dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2> <h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "on_radio_click"></a>
<strong>on_radio_click</strong>
</dt>
<dd>
On any checkbox click
<ul>
<li><span class="parameter">on_radio_click</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt> <dt>
<a name = "checkboxes"></a> <a name = "checkboxes"></a>
<strong>checkboxes</strong> <strong>checkboxes</strong>
@ -241,6 +223,26 @@
</dd>
<dt>
<a name = "on_radio_click"></a>
<strong>on_radio_click</strong>
</dt>
<dd>
On any checkbox click
<ul>
<li><span class="parameter">on_radio_click</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd> </dd>
</dl> </dl>
@ -248,8 +250,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

267
docs/modules/RichInput.html Normal file
View File

@ -0,0 +1,267 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<head>
<title>Defold Druid UI Library</title>
<link rel="stylesheet" href="../ldoc_fixed.css" type="text/css" />
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<!-- Menu -->
<div id="navigation">
<br/>
<h1>Druid</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><strong>RichInput</strong></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.html">druid</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>RichInput</code></h1>
<p>Druid Rich Input custom component.</p>
<p>
It's wrapper on Input component with cursor and placeholder text</p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#init">init(self, template, nodes)</a></td>
<td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_placeholder">set_placeholder(self, placeholder_text)</a></td>
<td class="summary">Set placeholder text</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#cursor">cursor</a></td>
<td class="summary">On input field text change to empty string callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#druid">druid</a></td>
<td class="summary">The component druid instance</td>
</tr>
<tr>
<td class="name" nowrap><a href="#input">input</a></td>
<td class="summary">On input field text change callback(self, input_text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#placeholder">placeholder</a></td>
<td class="summary">On input field text change to max length string callback(self, input_text)</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "init"></a>
<strong>init(self, template, nodes)</strong>
</dt>
<dd>
Component init function
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RichInput</span></span>
<a href="../modules/RichInput.html#">RichInput</a>
</li>
<li><span class="parameter">template</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The template string name
</li>
<li><span class="parameter">nodes</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
Nodes table from gui.clone_tree
</li>
</ul>
</dd>
<dt>
<a name = "set_placeholder"></a>
<strong>set_placeholder(self, placeholder_text)</strong>
</dt>
<dd>
Set placeholder text
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">RichInput</span></span>
<a href="../modules/RichInput.html#">RichInput</a>
</li>
<li><span class="parameter">placeholder_text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
The placeholder text
</li>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "cursor"></a>
<strong>cursor</strong>
</dt>
<dd>
On input field text change to empty string callback(self, input_text)
<ul>
<li><span class="parameter">cursor</span>
<span class="types"><span class="type">node</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "druid"></a>
<strong>druid</strong>
</dt>
<dd>
The component druid instance
<ul>
<li><span class="parameter">druid</span>
<span class="types"><span class="type">DruidInstance</span></span>
<a href="../modules/DruidInstance.html#">DruidInstance</a>
</li>
</ul>
</dd>
<dt>
<a name = "input"></a>
<strong>input</strong>
</dt>
<dd>
On input field text change callback(self, input_text)
<ul>
<li><span class="parameter">input</span>
<span class="types"><span class="type">Input</span></span>
<a href="../modules/Input.html#">Input</a>
</li>
</ul>
</dd>
<dt>
<a name = "placeholder"></a>
<strong>placeholder</strong>
</dt>
<dd>
On input field text change to max length string callback(self, input_text)
<ul>
<li><span class="parameter">placeholder</span>
<span class="types"><span class="type">druid.text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc TESTING</a></i>
<i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><strong>Slider</strong></li> <li><strong>Slider</strong></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -85,6 +87,10 @@
<td class="summary">Set value for slider</td> <td class="summary">Set value for slider</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_input_node">set_input_node(self, input_node)</a></td>
<td class="summary">Set input zone for slider.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_steps">set_steps(self, steps)</a></td> <td class="name" nowrap><a href="#set_steps">set_steps(self, steps)</a></td>
<td class="summary">Set slider steps.</td> <td class="summary">Set slider steps.</td>
</tr> </tr>
@ -92,38 +98,38 @@
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#on_change_value">on_change_value</a></td> <td class="name" nowrap><a href="#dist">dist</a></td>
<td class="summary">On change value callback(self, value)</td> <td class="summary">Length between start and end position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Slider pin node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Start pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Current pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#target_pos">target_pos</a></td>
<td class="summary">Targer pin node position</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#end_pos">end_pos</a></td> <td class="name" nowrap><a href="#end_pos">end_pos</a></td>
<td class="summary">End pin node position</td> <td class="summary">End pin node position</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#dist">dist</a></td>
<td class="summary">Length between start and end position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#is_drag">is_drag</a></td> <td class="name" nowrap><a href="#is_drag">is_drag</a></td>
<td class="summary">Current drag state</td> <td class="summary">Current drag state</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Slider pin node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_change_value">on_change_value</a></td>
<td class="summary">On change value callback(self, value)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Current pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_pos">start_pos</a></td>
<td class="summary">Start pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#target_pos">target_pos</a></td>
<td class="summary">Targer pin node position</td>
</tr>
<tr>
<td class="name" nowrap><a href="#value">value</a></td> <td class="name" nowrap><a href="#value">value</a></td>
<td class="summary">Current slider value</td> <td class="summary">Current slider value</td>
</tr> </tr>
@ -148,7 +154,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span> <span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span> <span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
@ -182,7 +188,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span> <span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li> </li>
<li><span class="parameter">value</span> <li><span class="parameter">value</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
@ -199,6 +205,40 @@
</dd>
<dt>
<a name = "set_input_node"></a>
<strong>set_input_node(self, input_node)</strong>
</dt>
<dd>
Set input zone for slider.
User can touch any place of node, pin instantly will
move at this position and node drag will start.
This function require the Defold version 1.3.0+
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li>
<li><span class="parameter">input_node</span>
<span class="types"><span class="type">Node</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</ol>
</dd> </dd>
<dt> <dt>
<a name = "set_steps"></a> <a name = "set_steps"></a>
@ -213,7 +253,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Slider</span></span> <span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</li> </li>
<li><span class="parameter">steps</span> <li><span class="parameter">steps</span>
<span class="types"><span class="type">number[]</span></span> <span class="types"><span class="type">number[]</span></span>
@ -221,6 +261,12 @@
</li> </li>
</ul> </ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Slider</span></span>
<a href="../modules/Slider.html#">Slider</a>
</ol>
@ -235,96 +281,16 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_change_value"></a> <a name = "dist"></a>
<strong>on_change_value</strong> <strong>dist</strong>
</dt> </dt>
<dd> <dd>
On change value callback(self, value) Length between start and end position
<ul> <ul>
<li><span class="parameter">on_change_value</span> <li><span class="parameter">dist</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Slider pin node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_pos"></a>
<strong>start_pos</strong>
</dt>
<dd>
Start pin node position
<ul>
<li><span class="parameter">start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Current pin node position
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "target_pos"></a>
<strong>target_pos</strong>
</dt>
<dd>
Targer pin node position
<ul>
<li><span class="parameter">target_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li> </li>
</ul> </ul>
@ -353,26 +319,6 @@
</dd>
<dt>
<a name = "dist"></a>
<strong>dist</strong>
</dt>
<dd>
Length between start and end position
<ul>
<li><span class="parameter">dist</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "is_drag"></a> <a name = "is_drag"></a>
@ -393,6 +339,106 @@
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Slider pin node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Slider.html#node">node</a></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_change_value"></a>
<strong>on_change_value</strong>
</dt>
<dd>
On change value callback(self, value)
<ul>
<li><span class="parameter">on_change_value</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "pos"></a>
<strong>pos</strong>
</dt>
<dd>
Current pin node position
<ul>
<li><span class="parameter">pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "start_pos"></a>
<strong>start_pos</strong>
</dt>
<dd>
Start pin node position
<ul>
<li><span class="parameter">start_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "target_pos"></a>
<strong>target_pos</strong>
</dt>
<dd>
Targer pin node position
<ul>
<li><span class="parameter">target_pos</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "value"></a> <a name = "value"></a>
@ -420,8 +466,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

File diff suppressed because it is too large Load Diff

View File

@ -41,29 +41,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><strong>Swipe</strong></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><strong>Swipe</strong></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -97,17 +99,17 @@
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Swipe node</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#click_zone">click_zone</a></td> <td class="name" nowrap><a href="#click_zone">click_zone</a></td>
<td class="summary">Restriction zone</td> <td class="summary">Restriction zone</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Swipe node</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_swipe">on_swipe</a></td> <td class="name" nowrap><a href="#on_swipe">on_swipe</a></td>
<td class="summary">Trigger on swipe event(self, swipe_side, dist, delta_time</td> <td class="summary">Trigger on swipe event(self, swipe_side, dist, delta_time)</td>
</tr> </tr>
</table> </table>
@ -130,7 +132,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Swipe</span></span> <span class="types"><span class="type">Swipe</span></span>
<a href="../modules/Swipe.html#">Swipe</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span> <span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
@ -160,7 +162,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Swipe</span></span> <span class="types"><span class="type">Swipe</span></span>
<a href="../modules/Swipe.html#">Swipe</a>
</li> </li>
<li><span class="parameter">zone</span> <li><span class="parameter">zone</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span> <span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
@ -215,26 +217,6 @@
<h2 class="section-header "><a name="Fields"></a>Fields</h2> <h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Swipe node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
</li>
</ul>
</dd>
<dt> <dt>
<a name = "click_zone"></a> <a name = "click_zone"></a>
<strong>click_zone</strong> <strong>click_zone</strong>
@ -255,19 +237,39 @@
</dd>
<dt>
<a name = "node"></a>
<strong>node</strong>
</dt>
<dd>
Swipe node
<ul>
<li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Swipe.html#node">node</a></span>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "on_swipe"></a> <a name = "on_swipe"></a>
<strong>on_swipe</strong> <strong>on_swipe</strong>
</dt> </dt>
<dd> <dd>
Trigger on swipe event(self, swipe_side, dist, delta_time Trigger on swipe event(self, swipe_side, dist, delta_time)
<ul> <ul>
<li><span class="parameter">on_swipe</span> <li><span class="parameter">on_swipe</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">DruidEvent</span></span>
) ) <a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -282,8 +284,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -41,29 +41,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><strong>Text</strong></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><strong>Text</strong></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -80,48 +82,48 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#init">init(self, node[, value[, adjust_type=0]])</a></td> <td class="name" nowrap><a href="#get_text_adjust">get_text_adjust(self, adjust_type)</a></td>
<td class="summary">Component init function</td> <td class="summary">Return current text adjust type</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_text_width">get_text_width(self[, text])</a></td> <td class="name" nowrap><a href="#get_text_size">get_text_size(self[, text])</a></td>
<td class="summary">Calculate text width with font with respect to trailing space</td> <td class="summary">Calculate text width with font with respect to trailing space</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_to">set_to(self, set_to)</a></td> <td class="name" nowrap><a href="#init">init(self, node[, value[, adjust_type=0]])</a></td>
<td class="summary">Set text to text field</td> <td class="summary">Component init function</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_color">set_color(self, color)</a></td>
<td class="summary">Set color</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_alpha">set_alpha(self, alpha)</a></td>
<td class="summary">Set alpha</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_scale">set_scale(self, scale)</a></td>
<td class="summary">Set scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_pivot">set_pivot(self, pivot)</a></td>
<td class="summary">Set text pivot.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#is_multiline">is_multiline(self)</a></td> <td class="name" nowrap><a href="#is_multiline">is_multiline(self)</a></td>
<td class="summary">Return true, if text with line break</td> <td class="summary">Return true, if text with line break</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_text_adjust">set_text_adjust(self[, adjust_type[, minimal_scale]])</a></td> <td class="name" nowrap><a href="#set_alpha">set_alpha(self, alpha)</a></td>
<td class="summary">Set text adjust, refresh the current text visuals, if needed</td> <td class="summary">Set alpha</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_color">set_color(self, color)</a></td>
<td class="summary">Set color</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_minimal_scale">set_minimal_scale(self, minimal_scale)</a></td> <td class="name" nowrap><a href="#set_minimal_scale">set_minimal_scale(self, minimal_scale)</a></td>
<td class="summary">Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types</td> <td class="summary">Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#get_text_adjust">get_text_adjust(self, adjust_type)</a></td> <td class="name" nowrap><a href="#set_pivot">set_pivot(self, pivot)</a></td>
<td class="summary">Return current text adjust type</td> <td class="summary">Set text pivot.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_scale">set_scale(self, scale)</a></td>
<td class="summary">Set scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text_adjust">set_text_adjust(self[, adjust_type[, minimal_scale]])</a></td>
<td class="summary">Set text adjust, refresh the current text visuals, if needed</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_to">set_to(self, set_to)</a></td>
<td class="summary">Set text to text field</td>
</tr> </tr>
</table> </table>
<h2><a href="#Tables">Tables</a></h2> <h2><a href="#Tables">Tables</a></h2>
@ -134,16 +136,12 @@
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#on_set_text">on_set_text</a></td> <td class="name" nowrap><a href="#adjust_type">adjust_type</a></td>
<td class="summary">On set text callback(self, text)</td> <td class="summary">Current text size adjust settings</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_update_text_scale">on_update_text_scale</a></td> <td class="name" nowrap><a href="#color">color</a></td>
<td class="summary">On adjust text size callback(self, new_scale)</td> <td class="summary">Current text color</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_set_pivot">on_set_pivot</a></td>
<td class="summary">On change pivot callback(self, pivot)</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#node">node</a></td> <td class="name" nowrap><a href="#node">node</a></td>
@ -154,18 +152,30 @@
<td class="summary">The node id of text node</td> <td class="summary">The node id of text node</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_set_pivot">on_set_pivot</a></td>
<td class="summary">On change pivot callback(self, pivot)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_set_text">on_set_text</a></td>
<td class="summary">On set text callback(self, text)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_update_text_scale">on_update_text_scale</a></td>
<td class="summary">On adjust text size callback(self, new_scale)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#pos">pos</a></td> <td class="name" nowrap><a href="#pos">pos</a></td>
<td class="summary">Current text position</td> <td class="summary">Current text position</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#start_scale">start_scale</a></td>
<td class="summary">Initial text node scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#scale">scale</a></td> <td class="name" nowrap><a href="#scale">scale</a></td>
<td class="summary">Current text node scale</td> <td class="summary">Current text node scale</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#start_scale">start_scale</a></td>
<td class="summary">Initial text node scale</td>
</tr>
<tr>
<td class="name" nowrap><a href="#start_size">start_size</a></td> <td class="name" nowrap><a href="#start_size">start_size</a></td>
<td class="summary">Initial text node size</td> <td class="summary">Initial text node size</td>
</tr> </tr>
@ -173,14 +183,6 @@
<td class="name" nowrap><a href="#text_area">text_area</a></td> <td class="name" nowrap><a href="#text_area">text_area</a></td>
<td class="summary">Current text node available are</td> <td class="summary">Current text node available are</td>
</tr> </tr>
<tr>
<td class="name" nowrap><a href="#adjust_type">adjust_type</a></td>
<td class="summary">Current text size adjust settings</td>
</tr>
<tr>
<td class="name" nowrap><a href="#color">color</a></td>
<td class="summary">Current text color</td>
</tr>
</table> </table>
<br/> <br/>
@ -190,6 +192,70 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "get_text_adjust"></a>
<strong>get_text_adjust(self, adjust_type)</strong>
</dt>
<dd>
Return current text adjust type
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
</li>
<li><span class="parameter">adjust_type</span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">number</span></span>
The current text adjust type
</ol>
</dd>
<dt>
<a name = "get_text_size"></a>
<strong>get_text_size(self[, text])</strong>
</dt>
<dd>
Calculate text width with font with respect to trailing space
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<li>
<span class="types"><span class="type">number</span></span>
Width</li>
<li>
<span class="types"><span class="type">number</span></span>
Height</li>
</ol>
</dd>
<dt> <dt>
<a name = "init"></a> <a name = "init"></a>
<strong>init(self, node[, value[, adjust_type=0]])</strong> <strong>init(self, node[, value[, adjust_type=0]])</strong>
@ -202,7 +268,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span> <span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Text.html#node">node</a></span> <span class="types"><a class="type" href="../modules/Text.html#node">node</a></span>
@ -226,48 +292,49 @@
</dd> </dd>
<dt> <dt>
<a name = "get_text_width"></a> <a name = "is_multiline"></a>
<strong>get_text_width(self[, text])</strong> <strong>is_multiline(self)</strong>
</dt> </dt>
<dd> <dd>
Calculate text width with font with respect to trailing space Return true, if text with line break
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span> <span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">text</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
(<em>optional</em>)
</li> </li>
</ul> </ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is text node with line break
</ol>
</dd> </dd>
<dt> <dt>
<a name = "set_to"></a> <a name = "set_alpha"></a>
<strong>set_to(self, set_to)</strong> <strong>set_alpha(self, alpha)</strong>
</dt> </dt>
<dd> <dd>
Set text to text field Set alpha
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span> <span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li> </li>
<li><span class="parameter">set_to</span> <li><span class="parameter">alpha</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><span class="type">number</span></span>
Text for node Alpha for node
</li> </li>
</ul> </ul>
@ -294,7 +361,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span> <span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li> </li>
<li><span class="parameter">color</span> <li><span class="parameter">color</span>
<span class="types"><span class="type">vector4</span></span> <span class="types"><span class="type">vector4</span></span>
@ -312,163 +379,6 @@
</dd>
<dt>
<a name = "set_alpha"></a>
<strong>set_alpha(self, alpha)</strong>
</dt>
<dd>
Set alpha
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">alpha</span>
<span class="types"><span class="type">number</span></span>
Alpha for node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "set_scale"></a>
<strong>set_scale(self, scale)</strong>
</dt>
<dd>
Set scale
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">scale</span>
<span class="types"><span class="type">vector3</span></span>
Scale for node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "set_pivot"></a>
<strong>set_pivot(self, pivot)</strong>
</dt>
<dd>
Set text pivot. Text will re-anchor inside text area
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">pivot</span>
<span class="types"><span class="type">gui.pivot</span></span>
Gui pivot constant
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "is_multiline"></a>
<strong>is_multiline(self)</strong>
</dt>
<dd>
Return true, if text with line break
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">bool</span></span>
Is text node with line break
</ol>
</dd>
<dt>
<a name = "set_text_adjust"></a>
<strong>set_text_adjust(self[, adjust_type[, minimal_scale]])</strong>
</dt>
<dd>
Set text adjust, refresh the current text visuals, if needed
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
</li>
<li><span class="parameter">adjust_type</span>
<span class="types"><span class="type">number</span></span>
See const.TEXT_ADJUST. If pass nil - use current adjust type
(<em>optional</em>)
</li>
<li><span class="parameter">minimal_scale</span>
<span class="types"><span class="type">number</span></span>
If pass nil - not use minimal scale
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd> </dd>
<dt> <dt>
<a name = "set_minimal_scale"></a> <a name = "set_minimal_scale"></a>
@ -482,7 +392,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span> <span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li> </li>
<li><span class="parameter">minimal_scale</span> <li><span class="parameter">minimal_scale</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
@ -502,28 +412,129 @@
</dd> </dd>
<dt> <dt>
<a name = "get_text_adjust"></a> <a name = "set_pivot"></a>
<strong>get_text_adjust(self, adjust_type)</strong> <strong>set_pivot(self, pivot)</strong>
</dt> </dt>
<dd> <dd>
Return current text adjust type Set text pivot. Text will re-anchor inside text area
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li> </li>
<li><span class="parameter">adjust_type</span> <li><span class="parameter">pivot</span>
<span class="types"><span class="type">gui.pivot</span></span>
Gui pivot constant
</li> </li>
</ul> </ul>
<h3>Returns:</h3> <h3>Returns:</h3>
<ol> <ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "set_scale"></a>
<strong>set_scale(self, scale)</strong>
</dt>
<dd>
Set scale
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">scale</span>
<span class="types"><span class="type">vector3</span></span>
Scale for node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "set_text_adjust"></a>
<strong>set_text_adjust(self[, adjust_type[, minimal_scale]])</strong>
</dt>
<dd>
Set text adjust, refresh the current text visuals, if needed
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">adjust_type</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
The current text adjust type See const.TEXT_ADJUST. If pass nil - use current adjust type
(<em>optional</em>)
</li>
<li><span class="parameter">minimal_scale</span>
<span class="types"><span class="type">number</span></span>
If pass nil - not use minimal scale
(<em>optional</em>)
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol>
</dd>
<dt>
<a name = "set_to"></a>
<strong>set_to(self, set_to)</strong>
</dt>
<dd>
Set text to text field
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">self</span>
<span class="types"><span class="type">Text</span></span>
<a href="../modules/Text.html#">Text</a>
</li>
<li><span class="parameter">set_to</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Text for node
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><span class="type">Text</span></span>
Current text instance
</ol> </ol>
@ -568,16 +579,16 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_set_text"></a> <a name = "adjust_type"></a>
<strong>on_set_text</strong> <strong>adjust_type</strong>
</dt> </dt>
<dd> <dd>
On set text callback(self, text) Current text size adjust settings
<ul> <ul>
<li><span class="parameter">on_set_text</span> <li><span class="parameter">adjust_type</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">number</span></span>
</li> </li>
</ul> </ul>
@ -588,36 +599,16 @@
</dd> </dd>
<dt> <dt>
<a name = "on_update_text_scale"></a> <a name = "color"></a>
<strong>on_update_text_scale</strong> <strong>color</strong>
</dt> </dt>
<dd> <dd>
On adjust text size callback(self, new_scale) Current text color
<ul> <ul>
<li><span class="parameter">on_update_text_scale</span> <li><span class="parameter">color</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_set_pivot"></a>
<strong>on_set_pivot</strong>
</dt>
<dd>
On change pivot callback(self, pivot)
<ul>
<li><span class="parameter">on_set_pivot</span>
<span class="types"><span class="type">druid_event</span></span>
</li> </li>
</ul> </ul>
@ -666,6 +657,66 @@
</dd>
<dt>
<a name = "on_set_pivot"></a>
<strong>on_set_pivot</strong>
</dt>
<dd>
On change pivot callback(self, pivot)
<ul>
<li><span class="parameter">on_set_pivot</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_set_text"></a>
<strong>on_set_text</strong>
</dt>
<dd>
On set text callback(self, text)
<ul>
<li><span class="parameter">on_set_text</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_update_text_scale"></a>
<strong>on_update_text_scale</strong>
</dt>
<dd>
On adjust text size callback(self, new_scale)
<ul>
<li><span class="parameter">on_update_text_scale</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "pos"></a> <a name = "pos"></a>
@ -688,15 +739,15 @@
</dd> </dd>
<dt> <dt>
<a name = "start_scale"></a> <a name = "scale"></a>
<strong>start_scale</strong> <strong>scale</strong>
</dt> </dt>
<dd> <dd>
Initial text node scale Current text node scale
<ul> <ul>
<li><span class="parameter">start_scale</span> <li><span class="parameter">scale</span>
<span class="types"><span class="type">vector3</span></span> <span class="types"><span class="type">vector3</span></span>
</li> </li>
@ -708,15 +759,15 @@
</dd> </dd>
<dt> <dt>
<a name = "scale"></a> <a name = "start_scale"></a>
<strong>scale</strong> <strong>start_scale</strong>
</dt> </dt>
<dd> <dd>
Current text node scale Initial text node scale
<ul> <ul>
<li><span class="parameter">scale</span> <li><span class="parameter">start_scale</span>
<span class="types"><span class="type">vector3</span></span> <span class="types"><span class="type">vector3</span></span>
</li> </li>
@ -766,46 +817,6 @@
</dd>
<dt>
<a name = "adjust_type"></a>
<strong>adjust_type</strong>
</dt>
<dd>
Current text size adjust settings
<ul>
<li><span class="parameter">adjust_type</span>
<span class="types"><span class="type">number</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "color"></a>
<strong>color</strong>
</dt>
<dd>
Current text color
<ul>
<li><span class="parameter">color</span>
<span class="types"><span class="type">vector3</span></span>
</li>
</ul>
</dd> </dd>
</dl> </dl>
@ -813,8 +824,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -40,29 +40,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><strong>Timer</strong></li> <li><strong>Timer</strong></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><a href="../modules/druid.html">druid</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -83,39 +85,39 @@
<td class="summary">Component init function</td> <td class="summary">Component init function</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_to">set_to(self, set_to)</a></td> <td class="name" nowrap><a href="#set_interval">set_interval(self, from, to)</a></td>
<td class="summary">Set text to text field</td> <td class="summary">Set time interval</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_state">set_state(self, is_on)</a></td> <td class="name" nowrap><a href="#set_state">set_state(self, is_on)</a></td>
<td class="summary">Called when update</td> <td class="summary">Called when update</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_interval">set_interval(self, from, to)</a></td> <td class="name" nowrap><a href="#set_to">set_to(self, set_to)</a></td>
<td class="summary">Set time interval</td> <td class="summary">Set text to text field</td>
</tr> </tr>
</table> </table>
<h2><a href="#Fields">Fields</a></h2> <h2><a href="#Fields">Fields</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" nowrap><a href="#on_tick">on_tick</a></td> <td class="name" nowrap><a href="#from">from</a></td>
<td class="summary">On timer tick.</td> <td class="summary">Initial timer value</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_set_enabled">on_set_enabled</a></td>
<td class="summary">On timer change enabled state callback(self, is_enabled)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_timer_end">on_timer_end</a></td>
<td class="summary">On timer end callback</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#node">node</a></td> <td class="name" nowrap><a href="#node">node</a></td>
<td class="summary">Trigger node</td> <td class="summary">Trigger node</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#from">from</a></td> <td class="name" nowrap><a href="#on_set_enabled">on_set_enabled</a></td>
<td class="summary">Initial timer value</td> <td class="summary">On timer change enabled state callback(self, is_enabled)</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_tick">on_tick</a></td>
<td class="summary">On timer tick.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#on_timer_end">on_timer_end</a></td>
<td class="summary">On timer end callback</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#target">target</a></td> <td class="name" nowrap><a href="#target">target</a></td>
@ -146,7 +148,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span> <span class="types"><span class="type">Timer</span></span>
<a href="../modules/Timer.html#">Timer</a>
</li> </li>
<li><span class="parameter">node</span> <li><span class="parameter">node</span>
<span class="types"><a class="type" href="../modules/Timer.html#node">node</a></span> <span class="types"><a class="type" href="../modules/Timer.html#node">node</a></span>
@ -174,22 +176,26 @@
</dd> </dd>
<dt> <dt>
<a name = "set_to"></a> <a name = "set_interval"></a>
<strong>set_to(self, set_to)</strong> <strong>set_interval(self, from, to)</strong>
</dt> </dt>
<dd> <dd>
Set text to text field Set time interval
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span> <span class="types"><span class="type">Timer</span></span>
<a href="../modules/Timer.html#">Timer</a>
</li> </li>
<li><span class="parameter">set_to</span> <li><span class="parameter">from</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
Value in seconds Start time in seconds
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Target time in seconds
</li> </li>
</ul> </ul>
@ -210,7 +216,7 @@
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span> <span class="types"><span class="type">Timer</span></span>
<a href="../modules/Timer.html#">Timer</a>
</li> </li>
<li><span class="parameter">is_on</span> <li><span class="parameter">is_on</span>
<span class="types"><span class="type">bool</span></span> <span class="types"><span class="type">bool</span></span>
@ -224,26 +230,22 @@
</dd> </dd>
<dt> <dt>
<a name = "set_interval"></a> <a name = "set_to"></a>
<strong>set_interval(self, from, to)</strong> <strong>set_to(self, set_to)</strong>
</dt> </dt>
<dd> <dd>
Set time interval Set text to text field
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">self</span> <li><span class="parameter">self</span>
<span class="types"><span class="type">Timer</span></span> <span class="types"><span class="type">Timer</span></span>
<a href="../modules/Timer.html#">Timer</a>
</li> </li>
<li><span class="parameter">from</span> <li><span class="parameter">set_to</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">number</span></span>
Start time in seconds Value in seconds
</li>
<li><span class="parameter">to</span>
<span class="types"><span class="type">number</span></span>
Target time in seconds
</li> </li>
</ul> </ul>
@ -257,16 +259,16 @@
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "on_tick"></a> <a name = "from"></a>
<strong>on_tick</strong> <strong>from</strong>
</dt> </dt>
<dd> <dd>
On timer tick. Fire every second callback(self, value) Initial timer value
<ul> <ul>
<li><span class="parameter">on_tick</span> <li><span class="parameter">from</span>
<span class="types"><span class="type">druid_event</span></span> <span class="types"><span class="type">number</span></span>
</li> </li>
</ul> </ul>
@ -275,46 +277,6 @@
</dd>
<dt>
<a name = "on_set_enabled"></a>
<strong>on_set_enabled</strong>
</dt>
<dd>
On timer change enabled state callback(self, is_enabled)
<ul>
<li><span class="parameter">on_set_enabled</span>
<span class="types"><span class="type">druid_event</span></span>
</li>
</ul>
</dd>
<dt>
<a name = "on_timer_end"></a>
<strong>on_timer_end</strong>
</dt>
<dd>
On timer end callback
<ul>
<li><span class="parameter">on_timer_end</span>
<span class="types"><span class="type">druid_event</span></span>
(self, Timer)
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "node"></a> <a name = "node"></a>
@ -337,17 +299,57 @@
</dd> </dd>
<dt> <dt>
<a name = "from"></a> <a name = "on_set_enabled"></a>
<strong>from</strong> <strong>on_set_enabled</strong>
</dt> </dt>
<dd> <dd>
Initial timer value On timer change enabled state callback(self, is_enabled)
<ul> <ul>
<li><span class="parameter">from</span> <li><span class="parameter">on_set_enabled</span>
<span class="types"><span class="type">number</span></span> <span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_tick"></a>
<strong>on_tick</strong>
</dt>
<dd>
On timer tick. Fire every second callback(self, value)
<ul>
<li><span class="parameter">on_tick</span>
<span class="types"><span class="type">DruidEvent</span></span>
<a href="../modules/DruidEvent.html#">DruidEvent</a>
</li>
</ul>
</dd>
<dt>
<a name = "on_timer_end"></a>
<strong>on_timer_end</strong>
</dt>
<dd>
On timer end callback
<ul>
<li><span class="parameter">on_timer_end</span>
<span class="types"><span class="type">DruidEvent</span></span>
(self, Timer) <a href="../modules/DruidEvent.html#">DruidEvent</a>
</li> </li>
</ul> </ul>
@ -402,8 +404,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -39,29 +39,31 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/BackHandler.html">BackHandler</a></li> <li><a href="../modules/BackHandler.html">BackHandler</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><a href="../modules/Blocker.html">Blocker</a></li> <li><a href="../modules/Blocker.html">Blocker</a></li>
<li><a href="../modules/Button.html">Button</a></li> <li><a href="../modules/Button.html">Button</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/BaseComponent.html">BaseComponent</a></li>
<li><strong>druid</strong></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/Checkbox.html">Checkbox</a></li> <li><a href="../modules/Checkbox.html">Checkbox</a></li>
<li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li> <li><a href="../modules/CheckboxGroup.html">CheckboxGroup</a></li>
<li><a href="../modules/DataList.html">DataList</a></li> <li><a href="../modules/DataList.html">DataList</a></li>
<li><a href="../modules/Drag.html">Drag</a></li>
<li><a href="../modules/DruidEvent.html">DruidEvent</a></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
<li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li> <li><a href="../modules/DynamicGrid.html">DynamicGrid</a></li>
<li><a href="../modules/Helper.html">Helper</a></li>
<li><a href="../modules/Hover.html">Hover</a></li>
<li><a href="../modules/Input.html">Input</a></li> <li><a href="../modules/Input.html">Input</a></li>
<li><a href="../modules/LangText.html">LangText</a></li> <li><a href="../modules/LangText.html">LangText</a></li>
<li><a href="../modules/PinKnob.html">PinKnob</a></li>
<li><a href="../modules/Progress.html">Progress</a></li> <li><a href="../modules/Progress.html">Progress</a></li>
<li><a href="../modules/RadioGroup.html">RadioGroup</a></li> <li><a href="../modules/RadioGroup.html">RadioGroup</a></li>
<li><a href="../modules/RichInput.html">RichInput</a></li>
<li><a href="../modules/Scroll.html">Scroll</a></li>
<li><a href="../modules/Slider.html">Slider</a></li> <li><a href="../modules/Slider.html">Slider</a></li>
<li><a href="../modules/StaticGrid.html">StaticGrid</a></li>
<li><a href="../modules/Swipe.html">Swipe</a></li>
<li><a href="../modules/Text.html">Text</a></li>
<li><a href="../modules/Timer.html">Timer</a></li> <li><a href="../modules/Timer.html">Timer</a></li>
<li><a href="../modules/druid.helper.html">druid.helper</a></li> <li><strong>druid</strong></li>
<li><a href="../modules/DruidInstance.html">DruidInstance</a></li>
</ul> </ul>
</div> </div>
@ -86,39 +88,35 @@
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr>
<td class="name" nowrap><a href="#register">register(name, module)</a></td>
<td class="summary">Register external druid component.</td>
</tr>
<tr> <tr>
<td class="name" nowrap><a href="#new">new(context[, style])</a></td> <td class="name" nowrap><a href="#new">new(context[, style])</a></td>
<td class="summary">Create Druid instance.</td> <td class="summary">Create Druid instance.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#set_default_style">set_default_style(style)</a></td> <td class="name" nowrap><a href="#on_language_change">on_language_change()</a></td>
<td class="summary">Set new default style.</td> <td class="summary">Callback on global language change event.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text_function">set_text_function(callback)</a></td>
<td class="summary">Set text function
Druid locale component will call this function
to get translated text.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_sound_function">set_sound_function(callback)</a></td>
<td class="summary">Set sound function.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_window_callback">on_window_callback(event)</a></td> <td class="name" nowrap><a href="#on_window_callback">on_window_callback(event)</a></td>
<td class="summary">Callback on global window event.</td> <td class="summary">Callback on global window event.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_layout_change">on_layout_change()</a></td> <td class="name" nowrap><a href="#register">register(name, module)</a></td>
<td class="summary">Callback on global layout change event.</td> <td class="summary">Register external druid component.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="#on_language_change">on_language_change()</a></td> <td class="name" nowrap><a href="#set_default_style">set_default_style(style)</a></td>
<td class="summary">Callback on global language change event.</td> <td class="summary">Set new default style.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_sound_function">set_sound_function(callback)</a></td>
<td class="summary">Set sound function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#set_text_function">set_text_function(callback)</a></td>
<td class="summary">Set text function
Druid locale component will call this function
to get translated text.</td>
</tr> </tr>
</table> </table>
@ -129,33 +127,6 @@
<h2 class="section-header "><a name="Functions"></a>Functions</h2> <h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function"> <dl class="function">
<dt>
<a name = "register"></a>
<strong>register(name, module)</strong>
</dt>
<dd>
Register external druid component.
After register you can create the component with
druid_instance:new_{name}. For example `druid:new_button(...)`
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
module name
</li>
<li><span class="parameter">module</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
lua table with component
</li>
</ul>
</dd>
<dt> <dt>
<a name = "new"></a> <a name = "new"></a>
<strong>new(context[, style])</strong> <strong>new(context[, style])</strong>
@ -187,6 +158,70 @@
</dd>
<dt>
<a name = "on_language_change"></a>
<strong>on_language_change()</strong>
</dt>
<dd>
Callback on global language change event.
Use to update all lang texts
</dd>
<dt>
<a name = "on_window_callback"></a>
<strong>on_window_callback(event)</strong>
</dt>
<dd>
Callback on global window event.
Used to trigger on_focus_lost and on_focus_gain
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">event</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
Event param from window listener
</li>
</ul>
</dd>
<dt>
<a name = "register"></a>
<strong>register(name, module)</strong>
</dt>
<dd>
Register external druid component.
After register you can create the component with
druid_instance:new_{name}. For example `druid:new_button(...)`
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span>
module name
</li>
<li><span class="parameter">module</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.5">table</a></span>
lua table with component
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "set_default_style"></a> <a name = "set_default_style"></a>
@ -208,30 +243,6 @@
</dd>
<dt>
<a name = "set_text_function"></a>
<strong>set_text_function(callback)</strong>
</dt>
<dd>
Set text function
Druid locale component will call this function
to get translated text. After set_text_funtion
all existing locale component will be updated
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
Get localized text function
</li>
</ul>
</dd> </dd>
<dt> <dt>
<a name = "set_sound_function"></a> <a name = "set_sound_function"></a>
@ -257,19 +268,21 @@
</dd> </dd>
<dt> <dt>
<a name = "on_window_callback"></a> <a name = "set_text_function"></a>
<strong>on_window_callback(event)</strong> <strong>set_text_function(callback)</strong>
</dt> </dt>
<dd> <dd>
Callback on global window event. Set text function
Used to trigger on_focus_lost and on_focus_gain Druid locale component will call this function
to get translated text. After set_text_funtion
all existing locale component will be updated
<h3>Parameters:</h3> <h3>Parameters:</h3>
<ul> <ul>
<li><span class="parameter">event</span> <li><span class="parameter">callback</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.1/manual.html#5.4">string</a></span> <span class="types"><span class="type">function</span></span>
Event param from window listener Get localized text function
</li> </li>
</ul> </ul>
@ -277,35 +290,6 @@
</dd>
<dt>
<a name = "on_layout_change"></a>
<strong>on_layout_change()</strong>
</dt>
<dd>
Callback on global layout change event.
</dd>
<dt>
<a name = "on_language_change"></a>
<strong>on_language_change()</strong>
</dt>
<dd>
Callback on global language change event.
Use to update all lang texts
</dd> </dd>
</dl> </dl>
@ -313,8 +297,8 @@
</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 TESTING</a></i>
<i style="float:right;">Last updated 2022-02-12 17:16:44 </i> <i style="float:right;">Last updated 2015-01-01 12:00:00 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@ -2,78 +2,133 @@
## Overview ## Overview
Druid allows you to create your custom components from druid basic components or other custom components. Druid allows you to create your custom components which contains your custom logic, other Druid basic components or other custom components.
Every component is the children of Basic Druid component. Read the [basic component API here].(https://insality.github.io/druid/modules/component.html), Methods of basic components you can call via self:{method_name} I wanna make a point that Druid is not only set of defined components to place buttons, scroll, etc. But mostly it's a way how to handle all your GUI elements in general. Custom components is most powerful way to separate logic and make higher abstraction in your code.
Every component is the children of Basic Druid component. Read the [basic component API here].(https://insality.github.io/druid/modules/component.html), Methods of basic components you can call via `self:{method_name}`
## Custom components ## Custom components
Basic custom component template looks like this: ### Basic component template
Basic custom component template looks like this. It's good start to create your own component! (you can copy it from `/druid/templates/component.template.lua`)
```lua ```lua
local component = require("druid.component") local component = require("druid.component")
local M = component.create("my_component") ---@class component_name : druid.base_component
local Component = component.create("component_name")
-- Component constructor local SCHEME = {
function M.init(self, ...) ROOT = "root",
BUTTON = "button",
}
-- Component constructor. Template name and nodes are optional. Pass it if you use it in your component
function Component:init(template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.root = self:get_node(SCHEME.ROOT)
self.druid = self:get_druid()
self.button = self.druid:new_button(SCHEME.BUTTON, function() end)
end end
-- [OPTIONAL] If declared, will call this on script.update function -- [OPTIONAL] Call on component remove or on druid:final
function M.update(self, dt) function Component:on_remove() end
return Component
```
### Full component template
Full custom component template looks like this (you can copy it from `/druid/templates/component_full.template.lua`:
```lua
local component = require("druid.component")
---@class component_name : druid.base_component
local Component = component.create("component_name")
-- Scheme of component gui nodes
local SCHEME = {
ROOT = "root",
BUTTON = "button",
}
-- Component constructor. Template name and nodes are optional. Pass it if you use it in your component
function Component:init(template, nodes)
-- If your component is gui template, pass the template name and set it
self:set_template(template)
-- If your component is cloned my gui.clone_tree, pass nodes to component and set it
self:set_nodes(nodes)
-- self:get_node will auto process component template and nodes
self.root = self:get_node(SCHEME.ROOT)
-- Use inner druid instance to create components inside this component
self.druid = self:get_druid()
end end
-- [OPTIONAL] If declared, will call this on script.on_input function -- [OPTIONAL] Call every update step
function M.on_input(self, action_id, action) function Component:update(dt) end
end
-- [OPTIONAL] If declared, will call on component creation and on component:set_style() function -- [OPTIONAL] Call default on_input from gui script
function M.on_style_change(self, style) function Component:on_input(action_id, action) return false end
end
-- [OPTIONAL] If declared, will call this on script.on_message function -- [OPTIONAL] Call on component creation and on component:set_style() function
function M.on_message(self, message_id, message, sender) function Component:on_style_change(style) end
end
-- [OPTIONAL] If declared, will call this on druid.on_language_change call -- [OPTIONAL] Call default on_message from gui script
function M.on_language_change(self) function Component:on_message(message_id, message, sender) end
end
-- [OPTIONAL] If declared, will call this on const.ON_MESSAGE_INPUT message to Druid script instance -- [OPTIONAL] Call if druid has triggered on_language_change
function M.on_message_input(self, node_id, message) function Component:on_language_change() end
end
-- [OPTIONAL] If declared, will call this on layout changing -- [OPTIONAL] Call if game layout has changed and need to restore values in component
function M.on_layout_change(self) function Component:on_layout_change() end
end
-- [OPTIONAL] If declared, will call this on layout changing, if input was capturing before this component -- [OPTIONAL] Call, if input was capturing before this component
-- Example: scroll is start scrolling, so you need unhover button -- Example: scroll is start scrolling, so you need unhover button
function M.on_input_interrupt(self) function Component:on_input_interrupt() end
end
-- [OPTIONAL] If declared, will call this if game lost focus -- [OPTIONAL] Call, if game lost focus
function M.on_focus_lost(self) function Component:on_focus_lost() end
end
-- [OPTIONAL] If declared, will call this if game gained focus -- [OPTIONAL] Call, if game gained focus
function M.on_focus_gained(self) function Component:on_focus_gained() end
end
-- [OPTIONAL] Call on component remove or on druid:final
function Component:on_remove() end
-- [OPTIONAL] If declared, will call this if late init step (first frame on update) return Component
function M.on_late_init(self)
end
-- [OPTIONAL] If declared, will call this on component remove from Druid instance
function M.on_remove(self)
end
return M
``` ```
Add your custom component to druid via `druid.register` ### Spawn custom component
After the creating your custom component, you now able to create it.
For example we made the component `my_component`. Now we able create it like this:
```lua
local druid = require("druid.druid")
local my_component = require("my.amazing.component")
function init(self)
self.druid = druid.new(self)
self.druid:new(my_component, "template_name", nodes)
end
```
The template name - is the name of GUI template file if you use it in your custom component.
The nodes - is table from `gui.clone_tree(node)`. If you spawn multiply nodes for component, pass it to component constructor.
Inside component you have to set template and nodes via
`self:set_template(template)` and `self:set_nodes(nodes)`
### Register custom component
You can register your custom component for use it without require component module in every file. Registering components is comfortable for very basic components in your game.
Add your custom component to druid via `druid.register
```lua ```lua
local druid = require("druid.druid") local druid = require("druid.druid")
local my_component = require("my.amazing.component") local my_component = require("my.amazing.component")
@ -85,8 +140,6 @@ end
Registering make new function with "new_{component_name}". In our example it will be: `druid:new_my_component()`. Registering make new function with "new_{component_name}". In our example it will be: `druid:new_my_component()`.
Or you can create component without registering with `druid:create(my_component_module)`
As component registered, you can create your component with next code: As component registered, you can create your component with next code:
```lua ```lua
local druid = require("druid.druid") local druid = require("druid.druid")
@ -94,15 +147,45 @@ local my_component = require("my.amazing.component")
function init(self) function init(self)
self.druid = druid.new(self) self.druid = druid.new(self)
self.my_component = self.druid:new_my_component(template, nodes)
local my_component = self.druid:new_my_component(...)
-- or --
local my_component = self.druid:create(my_component, ...)
end end
``` ```
## Create Druid Component editor script
The Druid has editor script to help you with creating lua file for your GUI scene.
The commands is available on *.gui scenes in menu `Edit -> Create Druid Component`
The script will check current GUI scene and generate lua file with all Druid component stubs. The output file will be named as current GUI scene and placed nearby. The *.lua file should be not exists, the script will not override any file. If you want to re-generate file, delete previous one first.
The script required `python3` with `deftree` installed. If `deftree` is not installed the instructions will be prompt in console.
### Auto layout components
The generator script also check current GUI scene for Druid components to make stubs for them. The script will check the node names and if it starts with special keyword it will make component stubs in generated lua file. It will generate component declaring, callback functions stubs and annotations.
Start your node names with one of next keyword to say parser make component stubs for your. For example for nodes `button` and `button_exit` will be generated two Druid Button components with callback stubs.
Available keywords:
- `button` - add [Druid Button](docs_md/01-components.md#button) and generate callback stub
- `text` - add [Druid Text](docs_md/01-components.md#text)
- `lang_text` - add Druid [Druid Lang Text](docs_md/01-components.md#lang-text)
- `grid` or `static_grid` - add Druid [Druid Static Grid](docs_md/01-components.md#static-grid). You should to setup Grid prefab for this component after file generation
- `dynamic_grid` - add Druid [Druid Dynamic Grid](docs_md/01-components.md#dynamic-grid)
- `scroll_view` - add [Druid Scroll](docs_md/01-components.md#scroll). It will add `scroll_content` node with the same postfix too. Check that is will correct node
- `blocker` - add [Druid Blocker](docs_md/01-components.md#blocker)
- `slider` - add [Druid Slider](docs_md/01-components.md#slider). You should to adjust end position of Slider after file generation
- `progress` - add [Druid Progress](docs_md/01-components.md#progress)
- `timer` - add [Druid Timer](docs_md/01-components.md#timer)
## Best practice on custom components ## Best practice on custom components
On each component recommended describe component scheme in next way: On each component recommended describe component scheme in next way:
To get this structure, Druid has editor script to help you with it. Select your GUI nodes in editor outline, right click and press "Print GUI Scheme". And copy the result from the output console.
```lua ```lua
-- Component module -- Component module
@ -117,25 +200,21 @@ local SCHEME = {
} }
function M.init(self, template_name, node_table) function M.init(self, template_name, node_table)
-- If component use template, setup it:
self:set_template(template_name) self:set_template(template_name)
-- If component was cloned with gui.clone_tree, pass his nodes
self:set_nodes(node_table) self:set_nodes(node_table)
-- helper can get node from gui/template/table -- helper can get node from gui/template/table
local root = self:get_node(SCHEME.ROOT) local root = self:get_node(SCHEME.ROOT)
-- This component can spawn another druid components: -- This component can spawn another druid components:
local druid = self:get_druid() local druid = self:get_druid()
-- Button self on callback is self of _this_ component -- Button self on callback is self of _this_ component
local button = druid:new_button(...) local button = druid:new_button(...)
end end
``` ```
## Power of using templates ## Power of using templates
You can use one component, but creating and customizing templates for them. Templates only requires to match the component scheme. You can use one component, but creating and customizing templates for them. Templates only requires to match the component scheme.
For example you have component `player_panel` and two GUI templates: `player_panel` and `enemy_panel` with different layout. But the same component script can be used for both of them.

View File

@ -37,7 +37,7 @@ local my_style = require("my.amazing.style")
local function init(self) local function init(self)
self.druid = druid.new(self) self.druid = druid.new(self)
self.button = self.druid:new_button(self, "node") self.button = self.druid:new_button("node", function() end)
-- Setup custom style for specific component -- Setup custom style for specific component
self.button:set_style(my_style) self.button:set_style(my_style)
end end
@ -50,7 +50,7 @@ The most components have their styles. You can explore it on [Druid API](https:/
To create you style, create lua module, what return <_component_name_, _component_style_> table To create you style, create lua module, what return <_component_name_, _component_style_> table
Example: [default druid style](https://github.com/Insality/druid/blob/develop/druid/styles/default/style.lua) Example: [default druid style](styles/default/style.lua)
Override all fields you want and set your style with one of next ways: Override all fields you want and set your style with one of next ways:

View File

@ -1,8 +0,0 @@
# Druid assets
## Overview
I've created [druid-assets repository](https://github.com/Insality/druid-assets) to make a _marketplace_ with custom styles and components.
Any of Druid users can push their own components and styles to share it with the other users
Also, this marketplace is great example to how you can create your custom components

View File

@ -1,6 +0,0 @@
# Examples
## Overview
See the [example folder](https://github.com/Insality/druid/tree/develop/example/kenney) for examples of how to use Druid
Try the [HTML5 version](https://insality.github.io/druid/druid/) of the example app

View File

@ -53,8 +53,8 @@ button:set_click_zone(scroll.view_node)
### Q: How to use EmmyLua annotations? _(from Druid 0.6.0)_ ### Q: How to use EmmyLua annotations? _(from Druid 0.6.0)_
**A:** Since the dependencies can't be processed by external editors, for use generated EmmyLua annotations you should copy the _annotations.lua_ to your project. For EmmyLua it will be enough. Remember you can _restart emmylua server_ for refresh the changes, if something goes wrong. **A:** Since the dependencies can't be processed by external editors, for use generated EmmyLua annotations you should copy the _druid/annotations.lua_ to your project. For EmmyLua it will be enough. Remember you can _restart emmylua server_ for refresh the changes, if something goes wrong.
After the annotations is processed, you should point the type of druid in requires: After the annotations is processed, you should point the type of Druid in requires:
```lua ```lua
---@type druid ---@type druid
local druid = require("druid.druid") local druid = require("druid.druid")

View File

@ -66,7 +66,7 @@
- _Content node_ - dynamic node, moving by _Scroll_ component - _Content node_ - dynamic node, moving by _Scroll_ component
- Scroll will be disabled only if content size equals to view size (by width or height separatly) - Scroll will be disabled only if content size equals to view size (by width or height separatly)
- You can adjust start scroll size via _.gui_ scene. Just setup correct node size - You can adjust start scroll size via _.gui_ scene. Just setup correct node size
- Different anchoring is supported (for easier layouting) - Different anchoring is supported (for easier layout)
- 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
@ -280,7 +280,7 @@ In this Druid update no any huge special features. Mostly the bug fixes and rewo
Also added last row allignment in Static Grid component with "dynamic content poses" style enabled. You can look how it is work here: https://insality.github.io/druid/druid/?example=grid_static_grid_dynamic_pos Also added last row allignment in Static Grid component with "dynamic content poses" style enabled. You can look how it is work here: https://insality.github.io/druid/druid/?example=grid_static_grid_dynamic_pos
You can say thanks to me via stars on GitHub 3! :wink: You can say thanks to me via stars on GitHub! :wink:
Wanna something more? [Add an issues!](https://github.com/Insality/druid/issues) Wanna something more? [Add an issues!](https://github.com/Insality/druid/issues)
Have a nice day! Have a nice day!
@ -315,3 +315,79 @@ Have a nice day!
- Required to solve issues, when go input acquire can be later, when gui input acquire (on init step) - Required to solve issues, when go input acquire can be later, when gui input acquire (on init step)
- **#154** System: Change text adjust const to strings - **#154** System: Change text adjust const to strings
- **#155** Fix: Add margin to total width calculation in `helper.centrate_nodes` - **#155** Fix: Add margin to total width calculation in `helper.centrate_nodes`
### Druid 0.9.0
_Custom components update_
Hello!
Here is the long awaited update! Finally I implemented some ideas how to make easier creating custom components. There is a bunch of improvements you can be interested in.
I wanna make a point that Druid is not only set of defined components to place buttons, scroll, etc. But mostly it's a way how to handle all your GUI elements in general. Custom components is most powerful way to separate logic and make higher abstraction in your code.
Usually - custom components is set of GUI template and lua code for this template. I've added editor script, that can make a lua component file from your GUI scene (all boilerplate and usage code, also some component that can be defined right in GUI scene).
Auto layout from GUI script should be a powerful tool too! Also it's brings some code structure and style across all your files. Auto layout works from node names. If its starts or equal to some string, it will add code to generated lua file. For example, if you have in your scene node with name "button_start", it will create the Druid button, stub function and annotations to this. Sounds good!
For more information see [Create custom components](docs_md/02-creating_custom_components.md) documentations.
Also this update have some breaking changes: you should no more pass full tempalte name in inner components and the second one is renaming `text:get_text_width` to `text:get_text_size`.
The Defold 1.3.0 solves the old my issue with slider component. Now you can define input zone (not only the slider pin node) to interact with slider. It's because of inroduction `gui.screen_to_local` and `gui.set_screen_position` in default GUI api. If you using previuos Defold releases, this piece of logic will be ignored.
The Druid Assets repository will be closed and I move some components right in Druid repository. You can now use custom components in your game if your need. Right now it's Rich Input (input field with cursor and placegolder) and Pin Knob (Rotating node for set value). And slowly working on adding new examples and improvements of existing ones.
You can say thanks to me via stars on GitHub! :wink:
Also you can help with testing new functions and leave feedback.
Wanna something more? [Add an issues!](https://github.com/Insality/druid/issues)
Take care of yourself
**Changelog 0.9.0**
---
- **#119** Add **Create Druid Component** editor script *(python3 with deftree required)*
- The headliner of current update. This editor scripts allows you to create Custom component lua script from you *.gui* scene file. It will create component file with the same name as GUI scene and place it nearby. Inside this generated file you will find the instructions how to start usage this (require and create code).
- This code contains GUI scheme, basic component boilerplace and generated code for components, used in this GUI scene (see #159)
- See [Create custom components](docs_md/02-creating_custom_components.md) for more info
- **#159** Add auto layout custom components by node naming
- The **Create Druid Component** script will check the node names to create Druid components stubs inside generated code
- The generator will check the node name, if it's starts from special prefix, it will create component code for you
- Currently support the next components: `button`, `text`, `lang_text`, `grid`, `static_grid`, `dynamic_grid`, `scroll_view`, `blocker`, `slider`, `progress` and `timer`
- **#158** **[BREAKING]** Auto `get_node` inside inner components with template/nodes
- Before this update, if your component with template using another component with template, you had to pass full template name (`current_template .. "/" .. inner_component_template`). From this update you should pass only the `inner_component_template` name. It's will auto check the parent component template name to build full template path
- If you don't want migrate code for this, this option can be disabled via `druid.no_auto_template` in your _game.project_ file. By default it's enabled now
- **#171** Add `component:get_template()` function to **Druid** Base Component
- Now it's able to get full component template name. This function has "protected" scope, so you should use it only inside your component code.
- **#173** Fix GUI nodes usage inside inner templates
- Now you can pass the node name instead of node itself to Druid components inside your Custom Components. Before this update Druid didn't check the nodes in parent component (usually for basic components such as button, text inside your components)
- So you can use now `self.druid:new_button(SCHEME.BUTTON)` instead of `self.druid:new_button(self:get_node(SCHEME.BUTTON))` inside your custom components
- **#174** Add assert to nil node on `self:get_node()`
- It's required for easier debuging components, when GUI node path is wrong and your got the nil. The error with node path will appear in console.
- **#169** [System] Fix on_layout_change event
- It was broken, now the on_layout_change event is working as expected
- **#165** [StaticGrid] Add `static_grid:set_in_row(amount)` function
- **#44** [Slider] Click zone on all slider node, not only pin node
- Finally! Added the `slider:set_input_node(node)` function. Now slider can be interacted not only with slider pin node, but with any zone you will define.
- It will work only from Defold 1.3.0. If you use earlier version, nothing is happened. It using new `gui.screen_to_local` and `gui.set_screen_position` functions.
- **#178** **[BREAKING][Text]** Rename `text:get_text_width` to `text:get_text_size`. Now it return two numbers: width and height
- **#114** Add default component templates
- Added templates for fast prototyping. Use GUI templates to place buttons, checkbox, input and sliders on your GUI scene. You still have to create component with `druid:new` functions inside gui_script.
- **#168** Add button to open code of current example
- Inside every example added button to open code of this example on GitHub
- **#140** Better documentation for custom components
- **#172** Update documentation with links to components
- The docs in (https://insality.github.io/druid/) now have cross links for every custom type
- **#175** Remove Druid Assets repository, move to Druid library
- Added folder `druid/custom`. It will have the complex custom components. Usually you should to use default GUI template or create your own with similar GUI scheme. Currently add `RichInput` and `PinKnob` components from druid-assets repository.
- Usually to use custom component you have to require lua file first and create it's via `druid:new(Component, template_name, [nodes]). See component docs to see constructor params.
- This components will be included in build only if used
- **#176** Keep last scene and scroll position in Druid example
- Probably, it's useful for faster debug, but anyway. The example now keep the last scene and scroll position.
- Add new examples: Checkboxes, Swipe, Grid, Rich input, Pin knob
- Now editor scripts are available in Druid as dependency
- Move emmylua annotations inside Druid dependency folder. You can copy it from Defold Editor outline
- Optimize different stuff(Scroll, Druid Event, Druid instance and Base component)
- Force Data List component to `IS_DYNAMIC_NODE_POSES = false` style

30
druid.code-workspace Normal file
View File

@ -0,0 +1,30 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"files.exclude": {
"**/.git": true, // this is a default value
"**/.DS_Store": true, // this is a default value
"**/node_modules": true, // this excludes all folders
// named "node_modules" from
// the explore tree
// alternative version
"node_modules": true, // this excludes the folder
// only from the root of
// your workspace
".internal": true,
"bundle": true,
"input": true,
"media": true,
"build": true,
".github": true,
".deployer_cache": true,
"dist": true
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle back key (android, backspace) --- Component to handle back key (android, backspace)
-- @module BackHandler -- @module BackHandler
@ -6,7 +6,7 @@
-- @alias druid.back_handler -- @alias druid.back_handler
--- On back handler callback(self, params) --- On back handler callback(self, params)
-- @tfield druid_event on_back -- @tfield DruidEvent on_back @{DruidEvent}
--- Params to back callback --- Params to back callback
-- @tfield any params -- @tfield any params
@ -21,7 +21,7 @@ local BackHandler = component.create("back_handler")
--- Component init function --- Component init function
-- @tparam BackHandler self -- @tparam BackHandler self @{BackHandler}
-- @tparam callback callback On back button -- @tparam callback callback On back button
-- @tparam[opt] any params Callback argument -- @tparam[opt] any params Callback argument
function BackHandler.init(self, callback, params) function BackHandler.init(self, callback, params)
@ -31,7 +31,7 @@ end
--- Input handler for component --- Input handler for component
-- @tparam BackHandler self -- @tparam BackHandler self @{BackHandler}
-- @tparam string action_id on_input action id -- @tparam string action_id on_input action id
-- @tparam table action on_input action -- @tparam table action on_input action
function BackHandler.on_input(self, action_id, action) function BackHandler.on_input(self, action_id, action)

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to block input on specify zone by node --- Component to block input on specify zone by node
-- @module Blocker -- @module Blocker
@ -17,7 +17,7 @@ local Blocker = component.create("blocker")
--- Component init function --- Component init function
-- @tparam Blocker self -- @tparam Blocker self @{Blocker}
-- @tparam node node Gui node -- @tparam node node Gui node
function Blocker.init(self, node) function Blocker.init(self, node)
self.node = self:get_node(node) self.node = self:get_node(node)
@ -44,7 +44,7 @@ end
--- Set enabled blocker component state --- Set enabled blocker component state
-- @tparam Blocker self -- @tparam Blocker self @{Blocker}
-- @tparam bool state Enabled state -- @tparam bool state Enabled state
function Blocker.set_enabled(self, state) function Blocker.set_enabled(self, state)
gui.set_enabled(self.node, state) gui.set_enabled(self.node, state)
@ -52,7 +52,7 @@ end
--- Return blocked enabled state --- Return blocked enabled state
-- @tparam Blocker self -- @tparam Blocker self @{Blocker}
-- @treturn bool True, if blocker is enabled -- @treturn bool True, if blocker is enabled
function Blocker.is_enabled(self) function Blocker.is_enabled(self)
return gui.is_enabled(self.node) return gui.is_enabled(self.node)

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle basic GUI button --- Component to handle basic GUI button
-- @module Button -- @module Button
@ -6,22 +6,22 @@
-- @alias druid.button -- @alias druid.button
--- On release button callback(self, params, button_instance) --- On release button callback(self, params, button_instance)
-- @tfield druid_event on_click -- @tfield DruidEvent on_click @{DruidEvent}
--- On repeated action button callback(self, params, button_instance, click_amount) --- On repeated action button callback(self, params, button_instance, click_amount)
-- @tfield druid_event on_repeated_click -- @tfield DruidEvent on_repeated_click @{DruidEvent}
---On long tap button callback(self, params, button_instance, time) ---On long tap button callback(self, params, button_instance, time)
-- @tfield druid_event on_long_click -- @tfield DruidEvent on_long_click @{DruidEvent}
---On double tap button callback(self, params, button_instance, click_amount) ---On double tap button callback(self, params, button_instance, click_amount)
-- @tfield druid_event on_double_click -- @tfield DruidEvent on_double_click @{DruidEvent}
---On button hold before long_click callback(self, params, button_instance, time) ---On button hold before long_click callback(self, params, button_instance, time)
-- @tfield druid_event on_hold_callback -- @tfield DruidEvent on_hold_callback @{DruidEvent}
---On click outside of button(self, params, button_instance) ---On click outside of button(self, params, button_instance)
-- @tfield druid_event on_click_outside -- @tfield DruidEvent on_click_outside @{DruidEvent}
---Trigger node ---Trigger node
-- @tfield node node -- @tfield node node
@ -45,7 +45,7 @@
-- @tfield any params -- @tfield any params
---Druid hover logic component ---Druid hover logic component
-- @tfield druid.hover hover -- @tfield Hover hover @{Hover}
---Restriction zone ---Restriction zone
-- @tfield[opt] node click_zone -- @tfield[opt] node click_zone
@ -193,7 +193,7 @@ end
--- Component init function --- Component init function
-- @tparam Button self -- @tparam Button self @{Button}
-- @tparam node node Gui node -- @tparam node node Gui node
-- @tparam function callback Button callback -- @tparam function callback Button callback
-- @tparam[opt] table params Button callback params -- @tparam[opt] table params Button callback params
@ -339,7 +339,7 @@ end
--- Set enabled button component state --- Set enabled button component state
-- @tparam Button self -- @tparam Button self @{Button}
-- @tparam bool state Enabled state -- @tparam bool state Enabled state
-- @treturn Button Current button instance -- @treturn Button Current button instance
function Button.set_enabled(self, state) function Button.set_enabled(self, state)
@ -352,7 +352,7 @@ end
--- Return button enabled state --- Return button enabled state
-- @tparam Button self -- @tparam Button self @{Button}
-- @treturn bool True, if button is enabled -- @treturn bool True, if button is enabled
function Button.is_enabled(self) function Button.is_enabled(self)
return not self.disabled return not self.disabled
@ -361,7 +361,7 @@ end
--- Strict button click area. Useful for --- Strict button click area. Useful for
-- no click events outside stencil node -- no click events outside stencil node
-- @tparam Button self -- @tparam Button self @{Button}
-- @tparam node zone Gui node -- @tparam node zone Gui node
-- @treturn Button Current button instance -- @treturn Button Current button instance
function Button.set_click_zone(self, zone) function Button.set_click_zone(self, zone)
@ -373,7 +373,7 @@ end
--- Set key-code to trigger this button --- Set key-code to trigger this button
-- @tparam Button self -- @tparam Button self @{Button}
-- @tparam hash key The action_id of the key -- @tparam hash key The action_id of the key
-- @treturn Button Current button instance -- @treturn Button Current button instance
function Button.set_key_trigger(self, key) function Button.set_key_trigger(self, key)
@ -392,6 +392,7 @@ end
--- Set function for additional check for button click availability --- Set function for additional check for button click availability
-- @tparam Button self
-- @tparam[opt] function check_function Should return true or false. If true - button can be pressed. -- @tparam[opt] function check_function Should return true or false. If true - button can be pressed.
-- @tparam[opt] function failure_callback Function what will be called on button click, if check function return false -- @tparam[opt] function failure_callback Function what will be called on button click, if check function return false
-- @treturn Button Current button instance -- @treturn Button Current button instance

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle drag action on node. --- Component to handle drag action on node.
-- Drag have correct handling for multitouch and swap -- Drag have correct handling for multitouch and swap
@ -9,19 +9,19 @@
-- @alias druid.drag -- @alias druid.drag
--- Event on touch start callback(self) --- Event on touch start callback(self)
-- @tfield druid_event on_touch_start -- @tfield DruidEvent on_touch_start @{DruidEvent}
--- Event on touch end callback(self) --- Event on touch end callback(self)
-- @tfield druid_event on_touch_end -- @tfield DruidEvent on_touch_end @{DruidEvent}
--- Event on drag start callback(self) --- Event on drag start callback(self)
-- @tfield druid_event on_drag_start -- @tfield DruidEvent on_drag_start @{DruidEvent}
--- on drag progress callback(self, dx, dy) --- on drag progress callback(self, dx, dy)
-- @tfield druid_event on_drag Event -- @tfield DruidEvent on_drag Event @{DruidEvent}
--- Event on drag end callback(self) --- Event on drag end callback(self)
-- @tfield druid_event on_drag_end -- @tfield DruidEvent on_drag_end @{DruidEvent}
--- Is component now touching --- Is component now touching
-- @tfield bool is_touch -- @tfield bool is_touch
@ -162,7 +162,7 @@ end
--- Drag component constructor --- Drag component constructor
-- @tparam Drag self -- @tparam Drag self @{Drag}
-- @tparam node node GUI node to detect dragging -- @tparam node node GUI node to detect dragging
-- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy) -- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy)
function Drag.init(self, node, on_drag_callback) function Drag.init(self, node, on_drag_callback)
@ -277,7 +277,7 @@ end
--- Strict drag click area. Useful for --- Strict drag click area. Useful for
-- restrict events outside stencil node -- restrict events outside stencil node
-- @tparam Drag self -- @tparam Drag self @{Drag}
-- @tparam node node Gui node -- @tparam node node Gui node
function Drag.set_click_zone(self, node) function Drag.set_click_zone(self, node)
self.click_zone = self:get_node(node) self.click_zone = self:get_node(node)

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle hover node interaction --- Component to handle hover node interaction
-- @module Hover -- @module Hover
@ -6,10 +6,10 @@
-- @alias druid.hover -- @alias druid.hover
--- On hover callback(self, state) --- On hover callback(self, state)
-- @tfield druid_event on_hover -- @tfield DruidEvent on_hover @{DruidEvent}
--- On mouse hover callback(self, state) --- On mouse hover callback(self, state)
-- @tfield druid_event on_mouse_hover -- @tfield DruidEvent on_mouse_hover @{DruidEvent}
--- ---
@ -22,7 +22,7 @@ local Hover = component.create("hover")
--- Component init function --- Component init function
-- @tparam Hover self -- @tparam Hover self @{Hover}
-- @tparam node node Gui node -- @tparam node node Gui node
-- @tparam function on_hover_callback Hover callback -- @tparam function on_hover_callback Hover callback
function Hover.init(self, node, on_hover_callback) function Hover.init(self, node, on_hover_callback)
@ -90,7 +90,7 @@ end
--- Set hover state --- Set hover state
-- @tparam Hover self -- @tparam Hover self @{Hover}
-- @tparam bool state The hover state -- @tparam bool state The hover state
function Hover.set_hover(self, state) function Hover.set_hover(self, state)
if self._is_hovered ~= state then if self._is_hovered ~= state then
@ -100,7 +100,7 @@ function Hover.set_hover(self, state)
end end
--- Set mouse hover state --- Set mouse hover state
-- @tparam Hover self -- @tparam Hover self @{Hover}
-- @tparam bool state The mouse hover state -- @tparam bool state The mouse hover state
function Hover.set_mouse_hover(self, state) function Hover.set_mouse_hover(self, state)
if self._is_mouse_hovered ~= state then if self._is_mouse_hovered ~= state then
@ -112,7 +112,7 @@ end
--- Strict hover click area. Useful for --- Strict hover click area. Useful for
-- no click events outside stencil node -- no click events outside stencil node
-- @tparam Hover self -- @tparam Hover self @{Hover}
-- @tparam node zone Gui node -- @tparam node zone Gui node
function Hover.set_click_zone(self, zone) function Hover.set_click_zone(self, zone)
self.click_zone = self:get_node(zone) self.click_zone = self:get_node(zone)
@ -122,7 +122,7 @@ end
--- Set enable state of hover component. --- Set enable state of hover component.
-- If hover is not enabled, it will not generate -- If hover is not enabled, it will not generate
-- any hover events -- any hover events
-- @tparam Hover self -- @tparam Hover self @{Hover}
-- @tparam bool state The hover enabled state -- @tparam bool state The hover enabled state
function Hover.set_enabled(self, state) function Hover.set_enabled(self, state)
self._is_enabled = state self._is_enabled = state
@ -139,7 +139,7 @@ end
--- Return current hover enabled state --- Return current hover enabled state
-- @tparam Hover self -- @tparam Hover self @{Hover}
-- @treturn bool The hover enabled state -- @treturn bool The hover enabled state
function Hover.is_enabled(self) function Hover.is_enabled(self)
return self._is_enabled return self._is_enabled

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle scroll content. --- Component to handle scroll content.
-- Scroll consist from two nodes: scroll parent and scroll input -- Scroll consist from two nodes: scroll parent and scroll input
@ -13,13 +13,13 @@
--- On scroll move callback(self, position) --- On scroll move callback(self, position)
-- @tfield druid_event on_scroll -- @tfield DruidEvent on_scroll @{DruidEvent}
--- On scroll_to function callback(self, target, is_instant) --- On scroll_to function callback(self, target, is_instant)
-- @tfield druid_event on_scroll_to -- @tfield DruidEvent on_scroll_to @{DruidEvent}
--- On scroll_to_index function callback(self, index, point) --- On scroll_to_index function callback(self, index, point)
-- @tfield druid_event on_point_scroll -- @tfield DruidEvent on_point_scroll @{DruidEvent}
--- Scroll view node --- Scroll view node
-- @tfield node view_node -- @tfield node view_node
@ -46,7 +46,7 @@
-- @tfield vector3 available_size -- @tfield vector3 available_size
--- Drag Druid component --- Drag Druid component
-- @tfield Drag drag -- @tfield Drag drag @{Drag}
--- Current index of points of interests --- Current index of points of interests
-- @tfield[opt] number selected -- @tfield[opt] number selected
@ -133,13 +133,14 @@ end
--- Scroll constructor --- Scroll constructor
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam node view_node GUI view scroll node -- @tparam node view_node GUI view scroll node
-- @tparam node content_node GUI content scroll node -- @tparam node content_node GUI content scroll node
function Scroll.init(self, view_node, content_node) function Scroll.init(self, view_node, content_node)
self.druid = self:get_druid() self.druid = self:get_druid()
self.view_node = self:get_node(view_node) self.view_node = self:get_node(view_node)
self.view_border = helper.get_border(self.view_node)
self.content_node = self:get_node(content_node) self.content_node = self:get_node(content_node)
self.view_size = vmath.mul_per_elem(gui.get_size(self.view_node), gui.get_scale(self.view_node)) self.view_size = vmath.mul_per_elem(gui.get_size(self.view_node), gui.get_scale(self.view_node))
@ -168,7 +169,6 @@ function Scroll.init(self, view_node, content_node)
self._is_vertical_scroll = true self._is_vertical_scroll = true
self._grid_on_change = nil self._grid_on_change = nil
self._grid_on_change_callback = nil self._grid_on_change_callback = nil
self._outside_offset_vector = vmath.vector3(0)
self:_update_size() self:_update_size()
end end
@ -190,8 +190,6 @@ end
function Scroll.update(self, dt) function Scroll.update(self, dt)
self:_update_params()
if self.drag.is_drag then if self.drag.is_drag then
self:_update_hand_scroll(dt) self:_update_hand_scroll(dt)
else else
@ -211,7 +209,7 @@ end
--- Start scroll to target point. --- Start scroll to target point.
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam vector3 point Target point -- @tparam vector3 point Target point
-- @tparam[opt] bool is_instant Instant scroll flag -- @tparam[opt] bool is_instant Instant scroll flag
-- @usage scroll:scroll_to(vmath.vector3(0, 50, 0)) -- @usage scroll:scroll_to(vmath.vector3(0, 50, 0))
@ -245,7 +243,7 @@ end
--- Scroll to item in scroll by point index. --- Scroll to item in scroll by point index.
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam number index Point index -- @tparam number index Point index
-- @tparam[opt] bool skip_cb If true, skip the point callback -- @tparam[opt] bool skip_cb If true, skip the point callback
function Scroll.scroll_to_index(self, index, skip_cb) function Scroll.scroll_to_index(self, index, skip_cb)
@ -268,7 +266,7 @@ end
--- Start scroll to target scroll percent --- Start scroll to target scroll percent
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam vector3 percent target percent -- @tparam vector3 percent target percent
-- @tparam[opt] bool is_instant instant scroll flag -- @tparam[opt] bool is_instant instant scroll flag
-- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0)) -- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0))
@ -277,7 +275,7 @@ function Scroll.scroll_to_percent(self, percent, is_instant)
local pos = vmath.vector3( local pos = vmath.vector3(
-helper.lerp(border.x, border.z, 1 - percent.x), -helper.lerp(border.x, border.z, 1 - percent.x),
helper.lerp(border.y, border.w, 1 - percent.y), -helper.lerp(border.y, border.w, 1 - percent.y),
0 0
) )
@ -287,7 +285,7 @@ end
--- Return current scroll progress status. --- Return current scroll progress status.
-- Values will be in [0..1] interval -- Values will be in [0..1] interval
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @treturn vector3 New vector with scroll progress values -- @treturn vector3 New vector with scroll progress values
function Scroll.get_percent(self) function Scroll.get_percent(self)
local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x) local x_perc = 1 - inverse_lerp(self.available_pos.x, self.available_pos.z, self.position.x)
@ -299,7 +297,7 @@ end
--- Set scroll content size. --- Set scroll content size.
-- It will change content gui node size -- It will change content gui node size
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam vector3 size The new size for content node -- @tparam vector3 size The new size for content node
-- @tparam vector3 offset Offset value to set, where content is starts -- @tparam vector3 offset Offset value to set, where content is starts
-- @treturn druid.scroll Current scroll instance -- @treturn druid.scroll Current scroll instance
@ -317,7 +315,7 @@ end
--- Enable or disable scroll inert. --- Enable or disable scroll inert.
-- If disabled, scroll through points (if exist) -- If disabled, scroll through points (if exist)
-- If no points, just simple drag without inertion -- If no points, just simple drag without inertion
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam bool state Inert scroll state -- @tparam bool state Inert scroll state
-- @treturn druid.scroll Current scroll instance -- @treturn druid.scroll Current scroll instance
function Scroll.set_inert(self, state) function Scroll.set_inert(self, state)
@ -328,7 +326,7 @@ end
--- Return if scroll have inertion. --- Return if scroll have inertion.
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @treturn bool If scroll have inertion -- @treturn bool If scroll have inertion
function Scroll.is_inert(self) function Scroll.is_inert(self)
return self._is_inert return self._is_inert
@ -337,7 +335,7 @@ 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
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @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 Current scroll instance -- @treturn druid.scroll Current scroll instance
function Scroll.set_extra_stretch_size(self, stretch_size) function Scroll.set_extra_stretch_size(self, stretch_size)
@ -349,7 +347,7 @@ end
--- Return vector of scroll size with width and height. --- Return vector of scroll size with width and height.
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @treturn vector3 Available scroll size -- @treturn vector3 Available scroll size
function Scroll.get_scroll_size(self) function Scroll.get_scroll_size(self)
return self.available_size return self.available_size
@ -358,7 +356,7 @@ end
--- Set points of interest. --- Set points of interest.
-- Scroll will always centered on closer points -- Scroll will always centered on closer points
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam table points Array of vector3 points -- @tparam table points Array of vector3 points
-- @treturn druid.scroll Current scroll instance -- @treturn druid.scroll Current scroll instance
function Scroll.set_points(self, points) function Scroll.set_points(self, points)
@ -375,7 +373,7 @@ end
--- Lock or unlock horizontal scroll --- Lock or unlock horizontal scroll
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam bool state True, if horizontal scroll is enabled -- @tparam bool state True, if horizontal scroll is enabled
-- @treturn druid.scroll Current scroll instance -- @treturn druid.scroll Current scroll instance
function Scroll.set_horizontal_scroll(self, state) function Scroll.set_horizontal_scroll(self, state)
@ -386,7 +384,7 @@ end
--- Lock or unlock vertical scroll --- Lock or unlock vertical scroll
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam bool state True, if vertical scroll is enabled -- @tparam bool state True, if vertical scroll is enabled
-- @treturn druid.scroll Current scroll instance -- @treturn druid.scroll Current scroll instance
function Scroll.set_vertical_scroll(self, state) function Scroll.set_vertical_scroll(self, state)
@ -398,20 +396,38 @@ end
--- Check node if it visible now on scroll. --- Check node if it visible now on scroll.
-- Extra border is not affected. Return true for elements in extra scroll zone -- Extra border is not affected. Return true for elements in extra scroll zone
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam node node The node to check -- @tparam node node The node to check
-- @treturn boolean True if node in visible scroll area -- @treturn boolean True if node in visible scroll area
function Scroll.is_node_in_view(self, node) function Scroll.is_node_in_view(self, node)
local node_border = helper.get_border(node, gui.get_position(node)) local node_offset_for_view = gui.get_position(node)
local view_border = helper.get_border(self.view_node, -(self.position - self._outside_offset_vector)) local parent = gui.get_parent(node)
local is_parent_of_view = false
while parent do
if parent ~= self.view_node then
local parent_pos = gui.get_position(parent)
node_offset_for_view.x = node_offset_for_view.x + parent_pos.x
node_offset_for_view.y = node_offset_for_view.y + parent_pos.y
parent = gui.get_parent(parent)
else
is_parent_of_view = true
parent = nil
end
end
if not is_parent_of_view then
error("The node to check is_node_in_view should be child if scroll view")
return false
end
local node_border = helper.get_border(node, node_offset_for_view)
-- Check is vertical outside (Left or Right): -- Check is vertical outside (Left or Right):
if node_border.z < view_border.x or node_border.x > view_border.z then if node_border.z < self.view_border.x or node_border.x > self.view_border.z then
return false return false
end end
-- Check is horizontal outside (Up or Down): -- Check is horizontal outside (Up or Down):
if node_border.w > view_border.y or node_border.y < view_border.w then if node_border.w > self.view_border.y or node_border.y < self.view_border.w then
return false return false
end end
@ -421,7 +437,7 @@ end
--- Bind the grid component (Static or Dynamic) to recalculate --- Bind the grid component (Static or Dynamic) to recalculate
-- scroll size on grid changes -- scroll size on grid changes
-- @tparam Scroll self -- @tparam Scroll self @{Scroll}
-- @tparam StaticGrid|DynamicGrid grid Druid grid component -- @tparam StaticGrid|DynamicGrid grid Druid grid component
-- @treturn druid.scroll Current scroll instance -- @treturn druid.scroll Current scroll instance
function Scroll.bind_grid(self, grid) function Scroll.bind_grid(self, grid)
@ -438,7 +454,10 @@ function Scroll.bind_grid(self, grid)
self._grid_on_change = grid.on_change_items self._grid_on_change = grid.on_change_items
self._grid_on_change_callback = self._grid_on_change:subscribe(function() self._grid_on_change_callback = self._grid_on_change:subscribe(function()
self:set_size(grid:get_size(), grid:get_offset()) local size = grid:get_size()
local offset = grid:get_offset()
self:set_size(size, offset)
self:log_message("Change size from grid", { size = size, offset = offset })
end) end)
self:set_size(grid:get_size(), grid:get_offset()) self:set_size(grid:get_size(), grid:get_offset())
@ -524,7 +543,7 @@ function Scroll._check_soft_zone(self)
end end
--- Cancel animation on other animation or input touch -- Cancel animation on other animation or input touch
function Scroll._cancel_animate(self) function Scroll._cancel_animate(self)
self.inertion.x = 0 self.inertion.x = 0
self.inertion.y = 0 self.inertion.y = 0
@ -547,7 +566,6 @@ function Scroll._set_scroll_position(self, position)
if self.position.x ~= position.x or self.position.y ~= position.y then if self.position.x ~= position.x or self.position.y ~= position.y then
self.position.x = position.x self.position.x = position.x
self.position.y = position.y self.position.y = position.y
self:_update_params()
gui.set_position(self.content_node, position) gui.set_position(self.content_node, position)
self.on_scroll:trigger(self:get_context(), self.position) self.on_scroll:trigger(self:get_context(), self.position)
@ -675,12 +693,10 @@ end
function Scroll._update_size(self) function Scroll._update_size(self)
local view_border = helper.get_border(self.view_node)
local content_border = helper.get_border(self.content_node) local content_border = helper.get_border(self.content_node)
local content_size = vmath.mul_per_elem(gui.get_size(self.content_node), gui.get_scale(self.content_node)) local content_size = vmath.mul_per_elem(gui.get_size(self.content_node), gui.get_scale(self.content_node))
self.available_pos = get_border_vector(view_border - content_border, self._offset) self.available_pos = get_border_vector(self.view_border - content_border, self._offset)
self.available_size = get_size_vector(self.available_pos) self.available_size = get_size_vector(self.available_pos)
self.drag.can_x = self.available_size.x > 0 and self._is_horizontal_scroll self.drag.can_x = self.available_size.x > 0 and self._is_horizontal_scroll
@ -709,7 +725,7 @@ function Scroll._update_size(self)
self.drag.can_y = content_size.y > self.view_size.y self.drag.can_y = content_size.y > self.view_size.y
end end
self.available_pos_extra = get_border_vector(view_border - content_border_extra, self._offset) self.available_pos_extra = get_border_vector(self.view_border - content_border_extra, self._offset)
self.available_size_extra = get_size_vector(self.available_pos_extra) self.available_size_extra = get_size_vector(self.available_pos_extra)
self:_set_scroll_position(self.position) self:_set_scroll_position(self.position)
@ -718,32 +734,6 @@ function Scroll._update_size(self)
end end
function Scroll._update_params(self)
local t = self.target_position
local b = self.available_pos
self._outside_offset_vector.x = 0
self._outside_offset_vector.y = 0
-- Right border (minimum x)
if t.x < b.x then
self._outside_offset_vector.x = t.x - b.x
end
-- Left border (maximum x)
if t.x > b.z then
self._outside_offset_vector.x = t.x - b.z
end
-- Top border (minimum y)
if t.y < b.y then
self._outside_offset_vector.y = t.y - b.y
end
-- Bot border (maximum y)
if t.y > b.w then
self._outside_offset_vector.y = t.y - b.w
end
end
function Scroll._process_scroll_wheel(self, action_id, action) function Scroll._process_scroll_wheel(self, action_id, action)
if not self._is_mouse_hover or self.style.WHEEL_SCROLL_SPEED == 0 then if not self._is_mouse_hover or self.style.WHEEL_SCROLL_SPEED == 0 then
return false return false

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle placing components by row and columns. --- Component to handle placing components by row and columns.
-- Grid can anchor your elements, get content size and other -- Grid can anchor your elements, get content size and other
@ -7,19 +7,19 @@
-- @alias druid.static_grid -- @alias druid.static_grid
--- On item add callback(self, node, index) --- On item add callback(self, node, index)
-- @tfield druid_event on_add_item -- @tfield DruidEvent on_add_item @{DruidEvent}
--- On item remove callback(self, index) --- On item remove callback(self, index)
-- @tfield druid_event on_remove_item -- @tfield DruidEvent on_remove_item @{DruidEvent}
--- On item add or remove callback(self, index) --- On item add, remove or change in_row callback(self, index|nil)
-- @tfield druid_event on_change_items -- @tfield DruidEvent on_change_items @{DruidEvent}
--- On grid clear callback(self) --- On grid clear callback(self)
-- @tfield druid_event on_clear -- @tfield DruidEvent on_clear @{DruidEvent}
--- On update item positions callback(self) --- On update item positions callback(self)
-- @tfield druid_event on_update_positions -- @tfield DruidEvent on_update_positions @{DruidEvent}
--- Parent gui node --- Parent gui node
-- @tfield node parent -- @tfield node parent
@ -79,7 +79,7 @@ end
--- Component init function --- Component init function
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam node parent The gui node parent, where items will be placed -- @tparam node parent The gui node parent, where items will be placed
-- @tparam node element Element prefab. Need to get it size -- @tparam node element Element prefab. Need to get it size
-- @tparam[opt=1] number in_row How many nodes in row can be placed -- @tparam[opt=1] number in_row How many nodes in row can be placed
@ -117,7 +117,7 @@ end
local _temp_pos = vmath.vector3(0) local _temp_pos = vmath.vector3(0)
--- Return pos for grid node index --- Return pos for grid node index
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam number index The grid element index -- @tparam number index The grid element index
-- @treturn vector3 Node position -- @treturn vector3 Node position
function StaticGrid.get_pos(self, index) function StaticGrid.get_pos(self, index)
@ -135,7 +135,7 @@ end
--- Return index for grid pos --- Return index for grid pos
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam vector3 pos The node position in the grid -- @tparam vector3 pos The node position in the grid
-- @treturn number The node index -- @treturn number The node index
function StaticGrid.get_index(self, pos) function StaticGrid.get_index(self, pos)
@ -151,7 +151,7 @@ end
--- Return grid index by node --- Return grid index by node
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam node node The gui node in the grid -- @tparam node node The gui node in the grid
-- @treturn number The node index -- @treturn number The node index
function StaticGrid.get_index_by_node(self, node) function StaticGrid.get_index_by_node(self, node)
@ -171,7 +171,7 @@ end
--- Set grid anchor. Default anchor is equal to anchor of grid parent node --- Set grid anchor. Default anchor is equal to anchor of grid parent node
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam vector3 anchor Anchor -- @tparam vector3 anchor Anchor
function StaticGrid.set_anchor(self, anchor) function StaticGrid.set_anchor(self, anchor)
self.anchor = anchor self.anchor = anchor
@ -180,11 +180,11 @@ end
--- Add new item to the grid --- Add new item to the grid
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam node item Gui node -- @tparam node item Gui node
-- @tparam[opt] number index The item position. By default add as last item -- @tparam[opt] number index The item position. By default add as last item
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT -- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instance If true, update node positions instantly -- @tparam[opt=false] boolean is_instant If true, update node positions instantly
function StaticGrid.add(self, item, index, shift_policy, is_instant) function StaticGrid.add(self, item, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT shift_policy = shift_policy or const.SHIFT.RIGHT
index = index or ((self.last_index or 0) + 1) index = index or ((self.last_index or 0) + 1)
@ -219,10 +219,10 @@ end
--- Remove the item from the grid. Note that gui node will be not deleted --- Remove the item from the grid. Note that gui node will be not deleted
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam number index The grid node index to remove -- @tparam number index The grid node index to remove
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT -- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instance If true, update node positions instantly -- @tparam[opt=false] boolean is_instant If true, update node positions instantly
-- @treturn Node The deleted gui node from grid -- @treturn Node The deleted gui node from grid
function StaticGrid.remove(self, index, shift_policy, is_instant) function StaticGrid.remove(self, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT shift_policy = shift_policy or const.SHIFT.RIGHT
@ -252,7 +252,7 @@ end
--- Return grid content size --- Return grid content size
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3 The grid content size -- @treturn vector3 The grid content size
function StaticGrid.get_size(self) function StaticGrid.get_size(self)
return vmath.vector3( return vmath.vector3(
@ -262,7 +262,6 @@ function StaticGrid.get_size(self)
end end
function StaticGrid.get_size_for(self, count) function StaticGrid.get_size_for(self, count)
if not count or count == 0 then if not count or count == 0 then
return vmath.vector3(0) return vmath.vector3(0)
@ -286,7 +285,7 @@ end
--- Return grid content borders --- Return grid content borders
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3 The grid content borders -- @treturn vector3 The grid content borders
function StaticGrid.get_borders(self) function StaticGrid.get_borders(self)
return self.border return self.border
@ -294,7 +293,7 @@ end
--- Return array of all node positions --- Return array of all node positions
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @treturn vector3[] All grid node positions -- @treturn vector3[] All grid node positions
function StaticGrid.get_all_pos(self) function StaticGrid.get_all_pos(self)
local result = {} local result = {}
@ -308,7 +307,7 @@ end
--- Change set position function for grid nodes. It will call on --- Change set position function for grid nodes. It will call on
-- update poses on grid elements. Default: gui.set_position -- update poses on grid elements. Default: gui.set_position
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam function callback Function on node set position -- @tparam function callback Function on node set position
-- @treturn druid.static_grid Current grid instance -- @treturn druid.static_grid Current grid instance
function StaticGrid.set_position_function(self, callback) function StaticGrid.set_position_function(self, callback)
@ -320,7 +319,7 @@ end
--- Clear grid nodes array. GUI nodes will be not deleted! --- Clear grid nodes array. GUI nodes will be not deleted!
-- If you want to delete GUI nodes, use static_grid.nodes array before grid:clear -- If you want to delete GUI nodes, use static_grid.nodes array before grid:clear
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @treturn druid.static_grid Current grid instance -- @treturn druid.static_grid Current grid instance
function StaticGrid.clear(self) function StaticGrid.clear(self)
self.border.x = 0 self.border.x = 0
@ -338,7 +337,7 @@ end
--- Return StaticGrid offset, where StaticGrid content starts. --- Return StaticGrid offset, where StaticGrid content starts.
-- @tparam StaticGrid self The StaticGrid instance -- @tparam StaticGrid self @{StaticGrid} The StaticGrid instance
-- @treturn vector3 The StaticGrid offset -- @treturn vector3 The StaticGrid offset
function StaticGrid:get_offset() function StaticGrid:get_offset()
local borders = self:get_borders() local borders = self:get_borders()
@ -353,8 +352,22 @@ function StaticGrid:get_offset()
end end
--- Set new in_row elements for grid
-- @tparam StaticGrid self @{StaticGrid}
-- @tparam number in_row The new in_row value
-- @treturn druid.static_grid Current grid instance
function StaticGrid.set_in_row(self, in_row)
self.in_row = in_row
self._grid_horizonal_offset = self.node_size.x * (self.in_row - 1) * self.anchor.x
self:_update(true)
self.on_change_items:trigger(self:get_context())
return self
end
--- Update grid inner state --- Update grid inner state
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback -- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local -- @local
function StaticGrid._update(self, is_instant) function StaticGrid._update(self, is_instant)
@ -365,7 +378,7 @@ end
--- Update first and last indexes of grid nodes --- Update first and last indexes of grid nodes
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @local -- @local
function StaticGrid._update_indexes(self) function StaticGrid._update_indexes(self)
self.first_index = nil self.first_index = nil
@ -381,7 +394,7 @@ end
--- Update grid content borders, recalculate min and max values --- Update grid content borders, recalculate min and max values
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @local -- @local
function StaticGrid._update_borders(self) function StaticGrid._update_borders(self)
if not self.first_index then if not self.first_index then
@ -400,7 +413,7 @@ end
--- Update grid nodes position --- Update grid nodes position
-- @tparam StaticGrid self -- @tparam StaticGrid self @{StaticGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback -- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local -- @local
function StaticGrid._update_pos(self, is_instant) function StaticGrid._update_pos(self, is_instant)
@ -424,7 +437,6 @@ end
--- Return elements offset for correct posing nodes. Correct posing at --- Return elements offset for correct posing nodes. Correct posing at
-- parent pivot node (0:0) with adjusting of node sizes and anchoring -- parent pivot node (0:0) with adjusting of node sizes and anchoring
-- @function static_grid:_get_zero_offset
-- @treturn vector3 The offset vector -- @treturn vector3 The offset vector
-- @local -- @local
function StaticGrid:_get_zero_offset() function StaticGrid:_get_zero_offset()
@ -442,7 +454,6 @@ end
--- Return offset x for last row in grid. Used to align this row accorting to grid's anchor --- Return offset x for last row in grid. Used to align this row accorting to grid's anchor
-- @function static:_grid:_get_zero_offset_x
-- @treturn number The offset x value -- @treturn number The offset x value
-- @local -- @local
function StaticGrid:_get_zero_offset_x(row_index) function StaticGrid:_get_zero_offset_x(row_index)
@ -463,5 +474,4 @@ function StaticGrid:_get_zero_offset_x(row_index)
end end
return StaticGrid return StaticGrid

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle swipe gestures on node. --- Component to handle swipe gestures on node.
-- Swipe will be triggered, if swipe was started and -- Swipe will be triggered, if swipe was started and
@ -13,8 +13,8 @@
--- Restriction zone --- Restriction zone
-- @tparam[opt] node click_zone -- @tparam[opt] node click_zone
--- Trigger on swipe event(self, swipe_side, dist, delta_time --- Trigger on swipe event(self, swipe_side, dist, delta_time)
-- @tfield druid_event on_swipe) -- @tfield DruidEvent on_swipe) @{DruidEvent}
--- ---
@ -84,7 +84,7 @@ end
--- Component init function --- Component init function
-- @tparam Swipe self -- @tparam Swipe self @{Swipe}
-- @tparam node node Gui node -- @tparam node node Gui node
-- @tparam function on_swipe_callback Swipe callback for on_swipe_end event -- @tparam function on_swipe_callback Swipe callback for on_swipe_end event
function Swipe.init(self, node, on_swipe_callback) function Swipe.init(self, node, on_swipe_callback)
@ -139,6 +139,8 @@ function Swipe.on_input(self, action_id, action)
if action.released then if action.released then
reset_swipe(self, action) reset_swipe(self, action)
end end
return true
end end
@ -149,7 +151,7 @@ end
--- Strict swipe click area. Useful for --- Strict swipe click area. Useful for
-- restrict events outside stencil node -- restrict events outside stencil node
-- @tparam Swipe self -- @tparam Swipe self @{Swipe}
-- @tparam node zone Gui node -- @tparam node zone Gui node
function Swipe.set_click_zone(self, zone) function Swipe.set_click_zone(self, zone)
self.click_zone = self:get_node(zone) self.click_zone = self:get_node(zone)

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle all GUI texts. --- Component to handle all GUI texts.
-- Druid text can adjust itself for text node size -- Druid text can adjust itself for text node size
@ -8,13 +8,13 @@
-- @alias druid.text -- @alias druid.text
--- On set text callback(self, text) --- On set text callback(self, text)
-- @tfield druid_event on_set_text -- @tfield DruidEvent on_set_text @{DruidEvent}
--- On adjust text size callback(self, new_scale) --- On adjust text size callback(self, new_scale)
-- @tfield druid_event on_update_text_scale -- @tfield DruidEvent on_update_text_scale @{DruidEvent}
--- On change pivot callback(self, pivot) --- On change pivot callback(self, pivot)
-- @tfield druid_event on_set_pivot -- @tfield DruidEvent on_set_pivot @{DruidEvent}
--- Text node --- Text node
-- @tfield node node -- @tfield node node
@ -105,7 +105,7 @@ end
local function update_text_with_trim(self, trim_postfix) local function update_text_with_trim(self, trim_postfix)
local max_width = self.text_area.x local max_width = self.text_area.x
local text_width = self:get_text_width() local text_width = self:get_text_size()
if text_width > max_width then if text_width > max_width then
local text_length = utf8.len(self.last_value) local text_length = utf8.len(self.last_value)
@ -113,7 +113,7 @@ local function update_text_with_trim(self, trim_postfix)
while text_width > max_width do while text_width > max_width do
text_length = text_length - 1 text_length = text_length - 1
new_text = utf8.sub(self.last_value, 1, text_length) new_text = utf8.sub(self.last_value, 1, text_length)
text_width = self:get_text_width(new_text .. trim_postfix) text_width = self:get_text_size(new_text .. trim_postfix)
end end
gui.set_text(self.node, new_text .. trim_postfix) gui.set_text(self.node, new_text .. trim_postfix)
@ -122,7 +122,7 @@ end
local function update_text_with_anchor_shift(self) local function update_text_with_anchor_shift(self)
if self:get_text_width() >= self.text_area.x then if self:get_text_size() >= self.text_area.x then
self:set_pivot(const.REVERSE_PIVOTS[self.start_pivot]) self:set_pivot(const.REVERSE_PIVOTS[self.start_pivot])
else else
self:set_pivot(self.start_pivot) self:set_pivot(self.start_pivot)
@ -185,7 +185,7 @@ end
--- Component init function --- Component init function
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam node node Gui text node -- @tparam node node Gui text node
-- @tparam[opt] string value Initial text. Default value is node text from GUI scene. -- @tparam[opt] string value Initial text. Default value is node text from GUI scene.
-- @tparam[opt=0] int adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference -- @tparam[opt=0] int adjust_type Adjust type for text. By default is DOWNSCALE. Look const.TEXT_ADJUST for reference
@ -234,28 +234,32 @@ end
--- Calculate text width with font with respect to trailing space --- Calculate text width with font with respect to trailing space
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam[opt] string text -- @tparam[opt] string text
function Text.get_text_width(self, text) -- @treturn number Width
-- @treturn number Height
function Text.get_text_size(self, text)
text = text or self.last_value text = text or self.last_value
local font = gui.get_font(self.node) local font = gui.get_font(self.node)
local scale = gui.get_scale(self.node) local scale = gui.get_scale(self.node)
local result = gui.get_text_metrics(font, text, 0, false, 0, 0).width local linebreak = gui.get_line_break(self.node)
local metrics = gui.get_text_metrics(font, text, 0, linebreak, 0, 0)
local width = metrics.width
for i = #text, 1, -1 do for i = #text, 1, -1 do
local c = string.sub(text, i, i) local c = string.sub(text, i, i)
if c ~= ' ' then if c ~= ' ' then
break break
end end
result = result + get_space_width(self, font) width = width + get_space_width(self, font)
end end
return result * scale.x return width * scale.x, metrics.height * scale.y
end end
--- Set text to text field --- Set text to text field
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam string set_to Text for node -- @tparam string set_to Text for node
-- @treturn Text Current text instance -- @treturn Text Current text instance
function Text.set_to(self, set_to) function Text.set_to(self, set_to)
@ -273,7 +277,7 @@ end
--- Set color --- Set color
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam vector4 color Color for node -- @tparam vector4 color Color for node
-- @treturn Text Current text instance -- @treturn Text Current text instance
function Text.set_color(self, color) function Text.set_color(self, color)
@ -285,7 +289,7 @@ end
--- Set alpha --- Set alpha
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam number alpha Alpha for node -- @tparam number alpha Alpha for node
-- @treturn Text Current text instance -- @treturn Text Current text instance
function Text.set_alpha(self, alpha) function Text.set_alpha(self, alpha)
@ -297,7 +301,7 @@ end
--- Set scale --- Set scale
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam vector3 scale Scale for node -- @tparam vector3 scale Scale for node
-- @treturn Text Current text instance -- @treturn Text Current text instance
function Text.set_scale(self, scale) function Text.set_scale(self, scale)
@ -309,7 +313,7 @@ end
--- Set text pivot. Text will re-anchor inside text area --- Set text pivot. Text will re-anchor inside text area
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam gui.pivot pivot Gui pivot constant -- @tparam gui.pivot pivot Gui pivot constant
-- @treturn Text Current text instance -- @treturn Text Current text instance
function Text.set_pivot(self, pivot) function Text.set_pivot(self, pivot)
@ -335,7 +339,7 @@ end
--- Return true, if text with line break --- Return true, if text with line break
-- @tparam Text self -- @tparam Text self @{Text}
-- @treturn bool Is text node with line break -- @treturn bool Is text node with line break
function Text.is_multiline(self) function Text.is_multiline(self)
return gui.get_line_break(self.node) return gui.get_line_break(self.node)
@ -343,7 +347,7 @@ end
--- Set text adjust, refresh the current text visuals, if needed --- Set text adjust, refresh the current text visuals, if needed
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam[opt] number adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type -- @tparam[opt] number adjust_type See const.TEXT_ADJUST. If pass nil - use current adjust type
-- @tparam[opt] number minimal_scale If pass nil - not use minimal scale -- @tparam[opt] number minimal_scale If pass nil - not use minimal scale
-- @treturn Text Current text instance -- @treturn Text Current text instance
@ -357,7 +361,7 @@ end
--- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types --- Set minimal scale for DOWNSCALE_LIMITED or SCALE_THEN_SCROLL adjust types
-- @tparam Text self -- @tparam Text self @{Text}
-- @tparam number minimal_scale If pass nil - not use minimal scale -- @tparam number minimal_scale If pass nil - not use minimal scale
-- @treturn Text Current text instance -- @treturn Text Current text instance
function Text.set_minimal_scale(self, minimal_scale) function Text.set_minimal_scale(self, minimal_scale)

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Basic class for all Druid components. --- Basic class for all Druid components.
-- To create you component, use `component.create` -- To create you component, use `component.create`
@ -12,6 +12,9 @@ local helper = require("druid.helper")
local BaseComponent = class("druid.component") local BaseComponent = class("druid.component")
local INTERESTS = {} -- Cache interests by component class in runtime
local IS_AUTO_TEMPLATE = not (sys.get_config("druid.no_auto_template") == "1")
--- Component Interests --- Component Interests
BaseComponent.ON_INPUT = const.ON_INPUT BaseComponent.ON_INPUT = const.ON_INPUT
@ -55,10 +58,10 @@ function BaseComponent.static.get_uid()
end end
--- Set current component style table. --- Set current component style table (protected).
-- Invoke `on_style_change` on component, if exist. BaseComponent should handle -- Invoke `on_style_change` on component, if exist. BaseComponent should handle
-- their style changing and store all style params -- their style changing and store all style params
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @tparam table druid_style Druid style module -- @tparam table druid_style Druid style module
function BaseComponent.set_style(self, druid_style) function BaseComponent.set_style(self, druid_style)
self._meta.style = druid_style or const.EMPTY_TABLE self._meta.style = druid_style or const.EMPTY_TABLE
@ -70,24 +73,60 @@ function BaseComponent.set_style(self, druid_style)
end end
--- Set current component template name --- Set current component template name (protected)
-- @tparam BaseComponent self -- It will check parent template name to build full template name
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam string template BaseComponent template name -- @tparam string template BaseComponent template name
-- @treturn BaseComponent @{BaseComponent}
function BaseComponent.set_template(self, template) function BaseComponent.set_template(self, template)
template = template or const.EMPTY_STRING
local parent = self:get_parent_component()
if parent and IS_AUTO_TEMPLATE then
local parent_template = parent:get_template()
if #parent_template > 0 then
if #template > 0 then
template = "/" .. template
end
template = parent_template .. template
end
end
self._meta.template = template self._meta.template = template
return self
end end
--- Set current component nodes --- Get current component template name (protected)
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn string Component full template name
function BaseComponent.get_template(self)
return self._meta.template
end
--- Set current component nodes (protected)
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam table nodes BaseComponent nodes table -- @tparam table nodes BaseComponent nodes table
-- @treturn BaseComponent @{BaseComponent}
function BaseComponent.set_nodes(self, nodes) function BaseComponent.set_nodes(self, nodes)
self._meta.nodes = nodes self._meta.nodes = nodes
-- When we use gui.clone_tree in inner template (template inside other template)
-- this nodes have no id. We have table: hash(correct_id) : hash("")
-- It's wrong and we use this hack to fix this
if nodes then
for id, node in pairs(nodes) do
gui.set_id(node, id)
end
end
return self
end end
--- Get current component context --- Get current component context (protected)
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn table BaseComponent context -- @treturn table BaseComponent context
function BaseComponent.get_context(self) function BaseComponent.get_context(self)
return self._meta.context return self._meta.context
@ -95,47 +134,52 @@ end
--- Increase input priority in current input stack --- Increase input priority in current input stack
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @local -- @local
function BaseComponent.increase_input_priority(self) function BaseComponent.increase_input_priority(self)
helper.deprecated("The component:increase_input_priority is deprecated. Please use component:set_input_priority(druid_const.PRIORITY_INPUT_MAX) instead") helper.deprecated("The component:increase_input_priority is deprecated. Please use component:set_input_priority(druid_const.PRIORITY_INPUT_MAX) instead")
end end
--- Get node for component by name. --- Get node for component by name.
-- If component has nodes, node_or_name should be string -- If component has nodes, node_or_name should be string
-- It auto pick node by template name or from nodes by clone_tree -- It auto pick node by template name or from nodes by clone_tree
-- if they was setup via component:set_nodes, component:set_template -- if they was setup via component:set_nodes, component:set_template.
-- @tparam BaseComponent self -- If node is not found, the exception will fired
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam string|node node_or_name Node name or node itself -- @tparam string|node node_or_name Node name or node itself
-- @treturn node Gui node -- @treturn node Gui node
function BaseComponent.get_node(self, node_or_name) function BaseComponent.get_node(self, node_or_name)
local template_name = self:__get_template() or const.EMPTY_STRING local template_name = self:get_template()
local nodes = self:__get_nodes() local nodes = self:__get_nodes()
if template_name ~= const.EMPTY_STRING then if #template_name > 0 then
template_name = template_name .. "/" template_name = template_name .. "/"
end end
local node_type = type(node_or_name) local node
if type(node_or_name) == const.STRING then
if nodes then if nodes then
assert(node_type == const.STRING, "You should pass node name instead of node") node = nodes[template_name .. node_or_name]
return nodes[template_name .. node_or_name]
else else
if node_type == const.STRING then node = gui.get_node(template_name .. node_or_name)
return gui.get_node(template_name .. node_or_name) end
else else
-- Assume it's already node from gui.get_node -- Assume it's already node from gui.get_node
return node_or_name node = node_or_name
end end
if not node then
assert(node, "No component with name: " .. template_name .. node_or_name)
end end
return node
end end
--- Return druid with context of calling component. --- Return druid with context of calling component (protected).
-- Use it to create component inside of other components. -- Use it to create component inside of other components.
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn Druid Druid instance with component context -- @treturn Druid Druid instance with component context
function BaseComponent.get_druid(self) function BaseComponent.get_druid(self)
local context = { _context = self } local context = { _context = self }
@ -144,15 +188,24 @@ end
--- Return component name --- Return component name
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn string The component name -- @treturn string The component name
function BaseComponent.get_name(self) function BaseComponent.get_name(self)
return self._component.name return self._component.name .. self:get_uid()
end
--- Return parent component name
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn string|nil The parent component name if exist or bil
function BaseComponent.get_parent_name(self)
local parent = self:get_parent_component()
return parent and parent:get_name()
end end
--- Return component input priority --- Return component input priority
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn number The component input priority -- @treturn number The component input priority
function BaseComponent.get_input_priority(self) function BaseComponent.get_input_priority(self)
return self._component.input_priority return self._component.input_priority
@ -160,7 +213,7 @@ end
--- Set component input priority --- Set component input priority
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @tparam number value The new input priority value -- @tparam number value The new input priority value
-- @treturn number The component input priority -- @treturn number The component input priority
function BaseComponent.set_input_priority(self, value) function BaseComponent.set_input_priority(self, value)
@ -181,7 +234,7 @@ end
--- Reset component input priority to default value --- Reset component input priority to default value
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn number The component input priority -- @treturn number The component input priority
function BaseComponent.reset_input_priority(self) function BaseComponent.reset_input_priority(self)
self:set_input_priority(self._component.default_input_priority) self:set_input_priority(self._component.default_input_priority)
@ -189,8 +242,9 @@ function BaseComponent.reset_input_priority(self)
end end
--- Return component uid. UID generated in component creation order --- Return component uid (protected).
-- @tparam BaseComponent self --- UID generated in component creation order
-- @tparam BaseComponent self @{BaseComponent}
-- @treturn number The component uid -- @treturn number The component uid
function BaseComponent.get_uid(self) function BaseComponent.get_uid(self)
return self._component._uid return self._component._uid
@ -199,7 +253,7 @@ end
--- Set component input state. By default it enabled --- Set component input state. By default it enabled
-- You can disable any input of component by this function -- You can disable any input of component by this function
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @tparam bool state The component input state -- @tparam bool state The component input state
-- @treturn BaseComponent BaseComponent itself -- @treturn BaseComponent BaseComponent itself
function BaseComponent.set_input_enabled(self, state) function BaseComponent.set_input_enabled(self, state)
@ -213,43 +267,40 @@ function BaseComponent.set_input_enabled(self, state)
end end
--- Return the parent for current component --- Return the parent for current component (protected)
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn druid.base_component|nil The druid component instance or nil -- @treturn BaseComponent|nil The druid component instance or nil
function BaseComponent.get_parent_component(self) function BaseComponent.get_parent_component(self)
local context = self:get_context() return self._meta.parent
if context.isInstanceOf and context:isInstanceOf(BaseComponent) then
return context
end
return nil
end end
--- Setup component context and his style table --- Setup component context and his style table
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @tparam table druid_instance The parent druid instance -- @tparam table druid_instance The parent druid instance
-- @tparam table context Druid context. Usually it is self of script -- @tparam table context Druid context. Usually it is self of script
-- @tparam table style Druid style module -- @tparam table style Druid style module
-- @tparam table instance_class The component instance class
-- @treturn component BaseComponent itself -- @treturn component BaseComponent itself
function BaseComponent.setup_component(self, druid_instance, context, style) -- @local
function BaseComponent.setup_component(self, druid_instance, context, style, instance_class)
self._meta = { self._meta = {
template = nil, template = "",
context = nil, context = context,
nodes = nil, nodes = nil,
style = nil, style = nil,
druid = druid_instance, druid = druid_instance,
input_enabled = true, input_enabled = true,
children = {} children = {},
parent = type(context) ~= "userdata" and context,
instance_class = instance_class
} }
self:__set_context(context)
self:set_style(style) self:set_style(style)
self:set_template("")
local parent = self:get_parent_component() if self._meta.parent then
if parent then self._meta.parent:__add_children(self)
parent:__add_children(self)
end end
return self return self
@ -258,7 +309,7 @@ end
--- Basic constructor of component. It will call automaticaly --- Basic constructor of component. It will call automaticaly
-- by `BaseComponent.static.create` -- by `BaseComponent.static.create`
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @tparam string name BaseComponent name -- @tparam string name BaseComponent name
-- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first -- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first
-- @local -- @local
@ -267,14 +318,35 @@ function BaseComponent.initialize(self, name, input_priority)
name = name, name = name,
input_priority = input_priority or const.PRIORITY_INPUT, input_priority = input_priority or const.PRIORITY_INPUT,
default_input_priority = input_priority or const.PRIORITY_INPUT, default_input_priority = input_priority or const.PRIORITY_INPUT,
is_debug = false,
_is_input_priority_changed = true, -- Default true for sort once time after GUI init _is_input_priority_changed = true, -- Default true for sort once time after GUI init
_uid = BaseComponent.get_uid() _uid = BaseComponent.get_uid()
} }
end end
--- Print log information if debug mode is enabled (protected)
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam string message
-- @tparam table context
function BaseComponent.log_message(self, message, context)
if not self._component.is_debug then
return
end
print("[" .. self:get_name() .. "]:", message, helper.table_to_string(context))
end
--- Set debug logs for component enabled or disabled
-- @tparam BaseComponent self @{BaseComponent}
-- @tparam bool is_debug
function BaseComponent.set_debug(self, is_debug)
self._component.is_debug = is_debug
end
--- Return true, if input priority was changed --- Return true, if input priority was changed
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @local -- @local
function BaseComponent._is_input_priority_changed(self) function BaseComponent._is_input_priority_changed(self)
return self._component._is_input_priority_changed return self._component._is_input_priority_changed
@ -282,7 +354,7 @@ end
--- Reset is_input_priority_changed field --- Reset is_input_priority_changed field
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @local -- @local
function BaseComponent._reset_input_priority_changed(self) function BaseComponent._reset_input_priority_changed(self)
self._component._is_input_priority_changed = false self._component._is_input_priority_changed = false
@ -294,20 +366,16 @@ function BaseComponent.__tostring(self)
end end
--- Set current component context
-- @tparam BaseComponent self
-- @tparam table context Druid context. Usually it is self of script
-- @local
function BaseComponent.__set_context(self, context)
self._meta.context = context
end
--- Get current component interests --- Get current component interests
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn table List of component interests -- @treturn table List of component interests
-- @local -- @local
function BaseComponent.__get_interests(self) function BaseComponent.__get_interests(self)
local instance_class = self._meta.instance_class
if INTERESTS[instance_class] then
return INTERESTS[instance_class]
end
local interests = {} local interests = {}
for index = 1, #BaseComponent.ALL_INTERESTS do for index = 1, #BaseComponent.ALL_INTERESTS do
local interest = BaseComponent.ALL_INTERESTS[index] local interest = BaseComponent.ALL_INTERESTS[index]
@ -316,30 +384,27 @@ function BaseComponent.__get_interests(self)
end end
end end
return interests INTERESTS[instance_class] = interests
end return INTERESTS[instance_class]
--- Get current component template name
-- @tparam BaseComponent self
-- @treturn string BaseComponent template name
-- @local
function BaseComponent.__get_template(self)
return self._meta.template
end end
--- Get current component nodes --- Get current component nodes
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn table BaseComponent nodes table -- @treturn table BaseComponent nodes table
-- @local -- @local
function BaseComponent.__get_nodes(self) function BaseComponent.__get_nodes(self)
return self._meta.nodes local nodes = self._meta.nodes
local parent = self:get_parent_component()
if parent then
nodes = nodes or parent:__get_nodes()
end
return nodes
end end
--- Add child to component children list --- Add child to component children list
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @tparam component children The druid component instance -- @tparam component children The druid component instance
-- @local -- @local
function BaseComponent.__add_children(self, children) function BaseComponent.__add_children(self, children)
@ -348,7 +413,7 @@ end
--- Remove child from component children list --- Remove child from component children list
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @tparam component children The druid component instance -- @tparam component children The druid component instance
-- @local -- @local
function BaseComponent.__remove_children(self, children) function BaseComponent.__remove_children(self, children)
@ -360,8 +425,8 @@ function BaseComponent.__remove_children(self, children)
end end
--- Return all children components, recursive --- Return all children components, recursive (protected)
-- @tparam BaseComponent self -- @tparam BaseComponent self @{BaseComponent}
-- @treturn table Array of childrens if the Druid component instance -- @treturn table Array of childrens if the Druid component instance
function BaseComponent.get_childrens(self) function BaseComponent.get_childrens(self)
local childrens = {} local childrens = {}

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid constants --- Druid constants
-- @local -- @local

View File

@ -0,0 +1,182 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 2.0
y: 2.0
z: 1.0
w: 1.0
}
size {
x: 36.0
y: 36.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/slider_move"
id: "pin"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 13.5
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.2
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 17.0
y: 17.0
z: 0.0
w: 1.0
}
color {
x: 0.101960786
y: 0.101960786
z: 0.101960786
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/tick"
id: "notch"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "pin"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -0,0 +1,123 @@
-- Copyright (c) 2022 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid pin knob custom component.
-- It's simple rotating input element
-- @module PinKnob
-- @within BaseComponent
-- @alias druid.pin_knob
--- The component druid instance
-- @tfield DruidInstance druid @{DruidInstance}
--- Is currently under user control
-- @tfield bool is_drag
--- The pin node
-- @tfield node node
---
local const = require("druid.const")
local component = require("druid.component")
local PinKnob = component.create("druid.pin_knob", { const.ON_INPUT })
local SCHEME = {
ROOT = "root",
PIN = "pin",
}
local function update_visual(self)
local rotation = vmath.vector3(0, 0, self.angle)
gui.set_rotation(self.node, rotation)
end
local function set_angle(self, value)
local prev_value = self.angle
self.angle = value
self.angle = math.min(self.angle, self.angle_max)
self.angle = math.max(self.angle, self.angle_min)
update_visual(self)
if prev_value ~= self.angle and self.callback then
local output_value = self.angle
if output_value ~= 0 then
output_value = -output_value
end
self.callback(self:get_context(), output_value)
end
end
--- Component init function
-- @tparam PinKnob self @{PinKnob}
-- @tparam function callback Callback(self, value) on value changed
-- @tparam string template The template string name
-- @tparam table nodes Nodes table from gui.clone_tree
function PinKnob.init(self, callback, template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.druid = self:get_druid()
self.node = self:get_node(SCHEME.PIN)
self.is_drag = false
self.callback = callback
self:set_angle(0, -100, 100)
self._friction = 0.75
end
--- Set current and min/max angles for component
-- @tparam PinKnob self @{PinKnob}
-- @tparam number cur_value The new value for pin knob
-- @tparam number min The minimum value for pin knob
-- @tparam number max The maximum value for pin knob
-- @treturn PinKnob @{PinKnob}
function PinKnob.set_angle(self, cur_value, min, max)
self.angle_min = min or self.angle_min
self.angle_max = max or self.angle_max
set_angle(self, cur_value)
return self
end
--- Set current and min/max angles for component
-- @tparam PinKnob self @{PinKnob}
-- @tparam[opt=1] number value The spin speed multiplier
-- @treturn PinKnob @{PinKnob}
function PinKnob.set_friction(self, value)
self._friction = value or 1
return self
end
function PinKnob.on_input(self, action_id, action)
if action_id ~= const.ACTION_TOUCH then
return false
end
if gui.pick_node(self.node, action.x, action.y) then
if action.pressed then
self.pos = gui.get_position(self.node)
self.is_drag = true
end
end
if self.is_drag and not action.pressed then
set_angle(self, self.angle - action.dx * self._friction - action.dy * self._friction)
end
if action.released then
self.is_drag = false
end
return self.is_drag
end
return PinKnob

View File

@ -0,0 +1,371 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 190.0
y: 45.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/progress_back"
id: "button"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.5
y: 0.5
z: 1.0
w: 1.0
}
size {
x: 300.0
y: 60.0
z: 0.0
w: 1.0
}
color {
x: 0.9490196
y: 0.9490196
z: 0.9490196
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Placeholder"
font: "game"
id: "placeholder_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.4
y: 0.4
z: 0.4
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "button"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.6
y: 0.6
z: 1.0
w: 1.0
}
size {
x: 300.0
y: 60.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "User input"
font: "game"
id: "input_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "button"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 1.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 67.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.6
y: 0.6
z: 1.0
w: 1.0
}
size {
x: 1.0
y: 1.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "cursor_node"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 0.0
y: 2.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 20.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 0.2
y: 0.2
z: 0.2
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "|"
font: "game"
id: "cursor_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "cursor_node"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -0,0 +1,95 @@
-- Copyright (c) 2022 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid Rich Input custom component.
-- It's wrapper on Input component with cursor and placeholder text
-- @module RichInput
-- @within Input
-- @alias druid.rich_input
--- The component druid instance
-- @tfield DruidInstance druid @{DruidInstance}
--- On input field text change callback(self, input_text)
-- @tfield Input input @{Input}
--- On input field text change to empty string callback(self, input_text)
-- @tfield node cursor
--- On input field text change to max length string callback(self, input_text)
-- @tfield druid.text placeholder @{Text}
---
local component = require("druid.component")
local RichInput = component.create("druid.rich_input")
local SCHEME = {
ROOT = "root",
BUTTON = "button",
PLACEHOLDER = "placeholder_text",
INPUT = "input_text",
CURSOR = "cursor_node",
}
local function animate_cursor(self)
gui.cancel_animation(self.cursor, gui.PROP_COLOR)
gui.set_color(self.cursor, vmath.vector4(1))
gui.animate(self.cursor, gui.PROP_COLOR, vmath.vector4(1,1,1,0), gui.EASING_INSINE, 0.8, 0, nil, gui.PLAYBACK_LOOP_PINGPONG)
end
local function update_text(self, text)
local text_width = self.input.total_width
animate_cursor(self)
gui.set_position(self.cursor, vmath.vector3(text_width/2, 0, 0))
gui.set_scale(self.cursor, self.input.text.scale)
end
local function on_select(self)
gui.set_enabled(self.cursor, true)
gui.set_enabled(self.placeholder.node, false)
animate_cursor(self)
end
local function on_unselect(self)
gui.set_enabled(self.cursor, false)
gui.set_enabled(self.placeholder.node, true and #self.input:get_text() == 0)
end
--- Component init function
-- @tparam RichInput self @{RichInput}
-- @tparam string template The template string name
-- @tparam table nodes Nodes table from gui.clone_tree
function RichInput.init(self, template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.druid = self:get_druid()
self.input = self.druid:new_input(self:get_node(SCHEME.BUTTON), self:get_node(SCHEME.INPUT))
self.cursor = self:get_node(SCHEME.CURSOR)
self.input:set_text("")
self.placeholder = self.druid:new_text(self:get_node(SCHEME.PLACEHOLDER))
self.input.on_input_text:subscribe(update_text)
self.input.on_input_select:subscribe(on_select)
self.input.on_input_unselect:subscribe(on_unselect)
on_unselect(self)
update_text(self, "")
end
--- Set placeholder text
-- @tparam RichInput self @{RichInput}
-- @tparam string placeholder_text The placeholder text
function RichInput.set_placeholder(self, placeholder_text)
self.placeholder:set_to(placeholder_text)
return self
end
return RichInput

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid UI Library. --- Druid UI Library.
-- Powerful Defold component based UI library. Use standart -- Powerful Defold component based UI library. Use standart
@ -120,17 +120,6 @@ function M.on_window_callback(event)
end end
--- Callback on global layout change event.
-- @function druid.on_layout_change
function M.on_layout_change()
local instances = get_druid_instances()
for i = 1, #instances do
msg.post(instances[i].url, base_component.ON_LAYOUT_CHANGE)
end
end
--- Callback on global language change event. --- Callback on global language change event.
-- Use to update all lang texts -- Use to update all lang texts
-- @function druid.on_language_change -- @function druid.on_language_change

View File

@ -0,0 +1,32 @@
--- For component interest functions
--- see https://github.com/Insality/druid/blob/develop/docs_md/02-creating_custom_components.md
--- Require this component in you gui file:
--- local {COMPONENT_NAME} = require("{COMPONENT_PATH}")
--- And create this component via:
--- self.{COMPONENT_TYPE} = self.druid:new({COMPONENT_NAME}, template, nodes)
local component = require("druid.component")
---@class {COMPONENT_TYPE}: druid.base_component{COMPONENT_ANNOTATIONS}
---@field druid druid_instance
local {COMPONENT_NAME} = component.create("{COMPONENT_TYPE}")
local SCHEME = {
{SCHEME_LIST}
}
---@param template string
---@param nodes table<hash, node>
function {COMPONENT_NAME}:init(template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.druid = self:get_druid(){COMPONENT_DEFINE}
end
function {COMPONENT_NAME}:on_remove()
end
{COMPONENT_FUNCTIONS}
return {COMPONENT_NAME}

View File

@ -0,0 +1,139 @@
# @license MIT, Insality 2021
# @source https://github.com/Insality/druid
import os
import sys
import deftree
current_filepath = os.path.abspath(os.path.dirname(__file__))
TEMPLATE_PATH = current_filepath + "/component.lua_template"
component_annotations = ""
component_functions = ""
component_define = ""
def to_camel_case(snake_str):
components = snake_str.split('_')
return ''.join(x.title() for x in components[0:])
def get_id(node_name):
return node_name.upper().replace("/", "_")
def process_component(node_name, component_name):
global component_annotations
global component_functions
global component_define
if node_name == "root":
component_annotations += "\n---@field root node"
component_define += "\n\tself.root = self:get_node(SCHEME.ROOT)"
if node_name.startswith("button"):
component_annotations += "\n---@field {0} druid.button".format(node_name)
component_functions += "\nfunction {1}:_on_{0}()\n\tprint(\"Click on {0}\")\nend\n\n".format(node_name, component_name)
component_define += "\n\tself.{0} = self.druid:new_button(SCHEME.{1}, self._on_{0})".format(node_name, get_id(node_name))
if node_name.startswith("text"):
component_annotations += "\n---@field {0} druid.text".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_text(SCHEME.{1})".format(node_name, get_id(node_name))
if node_name.startswith("lang_text"):
component_annotations += "\n---@field {0} druid.text".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_lang_text(SCHEME.{1}, \"lang_id\")".format(node_name, get_id(node_name))
if node_name.startswith("grid") or node_name.startswith("static_grid"):
component_annotations += "\n---@field {0} druid.static_grid".format(node_name)
component_define += "\n--TODO: Replace prefab_name with grid element prefab"
component_define += "\n\tself.{0} = self.druid:new_static_grid(SCHEME.{1}, \"prefab_name\", 1)".format(node_name, get_id(node_name))
if node_name.startswith("dynamic_grid"):
component_annotations += "\n---@field {0} druid.dynamic_grid".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_dynamic_grid(SCHEME.{1})".format(node_name, get_id(node_name))
if node_name.startswith("scroll_view"):
field_name = node_name.replace("_view", "")
content_name = node_name.replace("_view", "_content")
component_annotations += "\n---@field {0} druid.scroll".format(field_name)
component_define += "\n\tself.{0} = self.druid:new_scroll(SCHEME.{1}, SCHEME.{2})".format(field_name, get_id(node_name), get_id(content_name))
if node_name.startswith("blocker"):
component_annotations += "\n---@field {0} druid.blocker".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_blocker(SCHEME.{1})".format(node_name, get_id(node_name))
if node_name.startswith("slider"):
component_annotations += "\n---@field {0} druid.slider".format(node_name)
component_define += "\n--TODO: Replace slider end position. It should be only vertical or horizontal"
component_define += "\n\tself.{0} = self.druid:new_slider(SCHEME.{1}, vmath.vector3(100, 0, 0), self._on_{0}_change)".format(node_name, get_id(node_name))
component_functions += "\nfunction {1}:_on_{0}_change(value)\n\tprint(\"Slider change:\", value)\nend\n\n".format(node_name, component_name)
if node_name.startswith("progress"):
component_annotations += "\n---@field {0} druid.progress".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_progress(SCHEME.{1}, \"x\")".format(node_name, get_id(node_name))
if node_name.startswith("timer"):
component_annotations += "\n---@field {0} druid.timer".format(node_name)
component_define += "\n\tself.{0} = self.druid:new_timer(SCHEME.{1}, 59, 0, self._on_{0}_end)".format(node_name, get_id(node_name))
component_functions += "\nfunction {1}:_on_{0}_end()\n\tprint(\"Timer {0} trigger\")\nend\n\n".format(node_name, component_name)
def main():
global component_annotations
global component_functions
global component_define
filename = sys.argv[1]
print("Create Druid component from gui file", filename)
tree = deftree.parse(filename)
root = tree.get_root()
output_directory = os.path.dirname(filename)
output_filename = os.path.splitext(os.path.basename(filename))[0]
output_full_path = os.path.join(output_directory, output_filename + ".lua")
is_already_exists = os.path.exists(output_full_path)
if is_already_exists:
print("Error: The file is already exists")
print("File:", output_full_path)
return
component_require_path = os.path.join(output_directory, output_filename).replace("/", ".").replace("..", "")
component_name = to_camel_case(output_filename)
component_type = output_filename
scheme_list = []
# Gather nodes from GUI scene
for node in root.iter_elements("nodes"):
node_name = node.get_attribute("id").value
scheme_list.append("\t" + get_id(node_name) + " = \"" + node_name + "\"")
is_template = node.get_attribute("template")
is_in_template = "/" in node_name
if not is_template and not is_in_template:
process_component(node_name, component_name)
if len(component_define) > 2:
component_define = "\n" + component_define
template_file = open(TEMPLATE_PATH, "r")
filedata = template_file.read()
template_file.close()
filedata = filedata.replace("{COMPONENT_NAME}", component_name)
filedata = filedata.replace("{COMPONENT_TYPE}", component_type)
filedata = filedata.replace("{COMPONENT_PATH}", component_require_path)
filedata = filedata.replace("{COMPONENT_DEFINE}", component_define)
filedata = filedata.replace("{COMPONENT_FUNCTIONS}", component_functions)
filedata = filedata.replace("{COMPONENT_ANNOTATIONS}", component_annotations)
filedata = filedata.replace("{SCHEME_LIST}", ",\n".join(scheme_list))
output_file = open(output_full_path, "w")
output_file.write(filedata)
output_file.close()
print("Success: The file is created")
print("File:", output_full_path)
main()

View File

@ -0,0 +1,127 @@
--- @license MIT, Insality 2021
--- @source https://github.com/Insality/druid
local M = {}
local function ends_with(str, ending)
return ending == "" or str:sub(-#ending) == ending
end
local function save_file_from_dependency(dependency_file_path, output_file_path)
local content = editor.get(dependency_file_path, "text")
local file, err = io.open(output_file_path, "w")
if err then
print("Error:", err)
return false
end
file:write(content)
file:close()
print("Write file at", output_file_path)
return true
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"))
save_file_from_dependency('/druid/editor_scripts/run_python_script_on_gui.sh', "./build/run_python_script_on_gui.sh")
save_file_from_dependency('/druid/editor_scripts/setup_layers.py', "./build/setup_layers.py")
return {
{
action = "shell",
command = {
"bash",
"./build/run_python_script_on_gui.sh",
"./build/setup_layers.py",
"." .. editor.get(file, "path")
}
}
}
end
},
{
label = "Create Druid Component",
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"))
save_file_from_dependency('/druid/editor_scripts/run_python_script_on_gui.sh', "./build/run_python_script_on_gui.sh")
save_file_from_dependency('/druid/editor_scripts/create_druid_component.py', "./build/create_druid_component.py")
save_file_from_dependency('/druid/editor_scripts/component.lua_template', "./build/component.lua_template")
return {
{
action = "shell",
command = {
"bash",
"./build/run_python_script_on_gui.sh",
"./build/create_druid_component.py",
"." .. editor.get(file, "path")
}
}
}
end
}
}
end
return M

View File

@ -0,0 +1,15 @@
#!/bin/bash
# @license MIT, Insality 2022
# @source https://github.com/Insality/druid
echo "Run bash for $1"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
is_defree_installed=$(pip3 list --disable-pip-version-check | grep -E "deftree")
if [ -z "$is_defree_installed" ]; then
echo "The python deftree is not installed. Please install it via"
echo "pip3 install deftree"
exit 0
fi
python3 $1 $2

View File

@ -1,8 +1,8 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Lua event small library --- Druid lua event library
-- @module DruidEvent -- @module DruidEvent
-- @alias druid_event -- @alias druid.event
local class = require("druid.system.middleclass") local class = require("druid.system.middleclass")
@ -10,10 +10,10 @@ local DruidEvent = class("druid.event")
--- Event constructur --- Event constructur
-- @tparam DruidEvent self -- @tparam DruidEvent self @{DruidEvent}
-- @tparam function initial_callback Subscribe the callback on new event, if callback exist -- @tparam function initial_callback Subscribe the callback on new event, if callback exist
function DruidEvent.initialize(self, initial_callback) function DruidEvent.initialize(self, initial_callback)
self._callbacks = {} self._callbacks = nil -- initialize later
if initial_callback then if initial_callback then
self:subscribe(initial_callback) self:subscribe(initial_callback)
@ -22,13 +22,14 @@ end
--- Subscribe callback on event --- Subscribe callback on event
-- @tparam DruidEvent self -- @tparam DruidEvent self @{DruidEvent}
-- @tparam function callback Callback itself -- @tparam function callback Callback itself
-- @tparam table context Additional context as first param to callback call -- @tparam table context Additional context as first param to callback call
function DruidEvent.subscribe(self, callback, context) function DruidEvent.subscribe(self, callback, context)
assert(type(self) == "table", "You should subscribe to event with : syntax") assert(type(self) == "table", "You should subscribe to event with : syntax")
assert(type(callback) == "function", "Callback should be function") assert(type(callback) == "function", "Callback should be function")
self._callbacks = self._callbacks or {}
table.insert(self._callbacks, { table.insert(self._callbacks, {
callback = callback, callback = callback,
context = context context = context
@ -39,10 +40,14 @@ end
--- Unsubscribe callback on event --- Unsubscribe callback on event
-- @tparam DruidEvent self -- @tparam DruidEvent self @{DruidEvent}
-- @tparam function callback Callback itself -- @tparam function callback Callback itself
-- @tparam table context Additional context as first param to callback call -- @tparam table context Additional context as first param to callback call
function DruidEvent.unsubscribe(self, callback, context) function DruidEvent.unsubscribe(self, callback, context)
if not self._callbacks then
return
end
for index, callback_info in ipairs(self._callbacks) do for index, callback_info in ipairs(self._callbacks) do
if callback_info.callback == callback and callback_info.context == context then if callback_info.callback == callback and callback_info.context == context then
table.remove(self._callbacks, index) table.remove(self._callbacks, index)
@ -53,24 +58,31 @@ end
--- Return true, if event have at lease one handler --- Return true, if event have at lease one handler
-- @tparam DruidEvent self -- @tparam DruidEvent self @{DruidEvent}
-- @treturn bool True if event have handlers -- @treturn bool True if event have handlers
function DruidEvent.is_exist(self) function DruidEvent.is_exist(self)
if not self._callbacks then
return false
end
return #self._callbacks > 0 return #self._callbacks > 0
end end
--- Clear the all event handlers --- Clear the all event handlers
-- @tparam DruidEvent self -- @tparam DruidEvent self @{DruidEvent}
function DruidEvent.clear(self) function DruidEvent.clear(self)
self._callbacks = {} self._callbacks = nil
end end
--- Trigger the event and call all subscribed callbacks --- Trigger the event and call all subscribed callbacks
-- @tparam DruidEvent self -- @tparam DruidEvent self @{DruidEvent}
-- @tparam any ... All event params -- @tparam any ... All event params
function DruidEvent.trigger(self, ...) function DruidEvent.trigger(self, ...)
if not self._callbacks then
return false
end
for index, callback_info in ipairs(self._callbacks) do for index, callback_info in ipairs(self._callbacks) do
if callback_info.context then if callback_info.context then
callback_info.callback(callback_info.context, ...) callback_info.callback(callback_info.context, ...)

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid checkbox component --- Druid checkbox component
-- @module Checkbox -- @module Checkbox
@ -6,7 +6,7 @@
-- @alias druid.checkbox -- @alias druid.checkbox
--- On change state callback(self, state) --- On change state callback(self, state)
-- @tfield druid_event on_change_state -- @tfield DruidEvent on_change_state @{DruidEvent}
--- Visual node --- Visual node
-- @tfield node node -- @tfield node node
@ -15,7 +15,7 @@
-- @tfield[opt=node] node click_node -- @tfield[opt=node] node click_node
--- Button component from click_node --- Button component from click_node
-- @tfield Button button -- @tfield Button button @{Button}
--- ---
@ -45,7 +45,7 @@ end
--- Component init function --- Component init function
-- @tparam Checkbox self -- @tparam Checkbox self @{Checkbox}
-- @tparam node node Gui node -- @tparam node node Gui node
-- @tparam function callback Checkbox callback -- @tparam function callback Checkbox callback
-- @tparam[opt=node] node click_node Trigger node, by default equals to node -- @tparam[opt=node] node click_node Trigger node, by default equals to node
@ -53,7 +53,7 @@ end
function Checkbox.init(self, node, callback, click_node, initial_state) function Checkbox.init(self, node, callback, click_node, initial_state)
self.druid = self:get_druid() self.druid = self:get_druid()
self.node = self:get_node(node) self.node = self:get_node(node)
self.click_node = self:get_node(click_node) self.click_node = self:get_node(click_node or node)
self.button = self.druid:new_button(self.click_node or self.node, on_click) self.button = self.druid:new_button(self.click_node or self.node, on_click)
self:set_state(initial_state, true, true) self:set_state(initial_state, true, true)
@ -68,7 +68,7 @@ end
--- Set checkbox state --- Set checkbox state
-- @tparam Checkbox self -- @tparam Checkbox self @{Checkbox}
-- @tparam bool state Checkbox state -- @tparam bool state Checkbox state
-- @tparam bool is_silent Don't trigger on_change_state if true -- @tparam bool is_silent Don't trigger on_change_state if true
-- @tparam bool is_instant If instant checkbox change -- @tparam bool is_instant If instant checkbox change
@ -85,7 +85,7 @@ end
--- Return checkbox state --- Return checkbox state
-- @tparam Checkbox self -- @tparam Checkbox self @{Checkbox}
-- @treturn bool Checkbox state -- @treturn bool Checkbox state
function Checkbox.get_state(self) function Checkbox.get_state(self)
return self.state return self.state

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Checkbox group module --- Checkbox group module
-- @module CheckboxGroup -- @module CheckboxGroup
@ -6,10 +6,10 @@
-- @alias druid.checkbox_group -- @alias druid.checkbox_group
--- On any checkbox click callback(self, index) --- On any checkbox click callback(self, index)
-- @tfield druid_event on_checkbox_click -- @tfield DruidEvent on_checkbox_click @{DruidEvent}
--- Array of checkbox components --- Array of checkbox components
-- @tfield table checkboxes -- @tfield table checkboxes @{Checkbox}
--- ---
@ -20,7 +20,7 @@ local CheckboxGroup = component.create("checkbox_group")
--- Component init function --- Component init function
-- @tparam CheckboxGroup self -- @tparam CheckboxGroup self @{CheckboxGroup}
-- @tparam node[] nodes Array of gui node -- @tparam node[] nodes Array of gui node
-- @tparam function callback Checkbox callback -- @tparam function callback Checkbox callback
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes -- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
@ -42,7 +42,7 @@ end
--- Set checkbox group state --- Set checkbox group state
-- @tparam CheckboxGroup self -- @tparam CheckboxGroup self @{CheckboxGroup}
-- @tparam bool[] indexes Array of checkbox state -- @tparam bool[] indexes Array of checkbox state
-- @tparam boolean is_instant If instant state change -- @tparam boolean is_instant If instant state change
function CheckboxGroup.set_state(self, indexes, is_instant) function CheckboxGroup.set_state(self, indexes, is_instant)
@ -55,7 +55,7 @@ end
--- Return checkbox group state --- Return checkbox group state
-- @tparam CheckboxGroup self -- @tparam CheckboxGroup self @{CheckboxGroup}
-- @treturn bool[] Array if checkboxes state -- @treturn bool[] Array if checkboxes state
function CheckboxGroup.get_state(self) function CheckboxGroup.get_state(self)
local result = {} local result = {}

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to manage data for huge dataset in scroll. --- Component to manage data for huge dataset in scroll.
-- It requires Druid Scroll and Druid Grid (Static or Dynamic) components -- It requires Druid Scroll and Druid Grid (Static or Dynamic) components
@ -8,10 +8,10 @@
--- The Druid scroll component --- The Druid scroll component
-- @tfield druid.scroll scroll -- @tfield Scroll scroll @{Scroll}
--- The Druid Grid component --- The Druid Grid component
-- @tfield druid.static_grid grid -- @tfield StaticGrid|DynamicGrid grid @{StaticGrid}, @{DynamicGrid}
--- The current visual top data index --- The current visual top data index
-- @tfield number top_index -- @tfield number top_index
@ -23,7 +23,7 @@
-- @tfield number scroll_progress -- @tfield number scroll_progress
--- Event triggered when scroll progress is changed; event(self, progress_value) --- Event triggered when scroll progress is changed; event(self, progress_value)
-- @tfield druid_event on_scroll_progress_change -- @tfield DruidEvent on_scroll_progress_change @{DruidEvent}
--- ---
@ -36,14 +36,17 @@ local DataList = component.create("data_list")
--- Data list constructor --- Data list constructor
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam druid.scroll scroll The Scroll instance for Data List component -- @tparam Scroll scroll The @{Scroll} instance for Data List component
-- @tparam druid.grid grid The Grid instance for Data List component -- @tparam StaticGrid|DynamicGrid grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component
-- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component]) -- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component])
function DataList.init(self, scroll, grid, create_function) function DataList.init(self, scroll, grid, create_function)
self.druid = self:get_druid() self.druid = self:get_druid()
self.scroll = scroll self.scroll = scroll
self.grid = grid self.grid = grid
if self.grid.style then
self.grid.style.IS_DYNAMIC_NODE_POSES = false
end
self.scroll:bind_grid(grid) self.scroll:bind_grid(grid)
-- Current visual elements indexes -- Current visual elements indexes
@ -61,18 +64,20 @@ function DataList.init(self, scroll, grid, create_function)
self.scroll.on_scroll:subscribe(self._check_elements, self) self.scroll.on_scroll:subscribe(self._check_elements, self)
self.on_scroll_progress_change = Event() self.on_scroll_progress_change = Event()
self:set_data()
end end
--- Druid System on_remove function --- Druid System on_remove function
-- @tparam DataList self -- @tparam DataList self @{DataList}
function DataList.on_remove(self) function DataList.on_remove(self)
self.scroll.on_scroll:unsubscribe(self._check_elements, self) self.scroll.on_scroll:unsubscribe(self._check_elements, self)
end end
--- Set new data set for DataList component --- Set new data set for DataList component
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam table data The new data array -- @tparam table data The new data array
-- @treturn druid.data_list Current DataList instance -- @treturn druid.data_list Current DataList instance
function DataList.set_data(self, data) function DataList.set_data(self, data)
@ -85,7 +90,7 @@ end
--- Add element to DataList. Currenly untested --- Add element to DataList. Currenly untested
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam table data -- @tparam table data
-- @tparam number index -- @tparam number index
-- @tparam number shift_policy The constant from const.SHIFT.* -- @tparam number shift_policy The constant from const.SHIFT.*
@ -109,22 +114,26 @@ function DataList.add(self, data, index, shift_policy)
self._data[index] = data self._data[index] = data
self:_update_data_info() self:_update_data_info()
self:_check_elements() self:_check_elements()
self:log_message("Add element", { index = index })
end end
--- Remove element from DataList. Currenly untested --- Remove element from DataList. Currenly untested
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam number index -- @tparam number index
-- @tparam number shift_policy The constant from const.SHIFT.* -- @tparam number shift_policy The constant from const.SHIFT.*
-- @local -- @local
function DataList.remove(self, index, shift_policy) function DataList.remove(self, index, shift_policy)
table.remove(self._data, index) table.remove(self._data, index)
self:_refresh() self:_refresh()
self:log_message("Remove element", { index = index })
end end
--- Remove element from DataList by data value. Currenly untested --- Remove element from DataList by data value. Currenly untested
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam tabe data -- @tparam tabe data
-- @tparam number shift_policy The constant from const.SHIFT.* -- @tparam number shift_policy The constant from const.SHIFT.*
-- @local -- @local
@ -138,7 +147,7 @@ end
--- Clear the DataList and refresh visuals --- Clear the DataList and refresh visuals
-- @tparam DataList self -- @tparam DataList self @{DataList}
function DataList.clear(self) function DataList.clear(self)
self._data = {} self._data = {}
self:_refresh() self:_refresh()
@ -146,28 +155,28 @@ end
--- Return first index from data. It not always equals to 1 --- Return first index from data. It not always equals to 1
-- @tparam DataList self -- @tparam DataList self @{DataList}
function DataList.get_first_index(self) function DataList.get_first_index(self)
return self._data_first_index return self._data_first_index
end end
--- Return last index from data --- Return last index from data
-- @tparam DataList self -- @tparam DataList self @{DataList}
function DataList.get_last_index(self) function DataList.get_last_index(self)
return self._data_last_index return self._data_last_index
end end
--- Return amount of data --- Return amount of data
-- @tparam DataList self -- @tparam DataList self @{DataList}
function DataList.get_length(self) function DataList.get_length(self)
return self._data_length return self._data_length
end end
--- Return index for data value --- Return index for data value
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam table data -- @tparam table data
function DataList.get_index(self, data) function DataList.get_index(self, data)
for index, value in pairs(self._data) do for index, value in pairs(self._data) do
@ -181,7 +190,7 @@ end
--- Instant scroll to element with passed index --- Instant scroll to element with passed index
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam number index -- @tparam number index
function DataList.scroll_to_index(self, index) function DataList.scroll_to_index(self, index)
local target = helper.clamp(index, self:get_first_index(), self:get_last_index()) local target = helper.clamp(index, self:get_first_index(), self:get_last_index())
@ -195,7 +204,7 @@ end
--- Add element at passed index --- Add element at passed index
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam number index -- @tparam number index
-- @local -- @local
function DataList._add_at(self, index) function DataList._add_at(self, index)
@ -209,11 +218,13 @@ function DataList._add_at(self, index)
node = node, node = node,
component = instance component = instance
} }
self:log_message("Add element at", { index = index })
end end
--- Remove element from passed index --- Remove element from passed index
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam number index -- @tparam number index
-- @local -- @local
function DataList._remove_at(self, index) function DataList._remove_at(self, index)
@ -226,11 +237,13 @@ function DataList._remove_at(self, index)
self.druid:remove(self._data_visual[index].component) self.druid:remove(self._data_visual[index].component)
end end
self._data_visual[index] = nil self._data_visual[index] = nil
self:log_message("Remove element at", { index = index })
end end
--- Fully refresh all DataList elements --- Fully refresh all DataList elements
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @local -- @local
function DataList._refresh(self) function DataList._refresh(self)
for index, _ in pairs(self._data_visual) do for index, _ in pairs(self._data_visual) do
@ -241,7 +254,7 @@ end
--- Check elements which should be created --- Check elements which should be created
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @local -- @local
function DataList._check_elements(self) function DataList._check_elements(self)
for index, data in pairs(self._data_visual) do for index, data in pairs(self._data_visual) do
@ -270,6 +283,8 @@ function DataList._check_elements(self)
progress = 0 progress = 0
end end
self:log_message("Check elements", { top_index = self.top_index, last_index = self.last_index, progress = progress })
if self.scroll_progress ~= progress then if self.scroll_progress ~= progress then
self.scroll_progress = progress self.scroll_progress = progress
self.on_scroll_progress_change:trigger(self:get_context(), progress) self.on_scroll_progress_change:trigger(self:get_context(), progress)
@ -279,7 +294,7 @@ end
--- Check elements which should be created. --- Check elements which should be created.
-- Start from index with step until element is outside of scroll view -- Start from index with step until element is outside of scroll view
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @tparam number index -- @tparam number index
-- @tparam number step -- @tparam number step
-- @local -- @local
@ -312,9 +327,8 @@ function DataList._check_elements_from(self, index, step)
end end
--- Update actual data params --- Update actual data params
-- @tparam DataList self -- @tparam DataList self @{DataList}
-- @local -- @local
function DataList._update_data_info(self) function DataList._update_data_info(self)
self._data_first_index = false self._data_first_index = false

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle placing components in row --- Component to handle placing components in row
-- @module DynamicGrid -- @module DynamicGrid
@ -6,19 +6,19 @@
-- @alias druid.dynamic_grid -- @alias druid.dynamic_grid
--- On item add callback(self, node, index) --- On item add callback(self, node, index)
-- @tfield druid_event on_add_item -- @tfield DruidEvent on_add_item @{DruidEvent}
--- On item remove callback(self, index) --- On item remove callback(self, index)
-- @tfield druid_event on_remove_item -- @tfield DruidEvent on_remove_item @{DruidEvent}
--- On item add or remove callback(self, index) --- On item add or remove callback(self, index)
-- @tfield druid_event on_change_items -- @tfield DruidEvent on_change_items @{DruidEvent}
--- On grid clear callback(self) --- On grid clear callback(self)
-- @tfield druid_event on_clear -- @tfield DruidEvent on_clear @{DruidEvent}
--- On update item positions callback(self) --- On update item positions callback(self)
-- @tfield druid_event on_update_positions -- @tfield DruidEvent on_update_positions @{DruidEvent}
--- Parent gui node --- Parent gui node
-- @tfield node parent -- @tfield node parent
@ -64,7 +64,7 @@ local AVAILABLE_PIVOTS = {
--- Component init function --- Component init function
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node parent The gui node parent, where items will be placed -- @tparam node parent The gui node parent, where items will be placed
function DynamicGrid.init(self, parent) function DynamicGrid.init(self, parent)
self.parent = self:get_node(parent) self.parent = self:get_node(parent)
@ -95,7 +95,7 @@ end
--- Return pos for grid node index --- Return pos for grid node index
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam number index The grid element index -- @tparam number index The grid element index
-- @tparam node node The node to be placed -- @tparam node node The node to be placed
-- @tparam[opt] number origin_index Index of nearby node -- @tparam[opt] number origin_index Index of nearby node
@ -136,11 +136,11 @@ end
--- Add new node to the grid --- Add new node to the grid
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node node Gui node -- @tparam node node Gui node
-- @tparam[opt] number index The node position. By default add as last node -- @tparam[opt] number index The node position. By default add as last node
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT -- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instance If true, update node positions instantly -- @tparam[opt=false] boolean is_instant If true, update node positions instantly
function DynamicGrid.add(self, node, index, shift_policy, is_instant) function DynamicGrid.add(self, node, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT shift_policy = shift_policy or const.SHIFT.RIGHT
local delta = shift_policy -- -1 or 1 or 0 local delta = shift_policy -- -1 or 1 or 0
@ -179,11 +179,11 @@ end
--- Remove the item from the grid. Note that gui node will be not deleted --- Remove the item from the grid. Note that gui node will be not deleted
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam number index The grid node index to remove -- @tparam number index The grid node index to remove
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT -- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instance If true, update node positions instantly -- @tparam[opt=false] boolean is_instant If true, update node positions instantly
-- @treturn Node The deleted gui node from grid -- @treturn node The deleted gui node from grid
function DynamicGrid.remove(self, index, shift_policy, is_instant) function DynamicGrid.remove(self, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT shift_policy = shift_policy or const.SHIFT.RIGHT
local delta = shift_policy -- -1 or 1 or 0 local delta = shift_policy -- -1 or 1 or 0
@ -216,7 +216,7 @@ end
--- Return grid content size --- Return grid content size
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam vector3 border -- @tparam vector3 border
-- @treturn vector3 The grid content size -- @treturn vector3 The grid content size
function DynamicGrid.get_size(self, border) function DynamicGrid.get_size(self, border)
@ -229,7 +229,7 @@ end
--- Return DynamicGrid offset, where DynamicGrid content starts. --- Return DynamicGrid offset, where DynamicGrid content starts.
-- @tparam DynamicGrid self The DynamicGrid instance -- @tparam DynamicGrid self @{DynamicGrid} The DynamicGrid instance
-- @treturn vector3 The DynamicGrid offset -- @treturn vector3 The DynamicGrid offset
function DynamicGrid.get_offset(self) function DynamicGrid.get_offset(self)
local size = self:get_size() local size = self:get_size()
@ -244,7 +244,7 @@ end
--- Return grid content borders --- Return grid content borders
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn vector3 The grid content borders -- @treturn vector3 The grid content borders
function DynamicGrid.get_borders(self) function DynamicGrid.get_borders(self)
return self.border return self.border
@ -252,7 +252,7 @@ end
--- Return grid index by node --- Return grid index by node
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node node The gui node in the grid -- @tparam node node The gui node in the grid
-- @treturn number The node index -- @treturn number The node index
function DynamicGrid.get_index_by_node(self, node) function DynamicGrid.get_index_by_node(self, node)
@ -267,7 +267,7 @@ end
--- Return array of all node positions --- Return array of all node positions
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn vector3[] All grid node positions -- @treturn vector3[] All grid node positions
function DynamicGrid.get_all_pos(self) function DynamicGrid.get_all_pos(self)
local result = {} local result = {}
@ -281,7 +281,7 @@ end
--- Change set position function for grid nodes. It will call on --- Change set position function for grid nodes. It will call on
-- update poses on grid elements. Default: gui.set_position -- update poses on grid elements. Default: gui.set_position
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam function callback Function on node set position -- @tparam function callback Function on node set position
-- @treturn druid.dynamic_grid Current grid instance -- @treturn druid.dynamic_grid Current grid instance
function DynamicGrid.set_position_function(self, callback) function DynamicGrid.set_position_function(self, callback)
@ -292,7 +292,7 @@ end
--- Clear grid nodes array. GUI nodes will be not deleted! --- Clear grid nodes array. GUI nodes will be not deleted!
-- If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear -- If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn druid.dynamic_grid Current grid instance -- @treturn druid.dynamic_grid Current grid instance
function DynamicGrid.clear(self) function DynamicGrid.clear(self)
self.nodes = {} self.nodes = {}
@ -319,7 +319,7 @@ end
--- Update grid inner state --- Update grid inner state
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback -- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local -- @local
function DynamicGrid._update(self, is_instant) function DynamicGrid._update(self, is_instant)
@ -330,7 +330,7 @@ end
--- Update first and last indexes of grid nodes --- Update first and last indexes of grid nodes
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @local -- @local
function DynamicGrid._update_indexes(self) function DynamicGrid._update_indexes(self)
self.first_index = nil self.first_index = nil
@ -346,7 +346,7 @@ end
--- Update grid content borders, recalculate min and max values --- Update grid content borders, recalculate min and max values
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @local -- @local
function DynamicGrid._update_borders(self) function DynamicGrid._update_borders(self)
if not self.first_index then if not self.first_index then
@ -375,7 +375,7 @@ end
--- Update grid nodes position --- Update grid nodes position
-- @tparam DynamicGrid self -- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback -- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local -- @local
function DynamicGrid._update_pos(self, is_instant) function DynamicGrid._update_pos(self, is_instant)
@ -410,7 +410,6 @@ function DynamicGrid._get_next_node_pos(self, origin_node_index, new_node, place
end end
function DynamicGrid._get_node_size(self, node) function DynamicGrid._get_node_size(self, node)
return vmath.mul_per_elem(gui.get_size(node), gui.get_scale(node)) return vmath.mul_per_elem(gui.get_size(node), gui.get_scale(node))
end end

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid input text component. --- Druid input text component.
-- Carry on user text input -- Carry on user text input
@ -8,28 +8,28 @@
-- @alias druid.input -- @alias druid.input
--- On input field select callback(self, button_node) --- On input field select callback(self, button_node)
-- @tfield druid_event on_input_select -- @tfield DruidEvent on_input_select @{DruidEvent}
--- On input field unselect callback(self, input_text) --- On input field unselect callback(self, input_text)
-- @tfield druid_event on_input_unselect -- @tfield DruidEvent on_input_unselect @{DruidEvent}
--- On input field text change callback(self, input_text) --- On input field text change callback(self, input_text)
-- @tfield druid_event on_input_text -- @tfield DruidEvent on_input_text @{DruidEvent}
--- On input field text change to empty string callback(self, input_text) --- On input field text change to empty string callback(self, input_text)
-- @tfield druid_event on_input_empty -- @tfield DruidEvent on_input_empty @{DruidEvent}
--- On input field text change to max length string callback(self, input_text) --- On input field text change to max length string callback(self, input_text)
-- @tfield druid_event on_input_full -- @tfield DruidEvent on_input_full @{DruidEvent}
--- On trying user input with not allowed character callback(self, params, button_instance) --- On trying user input with not allowed character callback(self, params, button_instance)
-- @tfield druid_event on_input_wrong -- @tfield DruidEvent on_input_wrong @{DruidEvent}
--- Text component --- Text component
-- @tfield druid.text text -- @tfield Text text @{Text}
--- Button component --- Button component
-- @tfield druid.button button -- @tfield Button button @{Button}
--- Is current input selected now --- Is current input selected now
-- @tfield bool is_selected -- @tfield bool is_selected
@ -110,8 +110,10 @@ function Input.on_style_change(self, style)
end end
--- Component init function
-- @tparam Input self @{Input}
-- @tparam node click_node Button node to enabled input component -- @tparam node click_node Button node to enabled input component
-- @tparam node|druid.text text_node Text node what will be changed on user input. You can pass text component instead of text node name -- @tparam node|Text text_node Text node what will be changed on user input. You can pass text component instead of text node name @{Text}
-- @tparam[opt] number keyboard_type Gui keyboard type for input field -- @tparam[opt] number keyboard_type Gui keyboard type for input field
function Input.init(self, click_node, text_node, keyboard_type) function Input.init(self, click_node, text_node, keyboard_type)
self.druid = self:get_druid(self) self.druid = self:get_druid(self)
@ -227,7 +229,7 @@ end
--- Set text for input field --- Set text for input field
-- @tparam Input self -- @tparam Input self @{Input}
-- @tparam string input_text The string to apply for input field -- @tparam string input_text The string to apply for input field
function Input.set_text(self, input_text) function Input.set_text(self, input_text)
-- Case when update with marked text -- Case when update with marked text
@ -258,8 +260,8 @@ function Input.set_text(self, input_text)
self.text:set_to(final_text) self.text:set_to(final_text)
-- measure it -- measure it
self.text_width = self.text:get_text_width(value) self.text_width = self.text:get_text_size(value)
self.marked_text_width = self.text:get_text_width(marked_value) self.marked_text_width = self.text:get_text_size(marked_value)
self.total_width = self.text_width + self.marked_text_width self.total_width = self.text_width + self.marked_text_width
self.on_input_text:trigger(self:get_context(), final_text) self.on_input_text:trigger(self:get_context(), final_text)
@ -274,7 +276,7 @@ end
--- Select input field. It will show the keyboard and trigger on_select events --- Select input field. It will show the keyboard and trigger on_select events
-- @tparam Input self -- @tparam Input self @{Input}
function Input.select(self) function Input.select(self)
gui.reset_keyboard() gui.reset_keyboard()
self.marked_value = "" self.marked_value = ""
@ -297,7 +299,7 @@ end
--- Remove selection from input. It will hide the keyboard and trigger on_unselect events --- Remove selection from input. It will hide the keyboard and trigger on_unselect events
-- @tparam Input self -- @tparam Input self @{Input}
function Input.unselect(self) function Input.unselect(self)
gui.reset_keyboard() gui.reset_keyboard()
self.marked_value = "" self.marked_value = ""
@ -315,7 +317,7 @@ end
--- Return current input field text --- Return current input field text
-- @tparam Input self -- @tparam Input self @{Input}
-- @treturn string The current input field text -- @treturn string The current input field text
function Input.get_text(self) function Input.get_text(self)
return self.value .. self.marked_value return self.value .. self.marked_value
@ -324,7 +326,7 @@ end
--- Set maximum length for input field. --- Set maximum length for input field.
-- Pass nil to make input field unliminted (by default) -- Pass nil to make input field unliminted (by default)
-- @tparam Input self -- @tparam Input self @{Input}
-- @tparam number max_length Maximum length for input text field -- @tparam number max_length Maximum length for input text field
-- @treturn druid.input Current input instance -- @treturn druid.input Current input instance
function Input.set_max_length(self, max_length) function Input.set_max_length(self, max_length)
@ -336,7 +338,7 @@ end
--- Set allowed charaters for input field. --- Set allowed charaters for input field.
-- See: https://defold.com/ref/stable/string/ -- See: https://defold.com/ref/stable/string/
-- ex: [%a%d] for alpha and numeric -- ex: [%a%d] for alpha and numeric
-- @tparam Input self -- @tparam Input self @{Input}
-- @tparam string characters Regulax exp. for validate user input -- @tparam string characters Regulax exp. for validate user input
-- @treturn druid.input Current input instance -- @treturn druid.input Current input instance
function Input.set_allowed_characters(self, characters) function Input.set_allowed_characters(self, characters)
@ -346,7 +348,7 @@ end
--- Reset current input selection and return previous value --- Reset current input selection and return previous value
-- @tparam Input self -- @tparam Input self @{Input}
function Input.reset_changes(self) function Input.reset_changes(self)
self:set_text(self.previous_value) self:set_text(self.previous_value)
self:unselect() self:unselect()

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle all GUI texts --- Component to handle all GUI texts
-- Good working with localization system -- Good working with localization system
@ -7,10 +7,10 @@
-- @alias druid.lang_text -- @alias druid.lang_text
--- On change text callback --- On change text callback
-- @tfield druid_event on_change -- @tfield DruidEvent on_change @{DruidEvent}
--- The text component --- The text component
-- @tfield Text text -- @tfield Text text @{Text}
--- ---
@ -22,7 +22,7 @@ local LangText = component.create("lang_text")
--- Component init function --- Component init function
-- @tparam LangText self -- @tparam LangText self @{LangText}
-- @tparam node node The text node -- @tparam node node The text node
-- @tparam string locale_id Default locale id or text from node as default -- @tparam string locale_id Default locale id or text from node as default
-- @tparam bool no_adjust If true, will not correct text size -- @tparam bool no_adjust If true, will not correct text size
@ -48,7 +48,7 @@ end
--- Setup raw text to lang_text component --- Setup raw text to lang_text component
-- @tparam LangText self -- @tparam LangText self @{LangText}
-- @tparam string text Text for text node -- @tparam string text Text for text node
-- @treturn LangText Current instance -- @treturn LangText Current instance
function LangText.set_to(self, text) function LangText.set_to(self, text)
@ -61,9 +61,15 @@ end
--- Translate the text by locale_id --- Translate the text by locale_id
-- @tparam LangText self -- @tparam LangText self @{LangText}
-- @tparam string locale_id Locale id -- @tparam string locale_id Locale id
-- @tparam string ... Locale arguments to pass in text function -- @tparam[opt] string a Optional param to string.format
-- @tparam[opt] string b Optional param to string.format
-- @tparam[opt] string c Optional param to string.format
-- @tparam[opt] string d Optional param to string.format
-- @tparam[opt] string e Optional param to string.format
-- @tparam[opt] string f Optional param to string.format
-- @tparam[opt] string g Optional param to string.format
-- @treturn LangText Current instance -- @treturn LangText Current instance
function LangText.translate(self, locale_id, a, b, c, d, e, f, g) function LangText.translate(self, locale_id, a, b, c, d, e, f, g)
self.last_locale_args = { a, b, c, d, e, f, g } self.last_locale_args = { a, b, c, d, e, f, g }
@ -75,8 +81,14 @@ end
--- Format string with new text params on localized text --- Format string with new text params on localized text
-- @tparam LangText self -- @tparam LangText self @{LangText}
-- @tparam string ... Locale arguments to pass in text function -- @tparam[opt] string a Optional param to string.format
-- @tparam[opt] string b Optional param to string.format
-- @tparam[opt] string c Optional param to string.format
-- @tparam[opt] string d Optional param to string.format
-- @tparam[opt] string e Optional param to string.format
-- @tparam[opt] string f Optional param to string.format
-- @tparam[opt] string g Optional param to string.format
-- @treturn LangText Current instance -- @treturn LangText Current instance
function LangText.format(self, a, b, c, d, e, f, g) function LangText.format(self, a, b, c, d, e, f, g)
self.last_locale_args = { a, b, c, d, e, f, g } self.last_locale_args = { a, b, c, d, e, f, g }

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Basic progress bar component. --- Basic progress bar component.
-- For correct progress bar init it should be in max size from gui -- For correct progress bar init it should be in max size from gui
@ -7,7 +7,7 @@
-- @alias druid.progress -- @alias druid.progress
--- On progress bar change callback(self, new_value) --- On progress bar change callback(self, new_value)
-- @tfield druid_event on_change -- @tfield DruidEvent on_change @{DruidEvent}
--- Progress bar fill node --- Progress bar fill node
-- @tfield node node -- @tfield node node
@ -93,7 +93,7 @@ end
--- Component init function --- Component init function
-- @tparam Progress self -- @tparam Progress self @{Progress}
-- @tparam string|node node Progress bar fill node or node name -- @tparam string|node node Progress bar fill node or node name
-- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y -- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y
-- @tparam[opt=1] number init_value Initial value of progress bar -- @tparam[opt=1] number init_value Initial value of progress bar
@ -146,21 +146,21 @@ end
--- Fill a progress bar and stop progress animation --- Fill a progress bar and stop progress animation
-- @tparam Progress self -- @tparam Progress self @{Progress}
function Progress.fill(self) function Progress.fill(self)
set_bar_to(self, 1, true) set_bar_to(self, 1, true)
end end
--- Empty a progress bar --- Empty a progress bar
-- @tparam Progress self -- @tparam Progress self @{Progress}
function Progress.empty(self) function Progress.empty(self)
set_bar_to(self, 0, true) set_bar_to(self, 0, true)
end end
--- Instant fill progress bar to value --- Instant fill progress bar to value
-- @tparam Progress self -- @tparam Progress self @{Progress}
-- @tparam number to Progress bar value, from 0 to 1 -- @tparam number to Progress bar value, from 0 to 1
function Progress.set_to(self, to) function Progress.set_to(self, to)
set_bar_to(self, to) set_bar_to(self, to)
@ -168,14 +168,14 @@ end
--- Return current progress bar value --- Return current progress bar value
-- @tparam Progress self -- @tparam Progress self @{Progress}
function Progress.get(self) function Progress.get(self)
return self.last_value return self.last_value
end end
--- Set points on progress bar to fire the callback --- Set points on progress bar to fire the callback
-- @tparam Progress self -- @tparam Progress self @{Progress}
-- @tparam number[] steps Array of progress bar values -- @tparam number[] steps Array of progress bar values
-- @tparam function callback Callback on intersect step value -- @tparam function callback Callback on intersect step value
-- @usage progress:set_steps({0, 0.3, 0.6, 1}, function(self, step) end) -- @usage progress:set_steps({0, 0.3, 0.6, 1}, function(self, step) end)
@ -186,7 +186,7 @@ end
--- Start animation of a progress bar --- Start animation of a progress bar
-- @tparam Progress self -- @tparam Progress self @{Progress}
-- @tparam number to value between 0..1 -- @tparam number to value between 0..1
-- @tparam[opt] function callback Callback on animation ends -- @tparam[opt] function callback Callback on animation ends
function Progress.to(self, to, callback) function Progress.to(self, to, callback)

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Radio group module --- Radio group module
-- @module RadioGroup -- @module RadioGroup
@ -6,7 +6,7 @@
-- @alias druid.radio_group -- @alias druid.radio_group
--- On any checkbox click --- On any checkbox click
-- @tfield druid_event on_radio_click -- @tfield DruidEvent on_radio_click @{DruidEvent}
--- Array of checkbox components --- Array of checkbox components
-- @tfield Checkbox[] checkboxes -- @tfield Checkbox[] checkboxes
@ -29,7 +29,7 @@ end
--- Component init function --- Component init function
-- @tparam RadioGroup self -- @tparam RadioGroup self @{RadioGroup}
-- @tparam node[] nodes Array of gui node -- @tparam node[] nodes Array of gui node
-- @tparam function callback Radio callback -- @tparam function callback Radio callback
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes -- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
@ -51,7 +51,7 @@ end
--- Set radio group state --- Set radio group state
-- @tparam RadioGroup self -- @tparam RadioGroup self @{RadioGroup}
-- @tparam number index Index in radio group -- @tparam number index Index in radio group
-- @tparam boolean is_instant If is instant state change -- @tparam boolean is_instant If is instant state change
function RadioGroup.set_state(self, index, is_instant) function RadioGroup.set_state(self, index, is_instant)
@ -60,7 +60,7 @@ end
--- Return radio group state --- Return radio group state
-- @tparam RadioGroup self -- @tparam RadioGroup self @{RadioGroup}
-- @treturn number Index in radio group -- @treturn number Index in radio group
function RadioGroup.get_state(self) function RadioGroup.get_state(self)
local result = -1 local result = -1

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid slider component --- Druid slider component
-- @module Slider -- @module Slider
@ -6,7 +6,7 @@
-- @alias druid.slider -- @alias druid.slider
--- On change value callback(self, value) --- On change value callback(self, value)
-- @tfield druid_event on_change_value -- @tfield DruidEvent on_change_value @{DruidEvent}
--- Slider pin node --- Slider pin node
-- @tfield node node -- @tfield node node
@ -55,7 +55,7 @@ end
--- Component init function --- Component init function
-- @tparam Slider self -- @tparam Slider self @{Slider}
-- @tparam node node Gui pin node -- @tparam node node Gui pin node
-- @tparam vector3 end_pos The end position of slider -- @tparam vector3 end_pos The end position of slider
-- @tparam[opt] function callback On slider change callback -- @tparam[opt] function callback On slider change callback
@ -94,6 +94,17 @@ function Slider.on_input(self, action_id, action)
end end
end end
if not self.is_drag and self._input_node and gui.pick_node(self._input_node, action.x, action.y) then
if action.pressed and gui.screen_to_local then
self.pos = gui.screen_to_local(self.node, vmath.vector3(action.screen_x, action.screen_y, 0))
self.pos.x = helper.clamp(self.pos.x, self.start_pos.x, self.end_pos.x)
self.pos.y = helper.clamp(self.pos.y, self.start_pos.y, self.end_pos.y)
gui.set_position(self.node, self.pos)
self.is_drag = true
end
end
if self.is_drag and not action.pressed then if self.is_drag and not action.pressed then
-- move -- move
self.pos.x = self.pos.x + action.dx self.pos.x = self.pos.x + action.dx
@ -148,7 +159,7 @@ end
--- Set value for slider --- Set value for slider
-- @tparam Slider self -- @tparam Slider self @{Slider}
-- @tparam number value Value from 0 to 1 -- @tparam number value Value from 0 to 1
-- @tparam[opt] bool is_silent Don't trigger event if true -- @tparam[opt] bool is_silent Don't trigger event if true
function Slider.set(self, value, is_silent) function Slider.set(self, value, is_silent)
@ -163,11 +174,26 @@ end
--- Set slider steps. Pin node will --- Set slider steps. Pin node will
-- apply closest step position -- apply closest step position
-- @tparam Slider self -- @tparam Slider self @{Slider}
-- @tparam number[] steps Array of steps -- @tparam number[] steps Array of steps
-- @usage slider:set_steps({0, 0.2, 0.6, 1}) -- @usage slider:set_steps({0, 0.2, 0.6, 1})
-- @treturn Slider @{Slider}
function Slider.set_steps(self, steps) function Slider.set_steps(self, steps)
self.steps = steps self.steps = steps
return self
end
--- Set input zone for slider.
-- User can touch any place of node, pin instantly will
-- move at this position and node drag will start.
-- This function require the Defold version 1.3.0+
-- @tparam Slider self @{Slider}
-- @tparam Node input_node
-- @treturn Slider @{Slider}
function Slider.set_input_node(self, input_node)
self._input_node = self:get_node(input_node)
return self
end end

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Component to handle GUI timers. --- Component to handle GUI timers.
-- Timer updating by game delta time. If game is not focused - -- Timer updating by game delta time. If game is not focused -
@ -8,13 +8,13 @@
-- @alias druid.timer -- @alias druid.timer
--- On timer tick. Fire every second callback(self, value) --- On timer tick. Fire every second callback(self, value)
-- @tfield druid_event on_tick -- @tfield DruidEvent on_tick @{DruidEvent}
--- On timer change enabled state callback(self, is_enabled) --- On timer change enabled state callback(self, is_enabled)
-- @tfield druid_event on_set_enabled -- @tfield DruidEvent on_set_enabled @{DruidEvent}
--- On timer end callback --- On timer end callback
-- @tfield druid_event on_timer_end(self, Timer) -- @tfield DruidEvent on_timer_end(self, Timer) @{DruidEvent}
--- Trigger node --- Trigger node
-- @tfield node node -- @tfield node node
@ -39,7 +39,7 @@ local Timer = component.create("timer")
--- Component init function --- Component init function
-- @tparam Timer self -- @tparam Timer self @{Timer}
-- @tparam node node Gui text node -- @tparam node node Gui text node
-- @tparam number seconds_from Start timer value in seconds -- @tparam number seconds_from Start timer value in seconds
-- @tparam[opt=0] number seconds_to End timer value in seconds -- @tparam[opt=0] number seconds_to End timer value in seconds
@ -94,7 +94,7 @@ end
--- Set text to text field --- Set text to text field
-- @tparam Timer self -- @tparam Timer self @{Timer}
-- @tparam number set_to Value in seconds -- @tparam number set_to Value in seconds
function Timer.set_to(self, set_to) function Timer.set_to(self, set_to)
self.last_value = set_to self.last_value = set_to
@ -103,7 +103,7 @@ end
--- Called when update --- Called when update
-- @tparam Timer self -- @tparam Timer self @{Timer}
-- @tparam bool is_on Timer enable state -- @tparam bool is_on Timer enable state
function Timer.set_state(self, is_on) function Timer.set_state(self, is_on)
self.is_on = is_on self.is_on = is_on
@ -113,7 +113,7 @@ end
--- Set time interval --- Set time interval
-- @tparam Timer self -- @tparam Timer self @{Timer}
-- @tparam number from Start time in seconds -- @tparam number from Start time in seconds
-- @tparam number to Target time in seconds -- @tparam number to Target time in seconds
function Timer.set_interval(self, from, to) function Timer.set_interval(self, from, to)

View File

@ -1,7 +1,8 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
-- Druid helper module for gui layouts --- Druid helper module for gui layouts
-- @module helper -- @module Helper
-- @alias druid.helper
local const = require("druid.const") local const = require("druid.const")
@ -172,7 +173,6 @@ function M.is_enabled(node)
end end
--- Return closest non inverted clipping parent node for node --- Return closest non inverted clipping parent node for node
-- @function helper.get_closest_stencil_node -- @function helper.get_closest_stencil_node
-- @tparam node node Gui node -- @tparam node node Gui node
@ -208,7 +208,7 @@ end
--- Check if device is mobile (Android or iOS) --- Check if device is mobile (Android or iOS)
-- @function helper..is_mobile -- @function helper.is_mobile
function M.is_mobile() function M.is_mobile()
return const.CURRENT_SYSTEM_NAME == const.OS.IOS or return const.CURRENT_SYSTEM_NAME == const.OS.IOS or
const.CURRENT_SYSTEM_NAME == const.OS.ANDROID const.CURRENT_SYSTEM_NAME == const.OS.ANDROID
@ -222,6 +222,27 @@ function M.is_web()
end end
--- Transform table to oneline string
-- @tparam table t
-- @treturn string
function M.table_to_string(t)
if not t then
return const.EMPTY_STRING
end
local result = "{"
for key, value in pairs(t) do
if #result > 1 then
result = result .. ","
end
result = result .. key .. ": " .. value
end
return result .. "}"
end
--- Distance from node position to his borders --- Distance from node position to his borders
-- @function helper.get_border -- @function helper.get_border
-- @tparam node node The gui node to check -- @tparam node node The gui node to check

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid inner module to acquire/release input --- Druid inner module to acquire/release input
-- @module helper.input -- @module helper.input

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid module with utils on string formats --- Druid module with utils on string formats
-- @local -- @local

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
local M = {} local M = {}

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
local const = require("druid.const") local const = require("druid.const")
local settings = require("druid.system.settings") local settings = require("druid.system.settings")

View File

@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 147.0
y: 49.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_blue"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 15.0
y: 10.0
z: 15.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 5.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 175.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Button"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 147.0
y: 49.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_green"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 15.0
y: 10.0
z: 15.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 5.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 175.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Button"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 147.0
y: 49.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_red"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 15.0
y: 10.0
z: 15.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 5.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 175.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Button"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 147.0
y: 49.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_yellow"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 15.0
y: 10.0
z: 15.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 5.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 175.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Button"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.5
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -0,0 +1,181 @@
script: ""
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 50.0
y: 50.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 38.0
y: 36.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/check_back_square"
id: "back"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
custom_type: 0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 21.0
y: 20.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/checkmark"
id: "checkmark"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -0,0 +1,137 @@
script: ""
fonts {
name: "game"
font: "/example/assets/fonts/game.font"
}
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 180.0
y: 45.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/progress_back"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 20.0
y: 10.0
z: 20.0
w: 10.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 3.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.75
y: 0.75
z: 1.0
w: 1.0
}
size {
x: 220.0
y: 45.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Input"
font: "game"
id: "text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "root"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.75
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -0,0 +1,181 @@
script: ""
textures {
name: "kenney"
texture: "/example/assets/images/kenney.atlas"
}
background_color {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 4.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/slider_back"
id: "root"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
layer: ""
inherit_alpha: true
slice9 {
x: 10.0
y: 0.0
z: 10.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 240.0
y: 45.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/empty"
id: "input_zone"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_MANUAL
custom_type: 0
}
nodes {
position {
x: -100.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.7
y: 0.7
z: 1.0
w: 1.0
}
size {
x: 36.0
y: 36.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/slider_move"
id: "pin"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "root"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
custom_type: 0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT
max_nodes: 512

View File

@ -1,3 +1,3 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
return {} return {}

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
local M = {} local M = {}

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Instance of Druid. Make one instance per gui_script with next code: --- Instance of Druid. Make one instance per gui_script with next code:
-- --
@ -61,9 +61,10 @@ local data_list = require("druid.extended.data_list")
local DruidInstance = class("druid.druid_instance") local DruidInstance = class("druid.druid_instance")
local IS_NO_AUTO_INPUT = sys.get_config("druid.no_auto_input") == "1"
local function input_init(self) local function input_init(self)
if self._no_auto_input then if IS_NO_AUTO_INPUT then
return return
end end
@ -75,7 +76,7 @@ end
local function input_release(self) local function input_release(self)
if self._no_auto_input then if IS_NO_AUTO_INPUT then
return return
end end
@ -105,7 +106,7 @@ 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()
instance:setup_component(self, self._context, self._style) instance:setup_component(self, self._context, self._style, instance_class)
table.insert(self.components_all, instance) table.insert(self.components_all, instance)
@ -140,7 +141,6 @@ local function check_sort_input_stack(self, components)
end end
--- Check whitelists and blacklists for input components --- Check whitelists and blacklists for input components
local function can_use_input_component(self, component) local function can_use_input_component(self, component)
local can_by_whitelist = true local can_by_whitelist = true
@ -195,17 +195,18 @@ end
-- @tparam DruidInstance self -- @tparam DruidInstance self
-- @tparam table context Druid context. Usually it is self of script -- @tparam table context Druid context. Usually it is self of script
-- @tparam table style Druid style module -- @tparam table style Druid style module
-- @local
function DruidInstance.initialize(self, context, style) function DruidInstance.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._is_late_remove_enabled = false
self._late_remove = {} self._late_remove = {}
self._is_debug = false
self.url = msg.url() self.url = msg.url()
self._input_blacklist = nil self._input_blacklist = nil
self._input_whitelist = nil self._input_whitelist = nil
self._no_auto_input = (sys.get_config("druid.no_auto_input") == "1")
self.components_interest = {} self.components_interest = {}
self.components_all = {} self.components_all = {}
@ -257,6 +258,8 @@ function DruidInstance.final(self)
self._deleted = true self._deleted = true
input_release(self) input_release(self)
self:log_message("Druid final")
end end
@ -265,7 +268,7 @@ end
-- @tparam DruidInstance self -- @tparam DruidInstance self
-- @tparam Component component Component instance -- @tparam Component component Component instance
function DruidInstance.remove(self, component) function DruidInstance.remove(self, component)
if self._is_input_processing then if self._is_late_remove_enabled then
table.insert(self._late_remove, component) table.insert(self._late_remove, component)
return return
end end
@ -301,6 +304,8 @@ function DruidInstance.remove(self, component)
end end
end end
end end
self:log_message("Remove", { name = component:get_name(), parent = component:get_parent_name() })
end end
@ -319,10 +324,14 @@ function DruidInstance.update(self, dt)
input_init(self) input_init(self)
end end
self._is_late_remove_enabled = true
local components = self.components_interest[base_component.ON_UPDATE] local components = self.components_interest[base_component.ON_UPDATE]
for i = 1, #components do for i = 1, #components do
components[i]:update(dt) components[i]:update(dt)
end end
self._is_late_remove_enabled = false
self:_clear_late_remove()
end end
@ -332,21 +341,15 @@ end
-- @tparam table action Action from on_input -- @tparam table action Action from on_input
-- @treturn bool The boolean value is input was consumed -- @treturn bool The boolean value is input was consumed
function DruidInstance.on_input(self, action_id, action) function DruidInstance.on_input(self, action_id, action)
self._is_input_processing = true self._is_late_remove_enabled = true
local components = self.components_interest[base_component.ON_INPUT] local components = self.components_interest[base_component.ON_INPUT]
check_sort_input_stack(self, components) check_sort_input_stack(self, components)
local is_input_consumed = process_input(self, action_id, action, components) local is_input_consumed = process_input(self, action_id, action, components)
self._is_input_processing = false self._is_late_remove_enabled = 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
self:_clear_late_remove()
return is_input_consumed return is_input_consumed
end end
@ -391,46 +394,43 @@ end
--- Druid on focus lost interest function. --- Druid on focus lost interest function.
-- This one called by on_window_callback by global window listener -- This one called by on_window_callback by global window listener
-- @tparam DruidInstance self -- @tparam DruidInstance self
-- @local
function DruidInstance.on_focus_lost(self) function DruidInstance.on_focus_lost(self)
local components = self.components_interest[base_component.ON_FOCUS_LOST] local components = self.components_interest[base_component.ON_FOCUS_LOST]
for i = 1, #components do for i = 1, #components do
components[i]:on_focus_lost() components[i]:on_focus_lost()
end end
self:log_message("On focus lost")
end end
--- Druid on focus gained interest function. --- Druid on focus gained interest function.
-- This one called by on_window_callback by global window listener -- This one called by on_window_callback by global window listener
-- @tparam DruidInstance self -- @tparam DruidInstance self
-- @local
function DruidInstance.on_focus_gained(self) function DruidInstance.on_focus_gained(self)
local components = self.components_interest[base_component.ON_FOCUS_GAINED] local components = self.components_interest[base_component.ON_FOCUS_GAINED]
for i = 1, #components do for i = 1, #components do
components[i]:on_focus_gained() components[i]:on_focus_gained()
end end
end
self:log_message("On focus gained")
--- Druid on layout change function.
-- Called on update gui layout
-- @tparam DruidInstance self
function DruidInstance.on_layout_change(self)
local components = self.components_interest[base_component.ON_LAYOUT_CHANGE]
for i = 1, #components do
components[i]:on_layout_change()
end
end end
--- Druid on language change. --- Druid on language change.
-- This one called by global gruid.on_language_change, but can be -- This one called by global druid.on_language_change, but can be
-- call manualy to update all translations -- call manualy to update all translations
-- @tparam DruidInstance self -- @tparam DruidInstance self
-- @function druid.on_language_change -- @local
function DruidInstance.on_language_change(self) function DruidInstance.on_language_change(self)
local components = self.components_interest[base_component.ON_LANGUAGE_CHANGE] local components = self.components_interest[base_component.ON_LANGUAGE_CHANGE]
for i = 1, #components do for i = 1, #components do
components[i]:on_language_change() components[i]:on_language_change()
end end
self:log_message("On language change")
end end
@ -439,7 +439,6 @@ end
-- component will be not processed on input step -- component will be not processed on input step
-- @tparam DruidInstance self -- @tparam DruidInstance self
-- @tparam[opt=nil] table|Component whitelist_components The array of component to whitelist -- @tparam[opt=nil] table|Component whitelist_components The array of component to whitelist
-- @function druid.set_whitelist
function DruidInstance.set_whitelist(self, whitelist_components) function DruidInstance.set_whitelist(self, whitelist_components)
if whitelist_components and whitelist_components.isInstanceOf then if whitelist_components and whitelist_components.isInstanceOf then
whitelist_components = { whitelist_components } whitelist_components = { whitelist_components }
@ -460,9 +459,8 @@ end
--- Set blacklist components for input processing. --- Set blacklist components for input processing.
-- If blacklist is not empty and component contains in this list, -- If blacklist is not empty and component contains in this list,
-- component will be not processed on input step -- component will be not processed on input step
-- @tparam DruidInstance self -- @tparam DruidInstance self @{DruidInstance}
-- @tparam[opt=nil] table|Component blacklist_components The array of component to blacklist -- @tparam[opt=nil] table|Component blacklist_components The array of component to blacklist
-- @function druid.set_blacklist
function DruidInstance.set_blacklist(self, blacklist_components) function DruidInstance.set_blacklist(self, blacklist_components)
if blacklist_components and blacklist_components.isInstanceOf then if blacklist_components and blacklist_components.isInstanceOf then
blacklist_components = { blacklist_components } blacklist_components = { blacklist_components }
@ -480,6 +478,40 @@ function DruidInstance.set_blacklist(self, blacklist_components)
end end
--- Set debug mode for current Druid instance. It's enable debug log messages
-- @tparam DruidInstance self @{DruidInstance}
-- @tparam bool is_debug
-- @treturn self @{DruidInstance}
function DruidInstance.set_debug(self, is_debug)
self._is_debug = is_debug
return self
end
--- Log message, if is_debug mode is enabled
-- @tparam DruidInstance self @{DruidInstance}
-- @tparam string message
-- @tparam[opt] table context
function DruidInstance.log_message(self, message, context)
if not self._is_debug then
return
end
print("[Druid]:", message, helper.table_to_string(context))
end
--- Remove all components on late remove step
-- @tparam DruidInstance self @{DruidInstance}
-- @local
function DruidInstance._clear_late_remove(self)
if #self._late_remove > 0 then
for i = 1, #self._late_remove do
self:remove(self._late_remove[i])
end
self._late_remove = {}
end
end
--- Create button basic component --- Create button basic component
-- @tparam DruidInstance self -- @tparam DruidInstance self
-- @tparam node node Gui node -- @tparam node node Gui node
@ -658,9 +690,9 @@ end
--- Create data list basic component --- Create data list basic component
-- @function druid:new_data_list -- @tparam DruidInstance self
-- @tparam druid.scroll druid_scroll The Scroll instance for Data List component -- @tparam Scroll druid_scroll The Scroll instance for Data List component
-- @tparam druid.grid druid_grid The Grid instance for Data List component -- @tparam Grid druid_grid The Grid instance for Data List component
-- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component]) -- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component])
-- @treturn DataList data_list component -- @treturn DataList data_list component
function DruidInstance.new_data_list(self, druid_scroll, druid_grid, create_function) function DruidInstance.new_data_list(self, druid_scroll, druid_grid, create_function)

View File

@ -1,4 +1,4 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license -- Copyright (c) 2021 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid settings file --- Druid settings file
-- @module settings -- @module settings

View File

@ -0,0 +1,28 @@
local component = require("druid.component")
---@class component_name : druid.base_component
local Component = component.create("component_name")
local SCHEME = {
ROOT = "root",
BUTTON = "button",
}
-- Component constructor. Template name and nodes are optional. Pass it if you use it in your component
function Component:init(template, nodes)
self:set_template(template)
self:set_nodes(nodes)
self.root = self:get_node(SCHEME.ROOT)
self.druid = self:get_druid()
self.button = self.druid:new_button(SCHEME.BUTTON, function() end)
end
-- [OPTIONAL] Call on component remove or on druid:final
function Component:on_remove()
end
return Component

View File

@ -1,15 +1,28 @@
-- Copyright (c) 2021 Maxim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
--- Druid component template
-- @module druid.component
-- @local
local component = require("druid.component") local component = require("druid.component")
local Component = component.create("my_component_name") ---@class component_name : druid.base_component
local Component = component.create("component_name")
-- Scheme of component gui nodes
local SCHEME = {
ROOT = "root",
BUTTON = "button",
}
-- Component constructor -- Component constructor. Template name and nodes are optional. Pass it if you use it in your component
function Component:init(...) function Component:init(template, nodes)
-- If your component is gui template, pass the template name and set it
self:set_template(template)
-- If your component is cloned my gui.clone_tree, pass nodes to component and set it
self:set_nodes(nodes)
-- self:get_node will auto process component template and nodes
self.root = self:get_node(SCHEME.ROOT)
-- Use inner druid instance to create components inside this component
self.druid = self:get_druid()
end end

View File

@ -1,76 +0,0 @@
--- @license MIT, Insality 2021
--- @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

Some files were not shown because too many files have changed in this diff Show More