From f4f04a17df7335ea36d2bf516f6b3c22dd211555 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 24 May 2020 22:48:46 +0300 Subject: [PATCH 01/12] #65 Add hover set_enabled function, disabled button do not provide hover events --- druid/base/button.lua | 1 + druid/base/hover.lua | 31 ++++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/druid/base/button.lua b/druid/base/button.lua index 08cb288d..5ea8ad45 100644 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -267,6 +267,7 @@ end -- @tparam bool state Enabled state function M.set_enabled(self, state) self.disabled = not state + self.hover:set_enabled(state) self.style.on_set_enabled(self, self.node, state) end diff --git a/druid/base/hover.lua b/druid/base/hover.lua index e4c9b8db..aabc0b38 100644 --- a/druid/base/hover.lua +++ b/druid/base/hover.lua @@ -24,6 +24,8 @@ function M.init(self, node, on_hover_callback) self._is_hovered = false self._is_mouse_hovered = false + self._is_enabled = true + self.on_hover = Event(on_hover_callback) self.on_mouse_hover = Event() end @@ -38,7 +40,7 @@ function M.on_input(self, action_id, action) return false end - if not helper.is_enabled(self.node) then + if not helper.is_enabled(self.node) or not self._is_enabled then return false end @@ -97,4 +99,31 @@ function M.set_click_zone(self, zone) end +--- Set enable state of hover component. +-- If hover is not enabled, it will not generate +-- any hover events +-- @function hover:set_enabled +-- @tparam bool state The hover enabled state +function M.set_enabled(self, state) + self._is_enabled = state + + if not state then + if self._is_hovered then + M.set_hover(false) + end + if self._is_mouse_hovered then + M.set_mouse_hover(false) + end + end +end + + +--- Return current hover enabled state +-- @function hover:is_enabled +-- @treturn bool The hover enabled state +function M.is_enabled(self) + return self._is_enabled +end + + return M From d3a56f717ea05a7254e38de576fdf5f6d799dcd9 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 24 May 2020 22:53:40 +0300 Subject: [PATCH 02/12] #62 Add release_input_focus on druid:final if auto_input enabled --- druid/system/druid_instance.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index b3c5991b..9261addb 100644 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -58,6 +58,18 @@ local function input_init(self) end +local function input_release(self) + if sys.get_config("druid.no_auto_input") == "1" then + return + end + + if self.input_inited then + self.input_inited = false + druid_input.remove() + end +end + + -- Create the component itself local function create(self, instance_class) local instance = instance_class() @@ -160,6 +172,8 @@ function Druid.final(self) end self._deleted = true + + input_release() end From 474b97469eacb48c7741b11b584f08d420c677b1 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 24 May 2020 22:56:53 +0300 Subject: [PATCH 03/12] #69 Fix annotations in button component --- druid/base/button.lua | 9 +++++++-- druid/base/input.lua | 4 ++-- druid/base/scroll.lua | 9 +++++---- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/druid/base/button.lua b/druid/base/button.lua index 5ea8ad45..a18b0a8d 100644 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -265,10 +265,13 @@ end --- Set enabled button component state -- @function button:set_enabled -- @tparam bool state Enabled state +-- @treturn druid.button Current button instance function M.set_enabled(self, state) self.disabled = not state self.hover:set_enabled(state) self.style.on_set_enabled(self, self.node, state) + + return self end @@ -284,10 +287,11 @@ end -- no click events outside stencil node -- @function button:set_click_zone -- @tparam node zone Gui node --- @tparam druid.button Self instance to make chain calls +-- @treturn druid.button Current button instance function M.set_click_zone(self, zone) self.click_zone = self:get_node(zone) self.hover:set_click_zone(zone) + return self end @@ -295,9 +299,10 @@ end --- Set key-code to trigger this button -- @function button:set_key_trigger -- @tparam hash key The action_id of the key --- @tparam druid.button Self instance to make chain calls +-- @treturn druid.button Current button instance function M.set_key_trigger(self, key) self.key_trigger = hash(key) + return self end diff --git a/druid/base/input.lua b/druid/base/input.lua index ecc549e6..a7a244cd 100644 --- a/druid/base/input.lua +++ b/druid/base/input.lua @@ -282,7 +282,7 @@ end -- Pass nil to make input field unliminted (by default) -- @function input:set_max_length -- @tparam number max_length Maximum length for input text field --- @treturn druid.input Self instance to make chain calls +-- @treturn druid.input Current input instance function M.set_max_length(self, max_length) self.max_length = max_length return self @@ -294,7 +294,7 @@ end -- ex: [%a%d] for alpha and numeric -- @function input:set_allowerd_characters -- @tparam string characters Regulax exp. for validate user input --- @treturn druid.input Self instance to make chain calls +-- @treturn druid.input Current input instance function M.set_allowed_characters(self, characters) self.allowed_characters = characters return self diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index 02740f1f..6577cbd3 100644 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -473,7 +473,7 @@ end -- It will change content gui node size -- @function scroll:set_size -- @tparam vector3 size The new size for content node --- @treturn druid.scroll Self instance +-- @treturn druid.scroll Current scroll instance function M.set_size(self, size) gui.set_size(self.content_node, size) update_size(self) @@ -487,9 +487,10 @@ end -- If no points, just simple drag without inertion -- @function scroll:set_inert -- @tparam bool state Inert scroll state --- @treturn druid.scroll Self instance +-- @treturn druid.scroll Current scroll instance function M.set_inert(self, state) self._is_inert = state + return self end @@ -506,7 +507,7 @@ end -- Set 0 to disable stretching effect -- @function scroll:set_extra_strech_size -- @tparam[opt=0] number stretch_size Size in pixels of additional scroll area --- @treturn druid.scroll Self instance +-- @treturn druid.scroll Current scroll instance function M.set_extra_strech_size(self, stretch_size) self.style.EXTRA_STRECH_SIZE = stretch_size or 0 update_size(self) @@ -527,7 +528,7 @@ end -- Scroll will always centered on closer points -- @function scroll:set_points -- @tparam table points Array of vector3 points --- @treturn druid.scroll Self instance +-- @treturn druid.scroll Current scroll instance function M.set_points(self, points) self.points = points From e621edd654e456baf0a99b28110ca1e9daad1ecc Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 24 May 2020 23:19:49 +0300 Subject: [PATCH 04/12] Fix nodes component type check --- druid/component.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/druid/component.lua b/druid/component.lua index debb3c27..3d8fb605 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -109,13 +109,15 @@ function Component.get_node(self, node_or_name) template_name = template_name .. "/" end + local node_type = type(node_or_name) if nodes then - assert(type(node_or_name) == "strings", "You should pass node name instead of node") + assert(node_type == const.STRING, "You should pass node name instead of node") return nodes[template_name .. node_or_name] else - if type(node_or_name) == const.STRING then + if node_type == const.STRING then return gui.get_node(template_name .. node_or_name) else + -- Assume it's already node from gui.get_node return node_or_name end end From a2f8926cb0f5bd978dc6afd3cd159cb98f3f99e2 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 24 May 2020 23:23:38 +0300 Subject: [PATCH 05/12] Fix typo --- druid/system/druid_instance.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index 9261addb..c06b282b 100644 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -173,7 +173,7 @@ function Druid.final(self) self._deleted = true - input_release() + input_release(self) end From bf81bdfae09d65624f028a5579c580dfab36fa50 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 14 Jun 2020 13:23:01 +0300 Subject: [PATCH 06/12] Add custom component template --- druid/base/component.template.lua | 63 +++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 druid/base/component.template.lua diff --git a/druid/base/component.template.lua b/druid/base/component.template.lua new file mode 100644 index 00000000..44621904 --- /dev/null +++ b/druid/base/component.template.lua @@ -0,0 +1,63 @@ +local const = require("druid.const") +local component = require("druid.component") + +local M = component.create("my_component_name", { M.ON_UPDATE }) + + +-- Component constructor +function M.init(self, ...) +end + + +-- Call only if exist interest: const.ON_UPDATE +function M.update(self, dt) +end + + +-- Call only if exist interest: const.ON_INPUT or const.ON_INPUT_HIGH +function M.on_input(self, action_id, action) +end + + +-- Call on component creation and on component:set_style() function +function M.on_style_change(self, style) +end + + +-- Call only if exist interest: const.ON_MESSAGE +function M.on_message(self, message_id, message, sender) +end + + +-- Call only if component with ON_LANGUAGE_CHANGE interest +function M.on_language_change(self) +end + + +-- Call only if component with ON_LAYOUT_CHANGE interest +function M.on_layout_change(self) +end + + +-- Call, if input was capturing before this component +-- Example: scroll is start scrolling, so you need unhover button +function M.on_input_interrupt(self) +end + + +-- Call, if game lost focus. Need ON_FOCUS_LOST intereset +function M.on_focus_lost(self) +end + + +-- Call, if game gained focus. Need ON_FOCUS_GAINED intereset +function M.on_focus_gained(self) +end + + +-- Call on component remove or on druid:final +function M.on_remove(self) +end + + +return M From 2ef288402e3c6f3f736886f65fdc81842946dc49 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 14 Jun 2020 13:23:21 +0300 Subject: [PATCH 07/12] Typo fix in custom component --- druid/base/component.template.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/druid/base/component.template.lua b/druid/base/component.template.lua index 44621904..3a72b7d3 100644 --- a/druid/base/component.template.lua +++ b/druid/base/component.template.lua @@ -1,7 +1,7 @@ local const = require("druid.const") local component = require("druid.component") -local M = component.create("my_component_name", { M.ON_UPDATE }) +local M = component.create("my_component_name", { const.ON_UPDATE }) -- Component constructor From e8b180932146a85251edbd1be8042316b2f091f7 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 14 Jun 2020 13:26:22 +0300 Subject: [PATCH 08/12] #74 typo fix strech -> stretch --- druid/base/scroll.lua | 12 ++++++------ druid/styles/default/style.lua | 2 +- example/page/scroll_page.lua | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index 6577cbd3..35ed50ea 100644 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -290,7 +290,7 @@ local function update_size(self) -- We add extra size only if scroll is available -- Even the content zone size less than view zone size local content_border_extra = helper.get_border(self.content_node) - local stretch_size = self.style.EXTRA_STRECH_SIZE + local stretch_size = self.style.EXTRA_STRETCH_SIZE if self.drag.can_x then local sign = content_size.x > view_size.x and 1 or -1 @@ -325,11 +325,11 @@ end -- @tfield[opt=20] number POINTS_DEADZONE Speed to check points of interests in no_inertion mode -- @tfield[opt=0.35] number BACK_SPEED Scroll back returning lerp speed -- @tfield[opt=0.2] number ANIM_SPEED Scroll gui.animation speed for scroll_to function --- @tfield[opt=0] number EXTRA_STRECH_SIZE extra size in pixels outside of scroll (stretch effect) +-- @tfield[opt=0] number EXTRA_STRETCH_SIZE extra size in pixels outside of scroll (stretch effect) -- @tfield[opt=false] bool SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled function M.on_style_change(self, style) self.style = {} - self.style.EXTRA_STRECH_SIZE = style.EXTRA_STRECH_SIZE or 0 + self.style.EXTRA_STRETCH_SIZE = style.EXTRA_STRETCH_SIZE or 0 self.style.ANIM_SPEED = style.ANIM_SPEED or 0.2 self.style.BACK_SPEED = style.BACK_SPEED or 0.35 @@ -505,11 +505,11 @@ end --- Set extra size for scroll stretching. -- Set 0 to disable stretching effect --- @function scroll:set_extra_strech_size +-- @function scroll:set_extra_stretch_size -- @tparam[opt=0] number stretch_size Size in pixels of additional scroll area -- @treturn druid.scroll Current scroll instance -function M.set_extra_strech_size(self, stretch_size) - self.style.EXTRA_STRECH_SIZE = stretch_size or 0 +function M.set_extra_stretch_size(self, stretch_size) + self.style.EXTRA_STRETCH_SIZE = stretch_size or 0 update_size(self) return self diff --git a/druid/styles/default/style.lua b/druid/styles/default/style.lua index 27248f50..61e5ee77 100644 --- a/druid/styles/default/style.lua +++ b/druid/styles/default/style.lua @@ -63,7 +63,7 @@ M["scroll"] = { FRICT_HOLD = 0.79, -- mult. for inert, while touching INERT_THRESHOLD = 2.5, -- speed to stop inertion INERT_SPEED = 30, -- koef. of inert speed - EXTRA_STRECH_SIZE = 100, -- extra size in pixels outside of scroll (stretch effect) + EXTRA_STRETCH_SIZE = 100, -- extra size in pixels outside of scroll (stretch effect) POINTS_DEADZONE = 20, -- Speed to check points of interests in no_inertion mode SCROLL_WHEEL_SPEED = 20, diff --git a/example/page/scroll_page.lua b/example/page/scroll_page.lua index f48ec74b..1478b113 100644 --- a/example/page/scroll_page.lua +++ b/example/page/scroll_page.lua @@ -54,7 +54,7 @@ function M.setup_page(self) -- Content with less size than view self.druid:new_scroll("scroll_smaller_view", "scroll_smaller_content") - :set_extra_strech_size(0) + :set_extra_stretch_size(0) :set_inert(false) -- Scroll with points of interests From 409657c12bb532dda9632f662e3c5ba2f0bb5c69 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 14 Jun 2020 13:34:30 +0300 Subject: [PATCH 09/12] #72 fix return in on_input functions --- druid/base/component.template.lua | 1 + druid/base/drag.lua | 2 +- druid/base/hover.lua | 2 +- druid/base/swipe.lua | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/druid/base/component.template.lua b/druid/base/component.template.lua index 3a72b7d3..4637ca1f 100644 --- a/druid/base/component.template.lua +++ b/druid/base/component.template.lua @@ -16,6 +16,7 @@ end -- Call only if exist interest: const.ON_INPUT or const.ON_INPUT_HIGH function M.on_input(self, action_id, action) + return false end diff --git a/druid/base/drag.lua b/druid/base/drag.lua index 2c7e9a8c..a48f28c0 100644 --- a/druid/base/drag.lua +++ b/druid/base/drag.lua @@ -172,7 +172,7 @@ end function M.on_input(self, action_id, action) if action_id ~= const.ACTION_TOUCH and action_id ~= const.ACTION_MULTITOUCH then - return + return false end if not helper.is_enabled(self.node) then diff --git a/druid/base/hover.lua b/druid/base/hover.lua index aabc0b38..4fe3c33e 100644 --- a/druid/base/hover.lua +++ b/druid/base/hover.lua @@ -33,7 +33,7 @@ end function M.on_input(self, action_id, action) if action_id ~= const.ACTION_TOUCH and action_id ~= nil then - return + return false end if not action_id and helper.is_mobile() then diff --git a/druid/base/swipe.lua b/druid/base/swipe.lua index 4845216b..5b39cf48 100644 --- a/druid/base/swipe.lua +++ b/druid/base/swipe.lua @@ -95,7 +95,7 @@ end function M.on_input(self, action_id, action) if action_id ~= const.ACTION_TOUCH then - return + return false end if not helper.is_enabled(self.node) then From 844f0dc3561a89adc27e6976662f56496fec5f45 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 14 Jun 2020 20:09:23 +0300 Subject: [PATCH 10/12] #71 fix blocker input events --- druid/base/blocker.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/druid/base/blocker.lua b/druid/base/blocker.lua index e5c3931f..79238d2e 100644 --- a/druid/base/blocker.lua +++ b/druid/base/blocker.lua @@ -29,7 +29,9 @@ end function M.on_input(self, action_id, action) - if action_id ~= const.ACTION_TOUCH and action_id ~= const.ACTION_MULTITOUCH then + if action_id ~= const.ACTION_TOUCH and + action_id ~= const.ACTION_MULTITOUCH and + action_id ~= nil then return false end From 29137614abfc0028731e5523ead299e4bfbb63e5 Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 14 Jun 2020 20:14:05 +0300 Subject: [PATCH 11/12] Update docs --- README.md | 7 +-- docs/index.html | 2 +- docs/modules/component.html | 2 +- docs/modules/druid.back_handler.html | 2 +- docs/modules/druid.blocker.html | 2 +- docs/modules/druid.button.html | 36 ++++++++----- docs/modules/druid.checkbox.html | 2 +- docs/modules/druid.checkbox_group.html | 2 +- docs/modules/druid.drag.html | 2 +- docs/modules/druid.grid.html | 2 +- docs/modules/druid.helper.html | 2 +- docs/modules/druid.hover.html | 53 ++++++++++++++++++- docs/modules/druid.html | 2 +- docs/modules/druid.input.html | 6 +-- docs/modules/druid.lang_text.html | 2 +- docs/modules/druid.progress.html | 2 +- docs/modules/druid.radio_group.html | 2 +- docs/modules/druid.scroll.html | 18 +++---- docs/modules/druid.slider.html | 2 +- docs/modules/druid.swipe.html | 2 +- docs/modules/druid.text.html | 2 +- docs/modules/druid.timer.html | 2 +- docs/modules/druid_event.html | 2 +- docs/modules/druid_instance.html | 2 +- docs/topics/01-components.md.html | 10 ++-- .../02-creating_custom_components.md.html | 6 +-- docs/topics/03-styles.md.html | 2 +- docs/topics/04-druid_assets.md.html | 2 +- docs/topics/05-examples.md.html | 2 +- docs/topics/README.md.html | 9 ++-- docs/topics/changelog.md.html | 26 +++++---- docs_md/01-components.md | 1 + docs_md/02-creating_custom_components.md | 4 +- docs_md/changelog.md | 5 ++ 34 files changed, 151 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index cc2f0713..2fad1780 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![GitHub release (latest by date)](https://img.shields.io/github/v/release/insality/druid)](https://github.com/Insality/druid/releases) -**Druid** - powerful defold component UI library. Use basic **Druid** components or make your own game-specific components to make amazing GUI in your games. +**Druid** - powerful Defold component UI library. Use basic **Druid** components or make your own game-specific components to make amazing GUI in your games. ## Setup @@ -184,18 +184,19 @@ function on_message(self, message_id, message, sender) end ``` +- *final* required function for correct druid lifecycle - *on_input* used for almost all basic druid components - *update* used for progress bar, scroll and timer base components - *on_message* used for specific druid events, like language change or layout change -- *final* used for custom components, what have to do several action before destroy -Recommended is fully integrate al druid lifecycles functions +Recommended is fully integrate all druid lifecycles functions ## Features - Druid input goes as stack. Last created button will checked first. So create your GUI from back - Don't forget about `return` in `on_input`: `return self.druid:on_input()`. It need, if you have more than 1 acquire inputs (several druid, other input system, etc) +- Druid by default do _acquire_input_focus_. So you don't need do it manually. Buy only if you have components, which requires _on_input_ ## Examples diff --git a/docs/index.html b/docs/index.html index e4788f48..cd473348 100644 --- a/docs/index.html +++ b/docs/index.html @@ -200,7 +200,7 @@

