diff --git a/README.md b/README.md index c2fd370..f80fe74 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/insality/druid/ci-workflow.yml?branch=master)](https://github.com/Insality/druid/actions) [![codecov](https://codecov.io/gh/Insality/druid/branch/master/graph/badge.svg)](https://codecov.io/gh/Insality/druid) -**Druid** - most powerful Defold component UI framework. Use basic and extended **Druid** components or make your own game-specific components with ease to make stunning and customizable GUI in your games. +**Druid** - powerful Defold component UI framework. Use huge list of embedeed **Druid** components or make your own game-specific components with ease to make stunning and customizable GUI in your games. ## Setup diff --git a/docs_md/01-components.md b/docs_md/01-components.md index 892b8d1..16c30b3 100644 --- a/docs_md/01-components.md +++ b/docs_md/01-components.md @@ -133,7 +133,7 @@ Usually, Place _view_node_ and as children add _content_node_: - *on_scroll_to* (self, position, is_instant) On scroll_to function callback - *on_point_scroll* (self, item_index, position) On scroll_to_index function callback - You can adjust scroll content size by `scroll:set_size(node_size)`. It will setup new size to _content node_ -- You can enabled or disable inertion mode via `scroll:set_intert(state)` +- You can enabled or disable inertion mode via `scroll:set_inert(state)` - You can adjust extra stretch size via `scroll:set_extra_stretch_size` - Multitouch is required for scroll. Scroll is correctly handling touch_id swap while dragging scroll diff --git a/druid/base/button.lua b/druid/base/button.lua index d13bed5..566336b 100755 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -245,7 +245,7 @@ end --- Component style params. --- You can override this component styles params in druid styles table +-- You can override this component styles params in Druid styles table -- or create your own style -- @table style -- @tfield[opt=0.4] number LONGTAP_TIME Minimum time to trigger on_hold_callback @@ -270,13 +270,13 @@ function Button.on_style_change(self, style) end ---- Button component constructor +--- @{Button} constructor -- @tparam Button self @{Button} --- @tparam node node Gui node --- @tparam function callback Button callback --- @tparam[opt] table params Button callback params --- @tparam[opt] node anim_node Button anim node (node, if not provided) -function Button.init(self, node, callback, params, anim_node) +-- @tparam string|Node node Node name or GUI Node itself +-- @tparam function callback On click button callback +-- @tparam[opt] table custom_args Button events custom arguments +-- @tparam[opt] string|Node anim_node Node to animate instead of trigger node +function Button.init(self, node, callback, custom_args, anim_node) self.druid = self:get_druid() self.node = self:get_node(node) self.node_id = gui.get_id(self.node) @@ -284,7 +284,7 @@ function Button.init(self, node, callback, params, anim_node) self.anim_node = anim_node and self:get_node(anim_node) or self.node self.start_scale = gui.get_scale(self.anim_node) self.start_pos = gui.get_position(self.anim_node) - self.params = params + self.params = custom_args self.hover = self.druid:new_hover(node, on_button_hover) self.hover.on_mouse_hover:subscribe(on_button_mouse_hover) self.click_zone = nil @@ -297,7 +297,7 @@ function Button.init(self, node, callback, params, anim_node) self._check_function = nil self._failure_callback = nil - -- Event stubs + -- Events self.on_click = Event(callback) self.on_pressed = Event() self.on_repeated_click = Event() @@ -451,6 +451,8 @@ end --- Get button enabled state. +-- +-- By default all Buttons is enabled on creating. -- @tparam Button self @{Button} -- @treturn bool True, if button is enabled now, False overwise -- @usage @@ -503,7 +505,7 @@ end --- 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 failure_callback Function what will be called on button click, if check function return false +-- @tparam[opt] function failure_callback Function will be called on button click, if check function return false -- @treturn Button Current button instance function Button.set_check_function(self, check_function, failure_callback) self._check_function = check_function @@ -511,16 +513,19 @@ function Button.set_check_function(self, check_function, failure_callback) end ---- Set buttom click mode to call itself inside html5 callback in user interaction event --- It required to do protected stuff like copy/paste text, show html keyboard, etc --- The HTML5 button doesn't call any events except on_click event +--- Set Button mode to work inside user HTML5 interaction event. +-- +-- It's required to make protected things like copy & paste text, show mobile keyboard, etc +-- The HTML5 button's doesn't call any events except on_click event. +-- +-- If the game is not HTML, HTML html mode will be not enabled -- @tparam Button self --- @tparam[opt] boolean is_html_mode If true - button will be called inside html5 callback +-- @tparam[opt] boolean is_web_mode If true - button will be called inside html5 callback -- @treturn Button Current button instance -- @usage --- button:set_html5_user_interaction(true) -function Button.set_html5_user_interaction(self, is_html_mode) - self._is_html5_mode = is_html_mode and html5 +-- button:set_web_user_interaction(true) +function Button.set_web_user_interaction(self, is_web_mode) + self._is_html5_mode = is_web_mode and html5 return self end diff --git a/druid/base/text.lua b/druid/base/text.lua index 5d7d110..286295f 100755 --- a/druid/base/text.lua +++ b/druid/base/text.lua @@ -1,7 +1,7 @@ -- Copyright (c) 2021 Maksim Tuprikov . This code is licensed under MIT license --- Component to handle all GUI texts. --- Druid text can adjust itself for text node size +-- Druid Text adjust itself for text node size -- Text will never will be outside of his text size (even multiline) -- @module Text -- @within BaseComponent diff --git a/druid/custom/rich_text/module/rt.lua b/druid/custom/rich_text/module/rt.lua index 5f3d309..b9c4d58 100755 --- a/druid/custom/rich_text/module/rt.lua +++ b/druid/custom/rich_text/module/rt.lua @@ -486,7 +486,7 @@ function M.adjust_to_area(words, settings, lines_metrics) end adjust_scale = adjust_scale + step - local lines = M.apply_scale_without_update(words, settings, adjust_scale) + lines = M.apply_scale_without_update(words, settings, adjust_scale) is_fit = M.is_fit_info_area(lines, settings) if i == M.ADJUST_STEPS then