Other updated

This commit is contained in:
Insality
2025-03-29 20:06:08 +02:00
parent 45493bc9dd
commit f2b930ba68
15 changed files with 356 additions and 325 deletions

View File

@@ -68,4 +68,48 @@ function M:on_button_click(instance)
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