mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update example with new brand one
This commit is contained in:
26
example/examples/basic/text/multiline_text.lua
Normal file
26
example/examples/basic/text/multiline_text.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
local component = require("druid.component")
|
||||
local container = require("example.components.container.container")
|
||||
|
||||
---@class multiline_text: druid.base_component
|
||||
---@field root node
|
||||
---@field druid druid_instance
|
||||
local M = component.create("multiline_text")
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
self.root = self:get_node("root")
|
||||
self.text = self.druid:new_text("text")
|
||||
|
||||
-- This code is for adjustable text area with mouse
|
||||
self.container = self.druid:new(container, "text_area", nil, function(_, size)
|
||||
self.text:set_size(size)
|
||||
end) --[[@as druid.container]]
|
||||
|
||||
self.container:create_draggable_corners()
|
||||
end
|
||||
|
||||
|
||||
return M
|
Reference in New Issue
Block a user