Input cursor fix

Fixed cursor for input objects when changing the value via :setValue()
This commit is contained in:
Robert Jelic
2022-10-20 18:49:21 +02:00
parent bc018ebcd9
commit 3dcdcfd383

View File

@@ -57,9 +57,9 @@ return function(name)
setValue = function(self, val) setValue = function(self, val)
base.setValue(self, tostring(val)) base.setValue(self, tostring(val))
if not (internalValueChange) then if not (internalValueChange) then
textX = tostring(val):len() + 1
wIndex = math.max(1, textX-self:getWidth()+1)
if(self:isFocused())then if(self:isFocused())then
textX = tostring(val):len() + 1
wIndex = math.max(1, textX-self:getWidth()+1)
local obx, oby = self:getAnchorPosition() local obx, oby = self:getAnchorPosition()
self.parent:setCursor(true, obx + textX - wIndex, oby+math.floor(self:getHeight()/2), self.fgColor) self.parent:setCursor(true, obx + textX - wIndex, oby+math.floor(self:getHeight()/2), self.fgColor)
end end