diff --git a/druid/component.lua b/druid/component.lua index 02d351a..6f09892 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -218,17 +218,22 @@ end --- Set component input priority -- @tparam BaseComponent self @{BaseComponent} -- @tparam number value The new input priority value +-- @tparam boolean is_temporary If true, the reset input priority will return to previous value -- @treturn number The component input priority -function BaseComponent.set_input_priority(self, value) +function BaseComponent.set_input_priority(self, value, is_temporary) assert(value) if self._component.input_priority ~= value then self._component.input_priority = value self._component._is_input_priority_changed = true + if not is_temporary then + self._component.default_input_priority = value + end + local children = self:get_childrens() for i = 1, #children do - children[i]:set_input_priority(value) + children[i]:set_input_priority(value, is_temporary) end end diff --git a/druid/extended/input.lua b/druid/extended/input.lua index d463871..36da224 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -281,8 +281,8 @@ function Input.select(self) gui.reset_keyboard() self.marked_value = "" if not self.is_selected then - self:set_input_priority(const.PRIORITY_INPUT_MAX) - self.button:set_input_priority(const.PRIORITY_INPUT_MAX) + self:set_input_priority(const.PRIORITY_INPUT_MAX, true) + self.button:set_input_priority(const.PRIORITY_INPUT_MAX, true) self.previous_value = self.value self.is_selected = true