mirror of
https://github.com/Insality/druid
synced 2025-06-27 18:37:45 +02:00
Merge branch 'develop' into 117-update-examples
This commit is contained in:
commit
995b16ad37
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
[](https://insality.github.io/druid/)
|
[](https://insality.github.io/druid/)
|
||||||
|
|
||||||
[](https://github.com/Insality/druid/releases)
|
[](https://github.com/Insality/druid/releases)
|
||||||
@ -244,8 +243,6 @@ _You published your game and you using Druid? Note me!_
|
|||||||
- Original idea by [AGulev](https://github.com/AGulev)
|
- Original idea by [AGulev](https://github.com/AGulev)
|
||||||
- Assets from [Kenney](http://www.kenney.nl/)
|
- Assets from [Kenney](http://www.kenney.nl/)
|
||||||
|
|
||||||
**MIT** License
|
|
||||||
|
|
||||||
|
|
||||||
## Issues and suggestions
|
## Issues and suggestions
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ Every component is the children of Basic Druid component. Read the [basic compon
|
|||||||
|
|
||||||
Basic custom component template looks like this:
|
Basic custom component template looks like this:
|
||||||
```lua
|
```lua
|
||||||
local const = require("druid.const")
|
|
||||||
local component = require("druid.component")
|
local component = require("druid.component")
|
||||||
|
|
||||||
local M = component.create("my_component")
|
local M = component.create("my_component")
|
||||||
@ -20,11 +19,11 @@ local M = component.create("my_component")
|
|||||||
function M.init(self, ...)
|
function M.init(self, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Call only if exist interest: const.ON_UPDATE
|
-- Call only if exist interest: component.ON_UPDATE
|
||||||
function M.update(self, dt)
|
function M.update(self, dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Call only if exist interest: const.ON_INPUT or const.ON_INPUT_HIGH
|
-- Call only if exist interest: component.ON_INPUT or component.ON_INPUT_HIGH
|
||||||
function M.on_input(self, action_id, action)
|
function M.on_input(self, action_id, action)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -32,7 +31,7 @@ end
|
|||||||
function M.on_style_change(self, style)
|
function M.on_style_change(self, style)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Call only if exist interest: const.ON_MESSAGE
|
-- Call only if exist interest: component.ON_MESSAGE
|
||||||
function M.on_message(self, message_id, message, sender)
|
function M.on_message(self, message_id, message, sender)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -136,16 +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`
|
||||||
- **#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:_
|
||||||
@ -168,5 +169,6 @@ Desc
|
|||||||
- __[BREAKING]__ Add _SHIFT_POLICY_ for _Static_ and _Dynamic_ Grids. It mean how nodes will be shifted if you append data between nodes. There are `const.SHIFT.RIGHT`, `const.SHIFT.LEFT` and `const.SHIFT.NO_SHIFT`.
|
- __[BREAKING]__ Add _SHIFT_POLICY_ for _Static_ and _Dynamic_ Grids. It mean how nodes will be shifted if you append data between nodes. There are `const.SHIFT.RIGHT`, `const.SHIFT.LEFT` and `const.SHIFT.NO_SHIFT`.
|
||||||
-- Please check your `StaticGrid:remove` and `DynamicGrid:remove` functions
|
-- Please check your `StaticGrid:remove` and `DynamicGrid:remove` functions
|
||||||
- **Fix #86** A lot of event triggers on scroll inertia moving
|
- **Fix #86** A lot of event triggers on scroll inertia moving
|
||||||
|
- **Fix #101** Fix scroll to other node instead of swipe direction with scroll's points of intereset (without inert settings)
|
||||||
- **Fix #118** Druid.scroll freezes if held in one place for a long time
|
- **Fix #118** Druid.scroll freezes if held in one place for a long time
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -544,7 +544,7 @@ function Scroll._check_points(self)
|
|||||||
local inert = self.inertion
|
local inert = self.inertion
|
||||||
if not self._is_inert then
|
if not self._is_inert then
|
||||||
if math.abs(inert.x) > self.style.POINTS_DEADZONE then
|
if math.abs(inert.x) > self.style.POINTS_DEADZONE then
|
||||||
self:scroll_to_index(self.selected - helper.sign(inert.x))
|
self:scroll_to_index(self.selected + helper.sign(inert.x))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if math.abs(inert.y) > self.style.POINTS_DEADZONE then
|
if math.abs(inert.y) > self.style.POINTS_DEADZONE then
|
||||||
|
@ -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