mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Other updated
This commit is contained in:
@@ -48,4 +48,48 @@ function M:on_button_click(index)
|
||||
end
|
||||
|
||||
|
||||
---@param output_list output_list
|
||||
function M:on_example_created(output_list)
|
||||
self.on_item_click:subscribe(function(index)
|
||||
output_list:add_log_text("Item clicked: " .. index)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
---@param properties_panel properties_panel
|
||||
function M:properties_control(properties_panel)
|
||||
local view_node = self.scroll.view_node
|
||||
local is_stencil = gui.get_clipping_mode(view_node) == gui.CLIPPING_MODE_STENCIL
|
||||
|
||||
properties_panel:add_checkbox("ui_clipping", is_stencil, function(value)
|
||||
gui.set_clipping_mode(view_node, value and gui.CLIPPING_MODE_STENCIL or gui.CLIPPING_MODE_NONE)
|
||||
end)
|
||||
|
||||
properties_panel:add_slider("ui_scroll", 0, function(value)
|
||||
self.scroll:scroll_to_percent(vmath.vector3(0, 1 - value, 0), true)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
---@return string
|
||||
function M:get_debug_info()
|
||||
local data_list = self.data_list
|
||||
|
||||
local data = data_list:get_data()
|
||||
local info = ""
|
||||
info = info .. "Data length: " .. #data .. "\n"
|
||||
info = info .. "First Visual Index: " .. data_list.top_index .. "\n"
|
||||
info = info .. "Last Visual Index: " .. data_list.last_index .. "\n"
|
||||
|
||||
local s = self.scroll
|
||||
info = info .. "\n"
|
||||
info = info .. "View Size Y: " .. gui.get(s.view_node, "size.y") .. "\n"
|
||||
info = info .. "Content Size Y: " .. gui.get(s.content_node, "size.y") .. "\n"
|
||||
info = info .. "Content position Y: " .. math.ceil(s.position.y) .. "\n"
|
||||
info = info .. "Content Range Y: " .. s.available_pos.y .. " - " .. s.available_pos.w .. "\n"
|
||||
|
||||
return info
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
@@ -39,4 +39,36 @@ function M:on_button_click(index)
|
||||
end
|
||||
|
||||
|
||||
---@param properties_panel properties_panel
|
||||
function M:properties_control(properties_panel)
|
||||
local view_node = self.scroll.view_node
|
||||
local is_stencil = gui.get_clipping_mode(view_node) == gui.CLIPPING_MODE_STENCIL
|
||||
|
||||
properties_panel:add_checkbox("ui_clipping", is_stencil, function(value)
|
||||
gui.set_clipping_mode(view_node, value and gui.CLIPPING_MODE_STENCIL or gui.CLIPPING_MODE_NONE)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
---@return string
|
||||
function M:get_debug_info()
|
||||
local data_list = self.data_list
|
||||
|
||||
local data = data_list:get_data()
|
||||
local info = ""
|
||||
info = info .. "Data length: " .. #data .. "\n"
|
||||
info = info .. "First Visual Index: " .. data_list.top_index .. "\n"
|
||||
info = info .. "Last Visual Index: " .. data_list.last_index .. "\n"
|
||||
|
||||
local s = self.scroll
|
||||
info = info .. "\n"
|
||||
info = info .. "View Size X: " .. gui.get(s.view_node, "size.x") .. "\n"
|
||||
info = info .. "Content Size X: " .. gui.get(s.content_node, "size.x") .. "\n"
|
||||
info = info .. "Content position X: " .. math.ceil(s.position.x) .. "\n"
|
||||
info = info .. "Content Range X: " .. s.available_pos.x .. " - " .. s.available_pos.z .. "\n"
|
||||
|
||||
return info
|
||||
end
|
||||
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user