mirror of
https://github.com/Insality/druid
synced 2025-06-27 10:27:48 +02:00
Remove debug log messages, update docs
This commit is contained in:
parent
e14f68bc90
commit
b22808f585
@ -1,6 +1,6 @@
|
|||||||
project='Druid'
|
project='Druid'
|
||||||
title='Defold Druid UI Library'
|
title='Defold Druid UI Framework'
|
||||||
description='Documentation for Druid Library'
|
description='Documentation for Druid Framework'
|
||||||
file={"./druid",
|
file={"./druid",
|
||||||
exclude = {
|
exclude = {
|
||||||
"./druid/styles/",
|
"./druid/styles/",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
-- Copyright (c) 2023 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
|
-- Copyright (c) 2023 Maksim Tuprikov <insality@gmail.com>. This code is licensed under MIT license
|
||||||
|
|
||||||
--- Component with event on back or backspace button.
|
--- Component with event on back and backspace button.
|
||||||
-- # Overview #
|
-- # Overview #
|
||||||
--
|
--
|
||||||
-- Back Handler is recommended to put in every game window to close it
|
-- Back Handler is recommended to put in every game window to close it
|
||||||
|
@ -457,7 +457,6 @@ function Scroll.bind_grid(self, grid)
|
|||||||
local size = grid:get_size()
|
local size = grid:get_size()
|
||||||
local offset = grid:get_offset()
|
local offset = grid:get_offset()
|
||||||
self:set_size(size, offset)
|
self:set_size(size, offset)
|
||||||
self:log_message("Change size from grid", { size = size, offset = offset })
|
|
||||||
end)
|
end)
|
||||||
self:set_size(grid:get_size(), grid:get_offset())
|
self:set_size(grid:get_size(), grid:get_offset())
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ local const = require("druid.const")
|
|||||||
local class = require("druid.system.middleclass")
|
local class = require("druid.system.middleclass")
|
||||||
local helper = require("druid.helper")
|
local helper = require("druid.helper")
|
||||||
|
|
||||||
|
|
||||||
local BaseComponent = class("druid.component")
|
local BaseComponent = class("druid.component")
|
||||||
|
|
||||||
local INTERESTS = {} -- Cache interests by component class in runtime
|
local INTERESTS = {} -- Cache interests by component class in runtime
|
||||||
|
@ -118,8 +118,6 @@ function DataList.add(self, data, index, shift_policy)
|
|||||||
helper.insert_with_shift(self._data, data, index, shift_policy)
|
helper.insert_with_shift(self._data, data, index, shift_policy)
|
||||||
self:_update_data_info()
|
self:_update_data_info()
|
||||||
self:_check_elements()
|
self:_check_elements()
|
||||||
|
|
||||||
self:log_message("Add element", { index = index })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -133,8 +131,6 @@ function DataList.remove(self, index, shift_policy)
|
|||||||
|
|
||||||
helper.remove_with_shift(self._data, index, shift_policy)
|
helper.remove_with_shift(self._data, index, shift_policy)
|
||||||
self:_update_data_info()
|
self:_update_data_info()
|
||||||
|
|
||||||
self:log_message("Remove element", { index = index })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -255,7 +251,6 @@ function DataList._add_at(self, index)
|
|||||||
component = instance
|
component = instance
|
||||||
}
|
}
|
||||||
|
|
||||||
self:log_message("Add element at", { index = index })
|
|
||||||
self.on_element_add:trigger(self:get_context(), index, node, instance)
|
self.on_element_add:trigger(self:get_context(), index, node, instance)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -276,7 +271,6 @@ function DataList._remove_at(self, index)
|
|||||||
end
|
end
|
||||||
self._data_visual[index] = nil
|
self._data_visual[index] = nil
|
||||||
|
|
||||||
self:log_message("Remove element at", { index = index })
|
|
||||||
self.on_element_remove:trigger(self:get_context(), index)
|
self.on_element_remove:trigger(self:get_context(), index)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -322,8 +316,6 @@ function DataList._check_elements(self)
|
|||||||
progress = 0
|
progress = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
self:log_message("Check elements", { top_index = self.top_index, last_index = self.last_index, progress = progress })
|
|
||||||
|
|
||||||
if self.scroll_progress ~= progress then
|
if self.scroll_progress ~= progress then
|
||||||
self.scroll_progress = progress
|
self.scroll_progress = progress
|
||||||
self.on_scroll_progress_change:trigger(self:get_context(), progress)
|
self.on_scroll_progress_change:trigger(self:get_context(), progress)
|
||||||
|
@ -5,6 +5,24 @@
|
|||||||
-- # Component List #
|
-- # Component List #
|
||||||
--
|
--
|
||||||
-- See all component list in "See Also" section.
|
-- See all component list in "See Also" section.
|
||||||
|
--
|
||||||
|
-- # Notes #
|
||||||
|
--
|
||||||
|
-- Take a look on the next API pages:
|
||||||
|
--
|
||||||
|
-- - @{Helper} - Useful pack of functions to work with GUI nodes like centrate nodes
|
||||||
|
--
|
||||||
|
-- - @{DruidEvent} - The core event system in Druid. See how to subscribe on any event
|
||||||
|
--
|
||||||
|
-- - @{BaseComponent} - the parent of all Druid components, you can see all default component methods there
|
||||||
|
--
|
||||||
|
-- Other things:
|
||||||
|
--
|
||||||
|
-- - To use Druid, first you should create a Druid instance to spawn components and add Druids main engine functions: update, final, on_message and on_input.
|
||||||
|
--
|
||||||
|
-- - All Druid components take node name string as arguments, don't do gui.get_node() before.
|
||||||
|
--
|
||||||
|
-- - All Druid and component methods are called with : like self.druid:new_button().
|
||||||
-- @usage
|
-- @usage
|
||||||
-- local druid = require("druid.druid")
|
-- local druid = require("druid.druid")
|
||||||
--
|
--
|
||||||
@ -75,32 +93,27 @@ local text = require("druid.base.text")
|
|||||||
-- local data_list = require("druid.extended.data_list")
|
-- local data_list = require("druid.extended.data_list")
|
||||||
-- local swipe = require("druid.extended.swipe")
|
-- local swipe = require("druid.extended.swipe")
|
||||||
|
|
||||||
|
|
||||||
local DruidInstance = class("druid.druid_instance")
|
local DruidInstance = class("druid.druid_instance")
|
||||||
|
|
||||||
local IS_NO_AUTO_INPUT = sys.get_config("druid.no_auto_input") == "1"
|
local IS_NO_AUTO_INPUT = sys.get_config_int("druid.no_auto_input", 0) == 1
|
||||||
|
|
||||||
local function input_init(self)
|
local function input_init(self)
|
||||||
if IS_NO_AUTO_INPUT then
|
if IS_NO_AUTO_INPUT or self.input_inited then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not self.input_inited then
|
self.input_inited = true
|
||||||
self.input_inited = true
|
druid_input.focus()
|
||||||
druid_input.focus()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function input_release(self)
|
local function input_release(self)
|
||||||
if IS_NO_AUTO_INPUT then
|
if IS_NO_AUTO_INPUT or not self.input_inited then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.input_inited then
|
self.input_inited = false
|
||||||
self.input_inited = false
|
druid_input.remove()
|
||||||
druid_input.remove()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -290,8 +303,6 @@ function DruidInstance.final(self)
|
|||||||
self._deleted = true
|
self._deleted = true
|
||||||
|
|
||||||
input_release(self)
|
input_release(self)
|
||||||
|
|
||||||
self:log_message("Druid final")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -336,8 +347,6 @@ function DruidInstance.remove(self, component)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:log_message("Remove", { name = component:get_name(), parent = component:get_parent_name() })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -437,8 +446,6 @@ function DruidInstance.on_focus_lost(self)
|
|||||||
for i = 1, #components do
|
for i = 1, #components do
|
||||||
components[i]:on_focus_lost()
|
components[i]:on_focus_lost()
|
||||||
end
|
end
|
||||||
|
|
||||||
self:log_message("On focus lost")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -451,8 +458,6 @@ function DruidInstance.on_focus_gained(self)
|
|||||||
for i = 1, #components do
|
for i = 1, #components do
|
||||||
components[i]:on_focus_gained()
|
components[i]:on_focus_gained()
|
||||||
end
|
end
|
||||||
|
|
||||||
self:log_message("On focus gained")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -466,8 +471,6 @@ function DruidInstance.on_language_change(self)
|
|||||||
for i = 1, #components do
|
for i = 1, #components do
|
||||||
components[i]:on_language_change()
|
components[i]:on_language_change()
|
||||||
end
|
end
|
||||||
|
|
||||||
self:log_message("On language change")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -671,7 +674,7 @@ end
|
|||||||
-- @tparam bool no_adjust If true, will not correct text size
|
-- @tparam bool no_adjust If true, will not correct text size
|
||||||
-- @treturn LangText lang_text component
|
-- @treturn LangText lang_text component
|
||||||
function DruidInstance.new_lang_text(self, node, locale_id, no_adjust)
|
function DruidInstance.new_lang_text(self, node, locale_id, no_adjust)
|
||||||
return helper.extended_component("lang_text")
|
return helper.extended_component("lang_text")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,32 +1,5 @@
|
|||||||
local middleclass = {
|
-- Source: https://github.com/kikito/middleclass
|
||||||
_VERSION = 'middleclass v4.1.1',
|
local middleclass = {}
|
||||||
_DESCRIPTION = 'Object Orientation for Lua',
|
|
||||||
_URL = 'https://github.com/kikito/middleclass',
|
|
||||||
_LICENSE = [[
|
|
||||||
MIT LICENSE
|
|
||||||
|
|
||||||
Copyright (c) 2011 Enrique García Cota
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
copy of this software and associated documentation files (the
|
|
||||||
"Software"), to deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included
|
|
||||||
in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
]]
|
|
||||||
}
|
|
||||||
|
|
||||||
local function _createIndexWrapper(aClass, f)
|
local function _createIndexWrapper(aClass, f)
|
||||||
if f == nil then
|
if f == nil then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user