diff --git a/docs/index.html b/docs/index.html index 12e78fc..b5f8636 100644 --- a/docs/index.html +++ b/docs/index.html @@ -185,7 +185,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
diff --git a/docs/modules/component.html b/docs/modules/component.html index 2a20847..9c39094 100644 --- a/docs/modules/component.html +++ b/docs/modules/component.html @@ -117,6 +117,10 @@ Get current component interests + get_node(node_or_name) + Get node for component by name. + + get_druid() Return druid with context of calling component. @@ -320,6 +324,36 @@ + +
+ + get_node(node_or_name) +
+
+ Get node for component by name. + If component has nodes, nodeorname should be string + It auto pick node by template name or from nodes by clonetree + if they was setup via component:setnodes, component:set_template + + +

Parameters:

+ + +

Returns:

+
    + + node + Gui node +
+ + + +
@@ -406,7 +440,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
diff --git a/docs/modules/druid.back_handler.html b/docs/modules/druid.back_handler.html index e325a78..3cf72b7 100644 --- a/docs/modules/druid.back_handler.html +++ b/docs/modules/druid.back_handler.html @@ -215,7 +215,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
diff --git a/docs/modules/druid.blocker.html b/docs/modules/druid.blocker.html index 561ad3b..efd7755 100644 --- a/docs/modules/druid.blocker.html +++ b/docs/modules/druid.blocker.html @@ -234,7 +234,7 @@
generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
diff --git a/docs/modules/druid.button.html b/docs/modules/druid.button.html index bbdf5fe..b9379cb 100644 --- a/docs/modules/druid.button.html +++ b/docs/modules/druid.button.html @@ -305,6 +305,10 @@ druid_event On double tap button callback +
  • on_hold_callback + druid_event + On button hold before long_click callback +
  • @@ -331,7 +335,7 @@ Animation node (default node) -
  • scale_from +
  • start_scale vector3 Initial scale of anim_node
  • @@ -405,7 +409,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.checkbox.html b/docs/modules/druid.checkbox.html index e342bba..a410199 100644 --- a/docs/modules/druid.checkbox.html +++ b/docs/modules/druid.checkbox.html @@ -277,7 +277,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.checkbox_group.html b/docs/modules/druid.checkbox_group.html index 2141614..197d339 100644 --- a/docs/modules/druid.checkbox_group.html +++ b/docs/modules/druid.checkbox_group.html @@ -239,7 +239,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.grid.html b/docs/modules/druid.grid.html index 6e08671..e390359 100644 --- a/docs/modules/druid.grid.html +++ b/docs/modules/druid.grid.html @@ -370,7 +370,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.helper.html b/docs/modules/druid.helper.html index d51cedf..137f7bb 100644 --- a/docs/modules/druid.helper.html +++ b/docs/modules/druid.helper.html @@ -236,7 +236,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.hover.html b/docs/modules/druid.hover.html index 7f092f2..771d8ff 100644 --- a/docs/modules/druid.hover.html +++ b/docs/modules/druid.hover.html @@ -211,7 +211,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.html b/docs/modules/druid.html index 890513e..5f52033 100644 --- a/docs/modules/druid.html +++ b/docs/modules/druid.html @@ -181,7 +181,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.input.html b/docs/modules/druid.input.html index eeed464..d5678b3 100644 --- a/docs/modules/druid.input.html +++ b/docs/modules/druid.input.html @@ -86,7 +86,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.lang_text.html b/docs/modules/druid.lang_text.html index 052acc8..ddcef2f 100644 --- a/docs/modules/druid.lang_text.html +++ b/docs/modules/druid.lang_text.html @@ -240,7 +240,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.progress.html b/docs/modules/druid.progress.html index 26fa713..b614a40 100644 --- a/docs/modules/druid.progress.html +++ b/docs/modules/druid.progress.html @@ -378,7 +378,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.radio_group.html b/docs/modules/druid.radio_group.html index 0391222..df89283 100644 --- a/docs/modules/druid.radio_group.html +++ b/docs/modules/druid.radio_group.html @@ -239,7 +239,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.scroll.html b/docs/modules/druid.scroll.html index 8d3c393..be05f0c 100644 --- a/docs/modules/druid.scroll.html +++ b/docs/modules/druid.scroll.html @@ -507,7 +507,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.slider.html b/docs/modules/druid.slider.html index 49068a6..dceaa2f 100644 --- a/docs/modules/druid.slider.html +++ b/docs/modules/druid.slider.html @@ -278,7 +278,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.text.html b/docs/modules/druid.text.html index b74e503..6889bab 100644 --- a/docs/modules/druid.text.html +++ b/docs/modules/druid.text.html @@ -352,7 +352,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid.timer.html b/docs/modules/druid.timer.html index f76d4c3..1116615 100644 --- a/docs/modules/druid.timer.html +++ b/docs/modules/druid.timer.html @@ -267,31 +267,17 @@ node Trigger node -
  • anim_node - node - Animation node - (default node) +
  • from + number + Initial timer value
  • -
  • scale_from - vector3 - Initial scale of anim_node +
  • target + number + Target timer value
  • -
  • pos - vector3 - Initial pos of anim_node -
  • -
  • params - any - Params to click callbacks -
  • -
  • hover - druid.hover - Druid hover logic component -
  • -
  • click_zone - node - Restriction zone - (optional) +
  • value + number + Current timer value
  • @@ -307,7 +293,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid_event.html b/docs/modules/druid_event.html index 7850ea7..7773bc4 100644 --- a/docs/modules/druid_event.html +++ b/docs/modules/druid_event.html @@ -239,7 +239,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/modules/druid_instance.html b/docs/modules/druid_instance.html index 6d30ad0..b8a6f6b 100644 --- a/docs/modules/druid_instance.html +++ b/docs/modules/druid_instance.html @@ -750,7 +750,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/topics/01-components.md.html b/docs/topics/01-components.md.html index a0875e0..2e0a3ef 100644 --- a/docs/topics/01-components.md.html +++ b/docs/topics/01-components.md.html @@ -111,7 +111,7 @@ - **on_click** - basic button callback - **on_repeated_click** - repeated click callback, while holding the button, don't trigger if callback is empty - **on_long_click** - callback on long button tap, don't trigger if callback is empty -- **on_hold_click** - hold callback, before long_click trigger, don't trigger if callback is empty +- **on_hold_callback** - 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 @@ -210,7 +210,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/topics/02-creating_custom_components.md.html b/docs/topics/02-creating_custom_components.md.html index cd684e7..e33e05d 100644 --- a/docs/topics/02-creating_custom_components.md.html +++ b/docs/topics/02-creating_custom_components.md.html @@ -202,7 +202,7 @@ There is next interests in druid:
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/topics/03-styles.md.html b/docs/topics/03-styles.md.html index f6bafcd..613a57f 100644 --- a/docs/topics/03-styles.md.html +++ b/docs/topics/03-styles.md.html @@ -138,7 +138,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/topics/04-druid_assets.md.html b/docs/topics/04-druid_assets.md.html index cab9b23..74a30f5 100644 --- a/docs/topics/04-druid_assets.md.html +++ b/docs/topics/04-druid_assets.md.html @@ -89,7 +89,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/topics/05-examples.md.html b/docs/topics/05-examples.md.html index 671c7ff..aae01a8 100644 --- a/docs/topics/05-examples.md.html +++ b/docs/topics/05-examples.md.html @@ -87,7 +87,7 @@
    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/docs/topics/README.md.html b/docs/topics/README.md.html index 742f109..c1b6857 100644 --- a/docs/topics/README.md.html +++ b/docs/topics/README.md.html @@ -291,7 +291,7 @@ https://insality.github.io/druid/

    generated by LDoc 1.4.6 -Last updated 2020-03-22 15:19:02 +Last updated 2020-03-22 15:31:43
    diff --git a/druid/base/button.lua b/druid/base/button.lua index b42a3c9..89e916c 100644 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -13,7 +13,7 @@ -- @table Fields -- @tfield node node Trigger node -- @tfield[opt=node] node anim_node Animation node --- @tfield vector3 scale_from Initial scale of anim_node +-- @tfield vector3 start_scale Initial scale of anim_node -- @tfield vector3 pos Initial pos of anim_node -- @tfield any params Params to click callbacks -- @tfield druid.hover hover Druid hover logic component @@ -152,8 +152,7 @@ function M.init(self, node, callback, params, anim_node, event) self.node = self:get_node(node) self.anim_node = anim_node and helper:get_node(anim_node) or self.node - -- TODO: rename to start_scale - self.scale_from = gui.get_scale(self.anim_node) + self.start_scale = gui.get_scale(self.anim_node) self.params = params self.hover = self.druid:new_hover(node, on_button_hover) self.click_zone = nil diff --git a/druid/base/timer.lua b/druid/base/timer.lua index 712dc93..cbf02df 100644 --- a/druid/base/timer.lua +++ b/druid/base/timer.lua @@ -12,12 +12,9 @@ --- Component fields -- @table Fields -- @tfield node node Trigger node --- @tfield[opt=node] node anim_node Animation node --- @tfield vector3 scale_from Initial scale of anim_node --- @tfield vector3 pos Initial pos of anim_node --- @tfield any params Params to click callbacks --- @tfield druid.hover hover Druid hover logic component --- @tfield[opt] node click_zone Restriction zone +-- @tfield number from Initial timer value +-- @tfield number target Target timer value +-- @tfield number value Current timer value local Event = require("druid.event") local const = require("druid.const") diff --git a/druid/component.lua b/druid/component.lua index 1e8be3a..47486b4 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -86,10 +86,13 @@ function Component.get_interests(self) end --- TODO: Определиться с get_node и node --- get_node - берет ноду по ноде или строке --- node - может брать ноду у компонента по схеме (если есть --- template или таблица нод после gui.clone_tree) +--- Get node for component by name. +-- If component has nodes, node_or_name should be string +-- It auto pick node by template name or from nodes by clone_tree +-- if they was setup via component:set_nodes, component:set_template +-- @function component:get_node +-- @tparam string|node node_or_name Node name or node itself +-- @treturn node Gui node function Component.get_node(self, node_or_name) local template_name = self:get_template() or const.EMPTY_STRING local nodes = self:get_nodes() diff --git a/druid/druid.lua b/druid/druid.lua index 458b2c5..3fb795d 100644 --- a/druid/druid.lua +++ b/druid/druid.lua @@ -31,13 +31,10 @@ local M = {} -- @tparam table module lua table with component function M.register(name, module) -- TODO: Find better solution to creating elements? - -- Possibly: druid.new(druid.BUTTON, etc?) -- Current way is very implicit druid_instance["new_" .. name] = function(self, ...) return druid_instance.create(self, module, ...) end - - -- print("Register component", name) end diff --git a/druid/styles/default/anims.lua b/druid/styles/default/anims.lua index ae56a40..d2d3d69 100644 --- a/druid/styles/default/anims.lua +++ b/druid/styles/default/anims.lua @@ -24,7 +24,7 @@ end function M.tap_scale_animation(self, node, target_scale) scale_to(self, node, target_scale, function() - M.back_scale_animation(self, node, self.scale_from) + M.back_scale_animation(self, node, self.start_scale) end ) end diff --git a/druid/styles/default/style.lua b/druid/styles/default/style.lua index f34558f..5e3e05b 100644 --- a/druid/styles/default/style.lua +++ b/druid/styles/default/style.lua @@ -18,14 +18,14 @@ M["button"] = { IS_HOVER = true, on_hover = function(self, node, state) - local scale_to = self.scale_from + M.button.HOVER_SCALE + local scale_to = self.start_scale + M.button.HOVER_SCALE - local target_scale = state and scale_to or self.scale_from + local target_scale = state and scale_to or self.start_scale anims.hover_scale(self, target_scale, M.button.HOVER_TIME) end, on_click = function(self, node) - local scale_to = self.scale_from + M.button.SCALE_CHANGE + local scale_to = self.start_scale + M.button.SCALE_CHANGE anims.tap_scale_animation(self, node, scale_to) settings.play_sound(M.button.BTN_SOUND) end,