Topics

generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
diff --git a/docs/modules/component.html b/docs/modules/component.html index 99b8ff45..7dcbe5ca 100644 --- a/docs/modules/component.html +++ b/docs/modules/component.html @@ -510,7 +510,7 @@

Parameters:

generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
diff --git a/docs/modules/druid.back_handler.html b/docs/modules/druid.back_handler.html index 7f6e1b09..a97c4c40 100644 --- a/docs/modules/druid.back_handler.html +++ b/docs/modules/druid.back_handler.html @@ -218,7 +218,7 @@

Fields:

generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
diff --git a/docs/modules/druid.blocker.html b/docs/modules/druid.blocker.html index 236317cd..e08833bb 100644 --- a/docs/modules/druid.blocker.html +++ b/docs/modules/druid.blocker.html @@ -237,7 +237,7 @@

Fields:

generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
diff --git a/docs/modules/druid.button.html b/docs/modules/druid.button.html index 0c807bf8..ed241860 100644 --- a/docs/modules/druid.button.html +++ b/docs/modules/druid.button.html @@ -99,11 +99,11 @@

Functions

Return button enabled state - set_click_zone(zone, Self) + set_click_zone(zone) Strict button click area. - set_key_trigger(key, Self) + set_key_trigger(key) Set key-code to trigger this button @@ -185,6 +185,12 @@

