Start update examples to move control things to example itself

This commit is contained in:
Insality
2025-03-29 19:53:11 +02:00
parent d6fb8cad09
commit e1339a2ca8
7 changed files with 107 additions and 87 deletions

View File

@@ -31,4 +31,56 @@ function M:refresh_text_position()
end
---@param properties_panel properties_panel
function M:properties_control(properties_panel)
local adjust_index = 1
local adjust_types = {
"downscale",
"downscale_limited",
--"scale_then_scroll", -- works bad with container for some reason
--"scroll", -- works bad with container for some reason
"trim",
}
properties_panel:add_button("ui_adjust_next", function()
adjust_index = adjust_index + 1
if adjust_index > #adjust_types then
adjust_index = 1
end
self.text:set_text_adjust(adjust_types[adjust_index], 0.5)
end)
local pivot_index = 1
local pivot_list = {
gui.PIVOT_CENTER,
gui.PIVOT_W,
gui.PIVOT_SW,
gui.PIVOT_S,
gui.PIVOT_SE,
gui.PIVOT_E,
gui.PIVOT_NE,
gui.PIVOT_N,
gui.PIVOT_NW,
}
properties_panel:add_button("ui_pivot_next", function()
pivot_index = pivot_index + 1
if pivot_index > #pivot_list then
pivot_index = 1
end
self:set_pivot(pivot_list[pivot_index])
end)
end
---@return string
function M:get_debug_info()
local info = ""
info = info .. "Text Adjust: " .. self.text.adjust_type .. "\n"
info = info .. "Pivot: " .. gui.get_pivot(self.text.node) .. "\n"
return info
end
return M