Little code refactor, update changelog

This commit is contained in:
Insality 2021-04-02 10:07:22 +03:00
parent 12dcdd970b
commit 0472e5d6db
4 changed files with 8 additions and 10 deletions

View File

@ -136,17 +136,17 @@ Also check _component.template.lua_ what you can use for your own custom compone
Desc
- Input component: rename field _selected_ to _is_selected_ (according to the docs)
- Add EmmyLua annotations. See how to use it FAQ
- Lang text now can be initialized without default locale id
- **Fix**: Input component: rename field _selected_ to _is_selected_ (according to the docs)
- **#92** Setup repo for CI and unit tests. (Yea, successful build and tests badges!)
- **#102** __[BREAKING]__ Removed `component:increase_input_priority` component function. Use `component:set_input_priority` function instead. The bigger priority value processed first. The value 10 is default for Druid components, the 100 value is maximum priority for acquire input in _drag_ and _input_ components
- **#103** Add `helper.centate_nodes` function. It can horizontal align several Box and Text nodes
- **#105** Add `Input:select` and `Input:unselect` function.
- **#106** Add `Input IS_UNSELECT_ON_RESELECT` style param. If true, it will be unselect input on click on input box, not only on outside click.
- **#108** Add component interests const to `component.lua`
- **#116** You can pass Text component in Input component instead of text node
- **#124** Add `Scroll:set_click_zone` function. This is just link to `Drag:set_click_zone` function inside scroll component.
- **#102** __[BREAKING]__ Removed `component:increase_input_priority` component function. Use `component:set_input_priority` function instead. The bigger priority value processed first. The value 10 is default for Druid components, the 100 value is maximum priority for acquire input in _drag_ and _input_ components
-- Add constants for priorities: _const.PRIORITY_INPUT_, _const.PRIORITY_INPUT_HIGH_, _const.PRIORITY_INPUT_MAX_.
-- __[BREAKING]__ If you use in you custom components interest: `component.ON_INPUT_HIGH` you should replace it with `const.PRIORITY_INPUT_HIGH` as third param, and place it with usual `component.ON_INPUT`. For example:
_before:_

View File

@ -27,8 +27,8 @@ function Hover.init(self, node, on_hover_callback)
self._is_hovered = false
self._is_mouse_hovered = false
self._is_enabled = true
self._is_mobile = helper.is_mobile()
self.on_hover = Event(on_hover_callback)
self.on_mouse_hover = Event()
@ -41,7 +41,7 @@ function Hover.on_input(self, action_id, action)
end
-- Disable nil (it's mouse) hover or mobile platforms
if not action_id and helper.is_mobile() then
if self._is_mobile and not action_id then
return false
end

View File

@ -5,8 +5,6 @@ local const = require("druid.const")
local M = {}
local system_name = sys.get_sys_info().system_name
--- Text node or icon node can be nil
local function get_text_width(text_node)
if text_node then
@ -183,7 +181,8 @@ end
--- Check if device is mobile (Android or iOS)
-- @function helper..is_mobile
function M.is_mobile()
return const.CURRENT_SYSTEM_NAME == const.OS.IOS or const.CURRENT_SYSTEM_NAME == const.OS.ANDROID
return const.CURRENT_SYSTEM_NAME == const.OS.IOS or
const.CURRENT_SYSTEM_NAME == const.OS.ANDROID
end

View File

@ -65,9 +65,8 @@ M["scroll"] = {
INERT_SPEED = 30, -- koef. of inert speed
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,
WHEEL_SCROLL_SPEED = 20,
WHEEL_SCROLL_INVERTED = false,
SMALL_CONTENT_SCROLL = true, -- If true, content node with size less than view node size can be scrolled
}