Parameters:

+

Returns:

+
    + + druid.button + Current button instance +
@@ -212,7 +218,7 @@

Returns:

- set_click_zone(zone, Self) + set_click_zone(zone)
Strict button click area. Useful for @@ -225,12 +231,14 @@

Parameters:

node Gui node -
  • Self - druid.button - instance to make chain calls -
  • +

    Returns:

    +
      + + druid.button + Current button instance +
    @@ -238,7 +246,7 @@

    Parameters:

    - set_key_trigger(key, Self) + set_key_trigger(key)
    Set key-code to trigger this button @@ -250,12 +258,14 @@

    Parameters:

    hash The action_id of the key -
  • Self - druid.button - instance to make chain calls -
  • +

    Returns:

    +
      + + druid.button + Current button instance +
    @@ -438,7 +448,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.checkbox.html b/docs/modules/druid.checkbox.html index 8d8c732a..5391bf0d 100644 --- a/docs/modules/druid.checkbox.html +++ b/docs/modules/druid.checkbox.html @@ -282,7 +282,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.checkbox_group.html b/docs/modules/druid.checkbox_group.html index bd03b403..eaf898f8 100644 --- a/docs/modules/druid.checkbox_group.html +++ b/docs/modules/druid.checkbox_group.html @@ -242,7 +242,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.drag.html b/docs/modules/druid.drag.html index 5cc02614..3ffc5333 100644 --- a/docs/modules/druid.drag.html +++ b/docs/modules/druid.drag.html @@ -282,7 +282,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.grid.html b/docs/modules/druid.grid.html index 730bc39d..9982cc34 100644 --- a/docs/modules/druid.grid.html +++ b/docs/modules/druid.grid.html @@ -374,7 +374,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.helper.html b/docs/modules/druid.helper.html index 64a239d5..fa7d7d73 100644 --- a/docs/modules/druid.helper.html +++ b/docs/modules/druid.helper.html @@ -298,7 +298,7 @@

    Returns:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.hover.html b/docs/modules/druid.hover.html index 25a72f96..bcf21b15 100644 --- a/docs/modules/druid.hover.html +++ b/docs/modules/druid.hover.html @@ -102,6 +102,14 @@

    Functions

    set_click_zone(zone) Strict hover click area. + + set_enabled(state) + Set enable state of hover component. + + + is_enabled() + Return current hover enabled state +

    Tables

    @@ -206,6 +214,49 @@

    Parameters:

    + +
    + + set_enabled(state) +
    +
    + Set enable state of hover component. + If hover is not enabled, it will not generate + any hover events + + +

    Parameters:

    +
      +
    • state + bool + The hover enabled state +
    • +
    + + + + + +
    +
    + + is_enabled() +
    +
    + Return current hover enabled state + + + +

    Returns:

    +
      + + bool + The hover enabled state +
    + + + +

    Tables

    @@ -243,7 +294,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.html b/docs/modules/druid.html index ac40eb79..b3a108b3 100644 --- a/docs/modules/druid.html +++ b/docs/modules/druid.html @@ -329,7 +329,7 @@

    Parameters:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.input.html b/docs/modules/druid.input.html index d5a09528..37d842ce 100644 --- a/docs/modules/druid.input.html +++ b/docs/modules/druid.input.html @@ -194,7 +194,7 @@

    Returns:

      druid.input - Self instance to make chain calls + Current input instance
    @@ -223,7 +223,7 @@

    Returns:

      druid.input - Self instance to make chain calls + Current input instance
    @@ -388,7 +388,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.lang_text.html b/docs/modules/druid.lang_text.html index 84c93349..2edcdb48 100644 --- a/docs/modules/druid.lang_text.html +++ b/docs/modules/druid.lang_text.html @@ -243,7 +243,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.progress.html b/docs/modules/druid.progress.html index ec3270b3..2641e708 100644 --- a/docs/modules/druid.progress.html +++ b/docs/modules/druid.progress.html @@ -386,7 +386,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.radio_group.html b/docs/modules/druid.radio_group.html index f87e4ad8..7f4fab6c 100644 --- a/docs/modules/druid.radio_group.html +++ b/docs/modules/druid.radio_group.html @@ -242,7 +242,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.scroll.html b/docs/modules/druid.scroll.html index da5ff6eb..f9e27992 100644 --- a/docs/modules/druid.scroll.html +++ b/docs/modules/druid.scroll.html @@ -122,7 +122,7 @@

    Functions

    - + @@ -311,7 +311,7 @@

    Returns:

      druid.scroll - Self instance + Current scroll instance
    @@ -340,7 +340,7 @@

    Returns:

      druid.scroll - Self instance + Current scroll instance
    @@ -368,8 +368,8 @@

    Returns:

    - - set_extra_strech_size([stretch_size=0]) + + set_extra_stretch_size([stretch_size=0])
    Set extra size for scroll stretching. @@ -389,7 +389,7 @@

    Returns:

      druid.scroll - Self instance + Current scroll instance
    @@ -437,7 +437,7 @@

    Returns:

      druid.scroll - Self instance + Current scroll instance
    @@ -586,7 +586,7 @@

    Fields:

    Scroll gui.animation speed for scroll_to function (default 0.2) -
  • EXTRA_STRECH_SIZE +
  • EXTRA_STRETCH_SIZE number extra size in pixels outside of scroll (stretch effect) (default 0) @@ -610,7 +610,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.slider.html b/docs/modules/druid.slider.html index 1303128a..c9521914 100644 --- a/docs/modules/druid.slider.html +++ b/docs/modules/druid.slider.html @@ -281,7 +281,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.swipe.html b/docs/modules/druid.swipe.html index 60464fd1..339ae625 100644 --- a/docs/modules/druid.swipe.html +++ b/docs/modules/druid.swipe.html @@ -256,7 +256,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.text.html b/docs/modules/druid.text.html index b75b29bf..e3fbea82 100644 --- a/docs/modules/druid.text.html +++ b/docs/modules/druid.text.html @@ -407,7 +407,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid.timer.html b/docs/modules/druid.timer.html index 517ff766..3c2675af 100644 --- a/docs/modules/druid.timer.html +++ b/docs/modules/druid.timer.html @@ -296,7 +296,7 @@

    Fields:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid_event.html b/docs/modules/druid_event.html index 261e2608..3e03611d 100644 --- a/docs/modules/druid_event.html +++ b/docs/modules/druid_event.html @@ -242,7 +242,7 @@

    Parameters:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/modules/druid_instance.html b/docs/modules/druid_instance.html index c0f164b5..4a0ae8cd 100644 --- a/docs/modules/druid_instance.html +++ b/docs/modules/druid_instance.html @@ -913,7 +913,7 @@

    Returns:

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/topics/01-components.md.html b/docs/topics/01-components.md.html index 21478e47..29a51b86 100644 --- a/docs/topics/01-components.md.html +++ b/docs/topics/01-components.md.html @@ -129,7 +129,8 @@

    Notes

    - **on_double_click** - different callback, if tap button 2+ in row, don't trigger if callback is empty -

    - If button have double click event and it is triggered, usual callback will be not invoked +

    - Click event will not trigger, if between pressed and released state cursor was outside of node zone +- If button have double click event and it is triggered, usual callback will be not invoked - If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use button:set_click_zone to restrict button click zone - Button can have key trigger to use then by key: button:set_key_trigger - Animation node can be used for example to animate small icon on big panel. Node name of trigger zone will be big panel and animation node will be small icon

    @@ -239,7 +240,7 @@

    Notes

    - 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 adjust extra stretch size via scroll:set_extra_stretch_size +- 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

    @@ -386,7 +387,8 @@

    Setup

    Notes

    - By default, hover handles hover event with pressed touch action_id. So it's mean, what mouse or touch have to be pressed -- On desktop platforms there is onmousehover event. It's event on mouse hover without any action id

    +- On desktop platforms there is onmousehover event. It's event on mouse hover without any action id +- By default, assume what node is on not hovered state (both hover and mousehover_)

    @@ -463,7 +465,7 @@

    Notes

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/topics/02-creating_custom_components.md.html b/docs/topics/02-creating_custom_components.md.html index 086bc4f8..5938201a 100644 --- a/docs/topics/02-creating_custom_components.md.html +++ b/docs/topics/02-creating_custom_components.md.html @@ -121,8 +121,8 @@

    Custom components

    function M.on_message(self, message_id, message, sender) end --- Call only if component with ON_LANGUAGE_CHANGE interest -function M.on_language_change(self) +-- Call only if component with ON_ANGUAGECHANinterest +function M.on_anguagechanself) end -- Call only if component with ON_LAYOUT_CHANGE interest @@ -245,7 +245,7 @@

    Power of using templates

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/topics/03-styles.md.html b/docs/topics/03-styles.md.html index b51a6c6c..a1da4837 100644 --- a/docs/topics/03-styles.md.html +++ b/docs/topics/03-styles.md.html @@ -155,7 +155,7 @@

    Create your own styles

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/topics/04-druid_assets.md.html b/docs/topics/04-druid_assets.md.html index 8df0a707..1272c797 100644 --- a/docs/topics/04-druid_assets.md.html +++ b/docs/topics/04-druid_assets.md.html @@ -92,7 +92,7 @@

    Overview

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/topics/05-examples.md.html b/docs/topics/05-examples.md.html index c1243144..b7b7f5e5 100644 --- a/docs/topics/05-examples.md.html +++ b/docs/topics/05-examples.md.html @@ -90,7 +90,7 @@

    Overview

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 07dcf244..b0e86779 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -90,7 +90,7 @@

    Modules

    GitHub release (latest by date)

    -

    Druid - powerful defold component UI library. Use basic Druid components or make your own game-specific components to make amazing GUI in your games.

    +

    Druid - powerful Defold component UI library. Use basic Druid components or make your own game-specific components to make amazing GUI in your games.

    @@ -271,13 +271,13 @@

    Druid lifecycle

      +
    • final required function for correct druid lifecycle
    • *on_input* used for almost all basic druid components
    • update used for progress bar, scroll and timer base components
    • *on_message* used for specific druid events, like language change or layout change
    • -
    • final used for custom components, what have to do several action before destroy
    -

    Recommended is fully integrate al druid lifecycles functions

    +

    Recommended is fully integrate all druid lifecycles functions

    @@ -286,6 +286,7 @@

    Features

    • Druid input goes as stack. Last created button will checked first. So create your GUI from back
    • Don't forget about return in on_input: return self.druid:on_input(). It need, if you have more than 1 acquire inputs (several druid, other input system, etc)
    • +
    • Druid by default do acquireinputfocus. So you don't need do it manually. Buy only if you have components, which requires oninput_
    @@ -339,7 +340,7 @@

    Issues and suggestions

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs/topics/changelog.md.html b/docs/topics/changelog.md.html index 4fe82e0d..762b41ea 100644 --- a/docs/topics/changelog.md.html +++ b/docs/topics/changelog.md.html @@ -72,8 +72,7 @@

    Modules

    - -

    Druid 0.3.0:

    + Druid 0.3.0:

    • Druid:final() now is important function for correct working

    • @@ -133,11 +132,11 @@

      Modules

      - on_drag_start (self) - on_drag (self, dx, dy) - on_drag_end (self) -- You can restriction side of draggin by changing _drag.can_x_ and _drag.can_y_ fields -- You can setup drag deadzone to detect, when dragging is started (by default 10 pixels) +- You can restriction side of dragging by changing _drag.can_x_ and _drag.can_y_ fields +- You can setup drag deadzone to detect, when dragging is started (_by default 10 pixels_) -
    • Druid Scroll component fully reworked. Input logic moved to Drag component

      +
    • [Breaking changes] Druid Scroll component fully reworked. Input logic moved to Drag component

       - Update scroll documentation
      @@ -151,7 +150,7 @@ 

      Modules

      - Different anchoring is supported (for easier layouting) - Function _scroll_to_ now accept position relative to _content node_. It's more easier for handling. _Example:_ if you have children node of _content_node_, you can pass this node position to scroll to this. - **Resolve #52**: _Content node size_ now can be less than _view node size_. In this case, content will be scrolled only inside _view size_ (can be disabled via style field: _SMALL_CONTENT_SCROLL_) -- **Fix #50**: If style:SOFT_ZONE_SIZE equals to [0..1], scroll can be disappeared +- **Fix #50**: If style.SOFT_ZONE_SIZE equals to [0..1], scroll can be disappeared
    • Druid Grid Update

      @@ -172,9 +171,9 @@

      Modules

       - Styles table now can be empty, every component have their default style values
      -- Remove component:get_style function. Now style can be only set
      +- Remove component:get_style function. Now you can only set styles
       - To get style values in component, add component:on_style_change function. It's invoked on component:set_style function
      -- You can look up default values inside component:on_style_change function or style component API on Druid API
      +- You can look up default values inside component:on_style_change function or style component API on [Druid API](https://insality.github.io/druid/index.html)
       
    • Druid update:

      @@ -183,17 +182,24 @@

      Modules

      - Now function druid:remove remove instance and all instance children components. No more manual deleting child components (#41)
    • -
    • Fix: Blocker component bug (blocker had very high priority, so it's block even button components, created after bloker)

    • +
    • Fix: Blocker component bug (blocker had very high priority, so it's block even button components, created after blocker)

    • Fix #58: Bug, when druid instance should be always named druid (ex: self.druid = druid.new(self))

    • Fix #53: Bug with final Druid instance without any components

    +

    Druid 0.5.0: +- Fix #61: Button component: fix button animation node creation +- Fix #64: Hover component: wrong mouse_hover default state +- Fix #71: Blocker: blocker now correct block mouse hover event +- Fix #72: Fix return nil in some on_input functions +- Fix #74: Fix typo: strech -> stretch. Scroll function set_extra_stretch_size renamed +

    generated by LDoc 1.4.6 -Last updated 2020-05-09 16:07:15 +Last updated 2020-06-14 20:13:02
    diff --git a/docs_md/01-components.md b/docs_md/01-components.md index e24a1826..39e1087c 100644 --- a/docs_md/01-components.md +++ b/docs_md/01-components.md @@ -25,6 +25,7 @@ Where node name is name of node from GUI scene. You can use `node_name` as input - **on_long_click** - callback on long button tap, don't trigger if callback is empty - **on_hold_click** - hold callback, before long_click trigger, don't trigger if callback is empty - **on_double_click** - different callback, if tap button 2+ in row, don't trigger if callback is empty +- Click event will not trigger, if between pressed and released state cursor was outside of node zone - If button have double click event and it is triggered, usual callback will be not invoked - If you have stencil on buttons and you don't want trigger them outside of stencil node, you can use `button:set_click_zone` to restrict button click zone - Button can have key trigger to use then by key: `button:set_key_trigger` diff --git a/docs_md/02-creating_custom_components.md b/docs_md/02-creating_custom_components.md index b6ed5ed0..43c1cf7a 100644 --- a/docs_md/02-creating_custom_components.md +++ b/docs_md/02-creating_custom_components.md @@ -36,8 +36,8 @@ end function M.on_message(self, message_id, message, sender) end --- Call only if component with ON_LANGUAGE_CHANGE interest -function M.on_language_change(self) +-- Call only if component with ON_ANGUAGECHANinterest +function M.on_anguagechanself) end -- Call only if component with ON_LAYOUT_CHANGE interest diff --git a/docs_md/changelog.md b/docs_md/changelog.md index b78563de..10107001 100644 --- a/docs_md/changelog.md +++ b/docs_md/changelog.md @@ -96,3 +96,8 @@ Druid 0.4.0: Druid 0.5.0: - **Fix #61:** Button component: fix button animation node creation - **Fix #64:** Hover component: wrong mouse_hover default state +- **Fix #71:** Blocker: blocker now correct block mouse hover event +- **Fix #72:** Fix `return nil` in some `on_input` functions +- **Fix #74:** Fix typo: strech -> stretch. Scroll function `set_extra_stretch_size` renamed +- Add `component.tempalte.lua` as template for Druid custom component + From 80ad0dc3b512b77c5de65466c7262687f476118c Mon Sep 17 00:00:00 2001 From: Insality Date: Sun, 14 Jun 2020 20:14:49 +0300 Subject: [PATCH 12/12] Increase Druid version --- game.project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game.project b/game.project index 055a75d7..8445598a 100644 --- a/game.project +++ b/game.project @@ -10,7 +10,7 @@ height = 900 [project] title = druid -version = 0.4.0 +version = 0.4.3 [library] include_dirs = druid
  • Return if scroll have inertion.
    set_extra_strech_size([stretch_size=0])set_extra_stretch_size([stretch_size=0]) Set extra size for scroll stretching.