Skip to content

Commit

Permalink
Update #199 rename IS_CONSUME_INPUT_WHILE_SELECTED to NO_CONSUME_INPU…
Browse files Browse the repository at this point in the history
…T_WHILE_SELECTED. Change default value
  • Loading branch information
Insality committed Dec 1, 2022
1 parent 7f5be3f commit dad54d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions druid/extended/input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ end
-- @tfield[opt=false] bool IS_LONGTAP_ERASE Is long tap will erase current input data
-- @tfield[opt=*] string MASK_DEFAULT_CHAR Default character mask for password input
-- @tfield[opt=false] bool IS_UNSELECT_ON_RESELECT If true, call unselect on select selected input
-- @tfield[opt=false] bool IS_CONSUME_INPUT_WHILE_SELECTED If true, will consume input while input is selected. If false - it's allow to interact with other input component while selected
-- @tfield[opt=false] bool NO_CONSUME_INPUT_WHILE_SELECTED If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured)
-- @tfield function on_select (self, button_node) Callback on input field selecting
-- @tfield function on_unselect (self, button_node) Callback on input field unselecting
-- @tfield function on_input_wrong (self, button_node) Callback on wrong user input
Expand All @@ -98,7 +98,7 @@ function Input.on_style_change(self, style)
self.style.IS_LONGTAP_ERASE = style.IS_LONGTAP_ERASE or false
self.style.MASK_DEFAULT_CHAR = style.MASK_DEFAULT_CHAR or "*"
self.style.IS_UNSELECT_ON_RESELECT = style.IS_UNSELECT_ON_RESELECT or false
self.style.IS_CONSUME_INPUT_WHILE_SELECTED = style.IS_CONSUME_INPUT_WHILE_SELECTED or false
self.style.NO_CONSUME_INPUT_WHILE_SELECTED = style.NO_CONSUME_INPUT_WHILE_SELECTED or false

self.style.on_select = style.on_select or function(_, button_node) end
self.style.on_unselect = style.on_unselect or function(_, button_node) end
Expand Down Expand Up @@ -216,7 +216,7 @@ function Input.on_input(self, action_id, action)
end
end

local is_consume_input = self.style.IS_CONSUME_INPUT_WHILE_SELECTED and self.is_selected
local is_consume_input = not self.style.NO_CONSUME_INPUT_WHILE_SELECTED and self.is_selected
return is_consume_input
end

Expand Down
2 changes: 1 addition & 1 deletion druid/styles/default/style.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ M["input"] = {
BUTTON_SELECT_INCREASE = 1.06,
MASK_DEFAULT_CHAR = "*",
IS_UNSELECT_ON_RESELECT = false,
IS_CONSUME_INPUT_WHILE_SELECTED = true,
NO_CONSUME_INPUT_WHILE_SELECTED = false,

on_select = function(self, button_node)
local target_scale = self.button.start_scale
Expand Down

0 comments on commit dad54d8

Please sign in to comment.