Correct events and changelog

This commit is contained in:
Insality 2020-04-18 14:17:25 +03:00
parent 67038b5c77
commit 866e8727fc
2 changed files with 22 additions and 13 deletions

View File

@ -1,19 +1,20 @@
Druid 0.3.0: Druid 0.3.0:
- Druid:final now is important function for correct working - `Druid:final` now is important function for correct working
- Add swipe basic component - Add _swipe_ basic component
- Swipe component handle simple swipe gestures on node. It has single callback with direction on swipe. You can adjust a several parameters of swipe in druid style. - Swipe component handle simple swipe gestures on node. It has single callback with direction on swipe. You can adjust a several parameters of swipe in druid style.
- Swipe can be triggered on action.released or while user is make swiping (in process)
- Add swipe example at main Druid example. Try swipe left/right to switch example pages. - Add swipe example at main Druid example. Try swipe left/right to switch example pages.
- Add input basic component - Add _input_ basic component
- Input component handle user text input. Input contains from button and text component. Button needed for selecting input field - Input component handle user text input. Input contains from button and text components. Button needed for selecting/unselecting input field
- Long click on input field for clear and select input field - Long click on input field for clear and select input field (clearing can be disable via styles)
- Click outside of button to unselect input field - Click outside of button to unselect input field
- On focus lost (game minimized) input field will be unselected - On focus lost (game minimized) input field will be unselected
- You can setup max length of the text - You can setup max length of the text
- You can setup allowed characters. On add not allowed characters `on_input_wrong` will be called. By default it cause simple shake animation - You can setup allowed characters. On add not allowed characters `on_input_wrong` will be called. By default it cause simple shake animation
- The keyboard for input will not show on mobile HTML5 - The keyboard for input will not show on mobile HTML5. So input field in mobile HTML5 is not working now
- To make work different keyboard type, make sure value in game.project Android:InputMethod set to HidderInputField (https://defold.com/manuals/project-settings/#input-method) - To make work different keyboard type, make sure value in game.project Android:InputMethod set to HidderInputField (https://defold.com/manuals/project-settings/#input-method)
- Add button on_click_outside event. You can subscribe on this event in button. Was needed for Input component (click outside to deselect input field). - Add button on_click_outside event. You can subscribe on this event in button. Was needed for Input component (click outside to deselect input field).
@ -21,11 +22,19 @@ Druid 0.3.0:
- Changed input binding settings. Add backspace, enter, text and marked_text. Backspace now is different from android back button. - Changed input binding settings. Add backspace, enter, text and marked_text. Backspace now is different from android back button.
- Changed component interest: Renamed on_change_language -> on_language_change - Renamed on_change_language -> on_language_change component interest
- Add two new component interests: on_focus_gain and on_focus_lost
- Add basic component two functions: `increase_input_priority` and `reset_input_priority`. It used to process component input first in current input stack (there is two input stacks: INPUT and INPUT_HIGH). Example: on selecting input field, it increase input self priority until it be unselected
- Add two new component interests: `on_focus_gain` and `on_focus_lost`
- Add global druid events: - Add global druid events:
- on_window_callback: call `druid.on_window_callback(event)` for on_focus_gain/lost correct work - on_window_callback: call `druid.on_window_callback(event)` for on_focus_gain/lost correct work
- on_language_change: call `druid.on_language_change()` for update all druid instances lang components - on_language_change: call `druid.on_language_change()` (#38) for update all druid instances lang components
- on_layout_change: call `druid.on_layout_change()` for update all gui layouts (unsupported now) - on_layout_change: call `druid.on_layout_change()` (#37) for update all gui layouts (unimplemented now)
- Add several examples to druid-assets respository - Add several examples to druid-assets respository
- Known issues:
- Adjusting text size by height works wrong. Adjusting single line texting works fine

View File

@ -211,14 +211,14 @@ function M.set_text(self, input_text)
local marked_value = masked_marked_value or self.marked_value local marked_value = masked_marked_value or self.marked_value
self.is_empty = #value == 0 and #marked_value == 0 self.is_empty = #value == 0 and #marked_value == 0
local final_text = value .. marked_value
self.text:set_to(final_text)
-- measure it -- measure it
self.text_width = self.text:get_text_width(value) self.text_width = self.text:get_text_width(value)
self.marked_text_width = self.text:get_text_width(marked_value) self.marked_text_width = self.text:get_text_width(marked_value)
self.total_width = self.text_width + self.marked_text_width self.total_width = self.text_width + self.marked_text_width
local final_text = value .. marked_value
self.text:set_to(final_text)
self.on_input_text:trigger(self:get_context(), final_text) self.on_input_text:trigger(self:get_context(), final_text)
if #final_text == 0 then if #final_text == 0 then
self.on_input_empty:trigger(self:get_context(), final_text) self.on_input_empty:trigger(self:get_context(), final_text)