Move bindings to druid, update widgets

This commit is contained in:
Insality
2025-02-18 21:12:56 +02:00
parent 5eaa50552a
commit dd5f619345
10 changed files with 103 additions and 95 deletions

View File

@@ -23,6 +23,7 @@ nodes {
type: TYPE_BOX
texture: "druid/ui_circle_16"
id: "root"
adjust_mode: ADJUST_MODE_STRETCH
inherit_alpha: true
slice9 {
x: 8.0
@@ -120,6 +121,7 @@ nodes {
texture: "druid/ui_circle_16"
id: "content"
pivot: PIVOT_S
adjust_mode: ADJUST_MODE_STRETCH
parent: "root"
inherit_alpha: true
slice9 {

View File

@@ -11,6 +11,7 @@ function M:init()
self.root = self:get_node("root")
self.text_header = self.druid:new_text("text_header")
self.icon_drag = self:get_node("icon_drag")
self.druid:new_drag("header", self.on_drag_widget)
self.druid:new_button("icon_drag", self.toggle_hide)
:set_style(nil)
@@ -34,7 +35,11 @@ function M:init()
self.values = {}
self.container = self.druid:new_container(self.root)
self.container:add_container("header")
local container_header = self.container:add_container("header", "stretch_x")
container_header:add_container("text_header")
container_header:add_container("icon_drag")
self.container:add_container("content", "stretch_x")
self.default_size = self.container:get_size()
end
@@ -141,6 +146,10 @@ end
function M:on_drag_widget(dx, dy)
if not gui.is_enabled(self.icon_drag) then
return
end
local position = self.container:get_position()
self.container:set_position(position.x + dx, position.y + dy)
end
@@ -159,4 +168,4 @@ function M:toggle_hide()
end
return M
return M