Update examples to widgets instead components

This commit is contained in:
Insality
2025-03-27 00:19:32 +02:00
parent dee77ab313
commit 7640e207a4
47 changed files with 183 additions and 422 deletions

View File

@@ -1,15 +1,7 @@
local component = require("druid.component")
---@class examples.drag: druid.component
---@field druid druid.instance
local M = component.create("drag")
---@param template string
---@param nodes table<hash, node>
function M:init(template, nodes)
self.druid = self:get_druid(template, nodes)
---@class examples.drag: druid.widget
local M = {}
function M:init()
-- Init drag and move the drag node on drag callback
self.drag = self.druid:new_drag("drag/root", function(_, dx, dy)
local position_x = gui.get(self.drag.node, "position.x")
@@ -25,5 +17,4 @@ function M:init(template, nodes)
end)
end
return M