Code: Select all
function Node:initialize(px, py, pw, ph)
local SliW = 5 -- width of slider buttons
local MinW = 50 -- minimum width of whole node
-- Init of base and sub-elements
local base = loveframes.Create("panel")
base:SetPos(px, py):SetSize(pw, ph)
base:SetProperty("RightEdgeX", px + pw)
--
local text = loveframes.Create("text", base)
text:SetPos(SliW + 1, 0):SetSize(pw - (SliW + 1) * 2, ph):SetMaxWidth(pw - (SliW + 1) * 2)
text:SetText("Objects (blablabla)")
--more stuff
-- update pos&size of all elements after resizing the base and having new amount of lines
function base:Update(dt)
--print(text:GetLines())
local h
if text:GetLines() then h = text:GetLines() * 10 else h = base:GetHeight() end
local x, y, w = base:GetX(), base:GetY(), base:GetWidth()
base:SetHeight(h)
leftResizer:SetHeight(h)
rightResizer:SetX(w - SliW):SetHeight(h)
--text:SetPos(SliW + 1, 0):SetSize(w - (SliW + 1) * 2, h):SetMaxWidth(w - (SliW + 1) * 2)
text:SetPos(SliW + 1, 0):SetMaxWidth(w - (SliW + 1) * 2)
end
end
So am I using GetLines somehow wrong? Here is the full code in a .love if anybody is interested (per se not interesting yet, it's pretty much a stub, I would like to solve this problem first, before I go on) What you can do, is grabbing the left and right borders of the nodes and change the width by dragging.