mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update examples to widgets instead components
This commit is contained in:
@@ -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
|
||||
|
@@ -1,14 +1,7 @@
|
||||
local component = require("druid.component")
|
||||
---@class examples.drag_to_node: druid.widget
|
||||
local M = {}
|
||||
|
||||
---@class examples.drag_to_node: druid.component
|
||||
---@field druid druid.instance
|
||||
local M = component.create("drag_to_node")
|
||||
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
function M:init()
|
||||
self.zone = self:get_node("zone")
|
||||
self.counter = 0
|
||||
self.text_counter = self:get_node("text_counter")
|
||||
|
Reference in New Issue
Block a user