Added scrollableFrame example

Fixed Cursor Bug
Reworked XML
This commit is contained in:
Robert Jelic
2025-03-03 23:36:42 +01:00
parent 373bd7b485
commit bfad03cf08
6 changed files with 495 additions and 114 deletions

View File

@@ -196,6 +196,10 @@ function Input:render()
return
end
if(focused) then
self:setCursor(self.get("cursorPos") - viewOffset, 1, true, self.get("cursorColor") or self.get("foreground"))
end
local visibleText = text:sub(viewOffset + 1, viewOffset + width)
self:textFg(1, 1, visibleText, self.get("foreground"))
end

View File

@@ -410,6 +410,10 @@ end
function VisualElement:setCursor(x, y, blink, color)
if self.parent then
local xPos, yPos = self:calculatePosition()
if(x + xPos - 1<1)or(x + xPos - 1>self.parent.get("width"))or
(y + yPos - 1<1)or(y + yPos - 1>self.parent.get("height"))then
return self.parent:setCursor(x + xPos - 1, y + yPos - 1, false)
end
return self.parent:setCursor(x + xPos - 1, y + yPos - 1, blink, color)
end
return self