mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
Little code refactor, update changelog
This commit is contained in:
parent
12dcdd970b
commit
0472e5d6db
@ -136,17 +136,17 @@ Also check _component.template.lua_ what you can use for your own custom compone
|
|||||||
|
|
||||||
Desc
|
Desc
|
||||||
|
|
||||||
- Input component: rename field _selected_ to _is_selected_ (according to the docs)
|
|
||||||
- Add EmmyLua annotations. See how to use it FAQ
|
- Add EmmyLua annotations. See how to use it FAQ
|
||||||
- Lang text now can be initialized without default locale id
|
- 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!)
|
- **#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
|
- **#103** Add `helper.centate_nodes` function. It can horizontal align several Box and Text nodes
|
||||||
- **#105** Add `Input:select` and `Input:unselect` function.
|
- **#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.
|
- **#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`
|
- **#108** Add component interests const to `component.lua`
|
||||||
- **#116** You can pass Text component in Input component instead of text node
|
- **#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.
|
- **#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_.
|
-- 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:
|
-- __[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:_
|
_before:_
|
||||||
|
@ -27,8 +27,8 @@ function Hover.init(self, node, on_hover_callback)
|
|||||||
|
|
||||||
self._is_hovered = false
|
self._is_hovered = false
|
||||||
self._is_mouse_hovered = false
|
self._is_mouse_hovered = false
|
||||||
|
|
||||||
self._is_enabled = true
|
self._is_enabled = true
|
||||||
|
self._is_mobile = helper.is_mobile()
|
||||||
|
|
||||||
self.on_hover = Event(on_hover_callback)
|
self.on_hover = Event(on_hover_callback)
|
||||||
self.on_mouse_hover = Event()
|
self.on_mouse_hover = Event()
|
||||||
@ -41,7 +41,7 @@ function Hover.on_input(self, action_id, action)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Disable nil (it's mouse) hover or mobile platforms
|
-- 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
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@ local const = require("druid.const")
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local system_name = sys.get_sys_info().system_name
|
|
||||||
|
|
||||||
--- Text node or icon node can be nil
|
--- Text node or icon node can be nil
|
||||||
local function get_text_width(text_node)
|
local function get_text_width(text_node)
|
||||||
if text_node then
|
if text_node then
|
||||||
@ -183,7 +181,8 @@ end
|
|||||||
--- Check if device is mobile (Android or iOS)
|
--- Check if device is mobile (Android or iOS)
|
||||||
-- @function helper..is_mobile
|
-- @function helper..is_mobile
|
||||||
function M.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
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,9 +65,8 @@ M["scroll"] = {
|
|||||||
INERT_SPEED = 30, -- koef. of inert speed
|
INERT_SPEED = 30, -- koef. of inert speed
|
||||||
EXTRA_STRETCH_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
|
POINTS_DEADZONE = 20, -- Speed to check points of interests in no_inertion mode
|
||||||
|
WHEEL_SCROLL_SPEED = 20,
|
||||||
SCROLL_WHEEL_SPEED = 20,
|
WHEEL_SCROLL_INVERTED = false,
|
||||||
|
|
||||||
SMALL_CONTENT_SCROLL = true, -- If true, content node with size less than view node size can be scrolled
|
SMALL_CONTENT_SCROLL = true, -- If true, content node with size less than view node size can be scrolled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user