Monitor/Mirror fixes
- Fixed monitor events - Monitor's now automatically resize - Fixed mirror events - Fixed input's cursor position if height is bigger than 1
This commit is contained in:
@@ -623,6 +623,7 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
setMirror = function(self, side)
|
setMirror = function(self, side)
|
||||||
|
if(self.parent~=nil)then error("Frame has to be a base frame in order to attach a mirror.") end
|
||||||
mirrorSide = side
|
mirrorSide = side
|
||||||
if(mirror~=nil)then
|
if(mirror~=nil)then
|
||||||
basaltDraw.setMirror(mirror)
|
basaltDraw.setMirror(mirror)
|
||||||
@@ -643,21 +644,23 @@ return function(name, parent, pTerm, basalt)
|
|||||||
if(peripheral.getType(side)=="monitor")then
|
if(peripheral.getType(side)=="monitor")then
|
||||||
termObject = peripheral.wrap(side)
|
termObject = peripheral.wrap(side)
|
||||||
monitorAttached = true
|
monitorAttached = true
|
||||||
self:setSize(termObject.getSize())
|
|
||||||
end
|
end
|
||||||
if(self.parent~=nil)then
|
if(self.parent~=nil)then
|
||||||
self.parent:removeObject(self)
|
self.parent:removeObject(self)
|
||||||
end
|
end
|
||||||
isMonitor = true
|
isMonitor = true
|
||||||
|
basalt.setMonitorFrame(side, self)
|
||||||
else
|
else
|
||||||
termObject = parentTerminal
|
termObject = parentTerminal
|
||||||
isMonitor = false
|
isMonitor = false
|
||||||
if(basalt.getMonitorFrame(monSide)==self)then
|
if(basalt.getMonitorFrame(monSide)==self)then
|
||||||
basalt.setMonitorFrame(monSide, nil)
|
basalt.setMonitorFrame(monSide, nil)
|
||||||
end
|
end
|
||||||
self:setSize(termObject.getSize())
|
|
||||||
end
|
end
|
||||||
basaltDraw = BasaltDraw(termObject)
|
basaltDraw = BasaltDraw(termObject)
|
||||||
|
self:setSize(termObject.getSize())
|
||||||
|
autoSize = true
|
||||||
monSide = side or nil
|
monSide = side or nil
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
return self;
|
return self;
|
||||||
@@ -701,15 +704,22 @@ return function(name, parent, pTerm, basalt)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(autoSize)then
|
if(autoSize)and not(isMonitor)then
|
||||||
if(self.parent==nil)then
|
if(self.parent==nil)then
|
||||||
if(event=="term_resize")or(event=="monitor_resize")then
|
if(event=="term_resize")then
|
||||||
self:setSize(termObject.getSize())
|
self:setSize(termObject.getSize())
|
||||||
autoSize = true
|
autoSize = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(isMonitor)then
|
if(isMonitor)then
|
||||||
|
if(autoSize)then
|
||||||
|
if(event=="monitor_resize")and(p1==monSide)then
|
||||||
|
self:setSize(termObject.getSize())
|
||||||
|
autoSize = true
|
||||||
|
self:updateDraw()
|
||||||
|
end
|
||||||
|
end
|
||||||
if(event == "peripheral")and(p1==monSide)then
|
if(event == "peripheral")and(p1==monSide)then
|
||||||
if(peripheral.getType(monSide)=="monitor")then
|
if(peripheral.getType(monSide)=="monitor")then
|
||||||
monitorAttached = true
|
monitorAttached = true
|
||||||
@@ -730,8 +740,8 @@ return function(name, parent, pTerm, basalt)
|
|||||||
if(event == "peripheral_detach")and(p1==mirrorSide)then
|
if(event == "peripheral_detach")and(p1==mirrorSide)then
|
||||||
monitorAttached = false
|
monitorAttached = false
|
||||||
end
|
end
|
||||||
if(event=="monitor_touch")then
|
if(event=="monitor_touch")and(mirrorSide==p1)then
|
||||||
self:mouseHandler(1, p1, p2)
|
self:mouseHandler(1, p2, p3, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (event == "terminate") then
|
if (event == "terminate") then
|
||||||
|
|||||||
@@ -26,11 +26,6 @@ return function(name)
|
|||||||
local isDragging = false
|
local isDragging = false
|
||||||
local dragStartX, dragStartY, dragXOffset, dragYOffset = 0, 0, 0, 0
|
local dragStartX, dragStartY, dragXOffset, dragYOffset = 0, 0, 0, 0
|
||||||
|
|
||||||
local bgSymbol = " "
|
|
||||||
local bgSymbolColor = colors.black
|
|
||||||
local bgColor = colors.black
|
|
||||||
local transparentColor = false
|
|
||||||
|
|
||||||
local draw = true
|
local draw = true
|
||||||
local activeEvents = {}
|
local activeEvents = {}
|
||||||
|
|
||||||
@@ -42,7 +37,10 @@ return function(name)
|
|||||||
width = 1,
|
width = 1,
|
||||||
height = 1,
|
height = 1,
|
||||||
bgColor = colors.black,
|
bgColor = colors.black,
|
||||||
|
bgSymbol = " ",
|
||||||
|
bgSymbolColor = colors.black,
|
||||||
fgColor = colors.white,
|
fgColor = colors.white,
|
||||||
|
transparentColor = false,
|
||||||
name = name or "Object",
|
name = name or "Object",
|
||||||
parent = nil,
|
parent = nil,
|
||||||
|
|
||||||
@@ -309,9 +307,8 @@ return function(name)
|
|||||||
|
|
||||||
setBackground = function(self, color, symbol, symbolCol)
|
setBackground = function(self, color, symbol, symbolCol)
|
||||||
self.bgColor = color or false
|
self.bgColor = color or false
|
||||||
bgColor = color or false
|
self.bgSymbol = symbol or (color~=false and self.bgSymbol or false)
|
||||||
bgSymbol = symbol or (color~=false and bgSymbol or false)
|
self.bgSymbolColor = symbolCol or self.bgSymbolColor
|
||||||
bgSymbolColor = symbolCol or bgSymbolColor
|
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
@@ -354,16 +351,16 @@ return function(name)
|
|||||||
|
|
||||||
showBorder = function(self, ...)
|
showBorder = function(self, ...)
|
||||||
for _,v in pairs(table.pack(...))do
|
for _,v in pairs(table.pack(...))do
|
||||||
if(v=="left")then
|
if(v=="left")or(...==nil)then
|
||||||
borderLeft = true
|
borderLeft = true
|
||||||
end
|
end
|
||||||
if(v=="top")then
|
if(v=="top")or(...==nil)then
|
||||||
borderTop = true
|
borderTop = true
|
||||||
end
|
end
|
||||||
if(v=="right")then
|
if(v=="right")or(...==nil)then
|
||||||
borderRight = true
|
borderRight = true
|
||||||
end
|
end
|
||||||
if(v=="bottom")then
|
if(v=="bottom")or(...==nil)then
|
||||||
borderBottom = true
|
borderBottom = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -399,15 +396,15 @@ return function(name)
|
|||||||
local w,h = self:getSize()
|
local w,h = self:getSize()
|
||||||
local wP,hP = self.parent:getSize()
|
local wP,hP = self.parent:getSize()
|
||||||
if(x+w<1)or(x>wP)or(y+h<1)or(y>hP)then return false end
|
if(x+w<1)or(x>wP)or(y+h<1)or(y>hP)then return false end
|
||||||
if(transparentColor~=false)then
|
if(self.transparentColor~=false)then
|
||||||
self.parent:drawForegroundBox(x, y, w, h, transparentColor)
|
self.parent:drawForegroundBox(x, y, w, h, self.transparentColor)
|
||||||
end
|
end
|
||||||
if(bgColor~=false)then
|
if(self.bgColor~=false)then
|
||||||
self.parent:drawBackgroundBox(x, y, w, h, bgColor)
|
self.parent:drawBackgroundBox(x, y, w, h, self.bgColor)
|
||||||
end
|
end
|
||||||
if(bgSymbol~=false)then
|
if(self.bgSymbol~=false)then
|
||||||
self.parent:drawForegroundBox(x, y, w, h, bgSymbolColor)
|
self.parent:drawForegroundBox(x, y, w, h, self.bgSymbolColor)
|
||||||
self.parent:drawTextBox(x, y, w, h, bgSymbol)
|
self.parent:drawTextBox(x, y, w, h, self.bgSymbol)
|
||||||
end
|
end
|
||||||
if(shadow)then
|
if(shadow)then
|
||||||
self.parent:drawBackgroundBox(x+1, y+h, w, 1, shadowColor)
|
self.parent:drawBackgroundBox(x+1, y+h, w, 1, shadowColor)
|
||||||
@@ -547,7 +544,6 @@ return function(name)
|
|||||||
for _,v in pairs(table.pack(...))do
|
for _,v in pairs(table.pack(...))do
|
||||||
if(type(v)=="function")then
|
if(type(v)=="function")then
|
||||||
self:registerEvent("mouse_click", v)
|
self:registerEvent("mouse_click", v)
|
||||||
self:registerEvent("monitor_touch", v)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(self.parent~=nil)then
|
if(self.parent~=nil)then
|
||||||
@@ -649,7 +645,6 @@ return function(name)
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
onKeyUp = function(self, ...)
|
onKeyUp = function(self, ...)
|
||||||
if(isEnabled)then
|
|
||||||
for _,v in pairs(table.pack(...))do
|
for _,v in pairs(table.pack(...))do
|
||||||
if(type(v)=="function")then
|
if(type(v)=="function")then
|
||||||
self:registerEvent("key_up", v)
|
self:registerEvent("key_up", v)
|
||||||
@@ -659,7 +654,6 @@ return function(name)
|
|||||||
self.parent:addEvent("key_up", self)
|
self.parent:addEvent("key_up", self)
|
||||||
activeEvents["key_up"] = true
|
activeEvents["key_up"] = true
|
||||||
end
|
end
|
||||||
end
|
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -676,6 +670,10 @@ return function(name)
|
|||||||
self:registerEvent("get_focus", v)
|
self:registerEvent("get_focus", v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if(self.parent~=nil)then
|
||||||
|
self.parent:addEvent("mouse_click", self)
|
||||||
|
activeEvents["mouse_click"] = true
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -685,6 +683,10 @@ return function(name)
|
|||||||
self:registerEvent("lose_focus", v)
|
self:registerEvent("lose_focus", v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if(self.parent~=nil)then
|
||||||
|
self.parent:addEvent("mouse_click", self)
|
||||||
|
activeEvents["mouse_click"] = true
|
||||||
|
end
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -711,9 +713,9 @@ return function(name)
|
|||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
||||||
mouseHandler = function(self, button, x, y)
|
mouseHandler = function(self, button, x, y, isMon)
|
||||||
if(self:isCoordsInObject(x, y))then
|
if(self:isCoordsInObject(x, y))then
|
||||||
local val = eventSystem:sendEvent("mouse_click", self, "mouse_click", button, x, y)
|
local val = eventSystem:sendEvent("mouse_click", self, "mouse_click", button, x, y, isMon)
|
||||||
if(val==false)then return false end
|
if(val==false)then return false end
|
||||||
if(self.parent~=nil)then
|
if(self.parent~=nil)then
|
||||||
self.parent:setFocusedObject(self)
|
self.parent:setFocusedObject(self)
|
||||||
@@ -725,18 +727,6 @@ return function(name)
|
|||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
|
|
||||||
touchHandler = function(self, x, y)
|
|
||||||
if(self:isCoordsInObject(x, y))then
|
|
||||||
local val = eventSystem:sendEvent("monitor_touch", self, "monitor_touch", x, y)
|
|
||||||
if(val==false)then return false end
|
|
||||||
if(self.parent~=nil)then
|
|
||||||
self.parent:setFocusedObject(self)
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end,
|
|
||||||
|
|
||||||
mouseUpHandler = function(self, button, x, y)
|
mouseUpHandler = function(self, button, x, y)
|
||||||
isDragging = false
|
isDragging = false
|
||||||
if(self:isCoordsInObject(x, y))then
|
if(self:isCoordsInObject(x, y))then
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ local bInstance = {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
setMonitorFrame = function(name, frame)
|
setMonitorFrame = function(name, frame)
|
||||||
|
if(mainFrame == frame)then mainFrame = nil end
|
||||||
monFrames[name] = frame
|
monFrames[name] = frame
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@ local function basaltUpdateEvent(event, p1, p2, p3, p4)
|
|||||||
if(basaltEvent:sendEvent("basaltEventCycle", event, p1, p2, p3, p4)==false)then return end
|
if(basaltEvent:sendEvent("basaltEventCycle", event, p1, p2, p3, p4)==false)then return end
|
||||||
if(mainFrame~=nil)then
|
if(mainFrame~=nil)then
|
||||||
if (event == "mouse_click") then
|
if (event == "mouse_click") then
|
||||||
mainFrame:mouseHandler(p1, p2, p3, p4)
|
mainFrame:mouseHandler(p1, p2, p3, false)
|
||||||
activeFrame = mainFrame
|
activeFrame = mainFrame
|
||||||
elseif (event == "mouse_drag") then
|
elseif (event == "mouse_drag") then
|
||||||
mainFrame:dragHandler(p1, p2, p3, p4)
|
mainFrame:dragHandler(p1, p2, p3, p4)
|
||||||
@@ -169,12 +170,13 @@ local function basaltUpdateEvent(event, p1, p2, p3, p4)
|
|||||||
elseif (event == "mouse_scroll") then
|
elseif (event == "mouse_scroll") then
|
||||||
mainFrame:scrollHandler(p1, p2, p3, p4)
|
mainFrame:scrollHandler(p1, p2, p3, p4)
|
||||||
activeFrame = mainFrame
|
activeFrame = mainFrame
|
||||||
elseif (event == "monitor_touch") then
|
|
||||||
if(monFrames[p1]~=nil)then
|
|
||||||
monFrames[p1]:touchHandler(p1, p2, p3, p4)
|
|
||||||
activeFrame = monFrames[p1]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if(event == "monitor_touch") then
|
||||||
|
if(monFrames[p1]~=nil)then
|
||||||
|
monFrames[p1]:mouseHandler(1, p2, p3, true)
|
||||||
|
activeFrame = monFrames[p1]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if(event == "char")then
|
if(event == "char")then
|
||||||
@@ -320,6 +322,7 @@ basalt = {
|
|||||||
|
|
||||||
debug = function(...)
|
debug = function(...)
|
||||||
local args = { ... }
|
local args = { ... }
|
||||||
|
if(mainFrame==nil)then print(...) return end
|
||||||
if (mainFrame.name ~= "basaltDebuggingFrame") then
|
if (mainFrame.name ~= "basaltDebuggingFrame") then
|
||||||
if (mainFrame ~= basalt.debugFrame) then
|
if (mainFrame ~= basalt.debugFrame) then
|
||||||
basalt.debugLabel:setParent(mainFrame)
|
basalt.debugLabel:setParent(mainFrame)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
local Object = require("Object")
|
local Object = require("Object")
|
||||||
local utils = require("utils")
|
local utils = require("utils")
|
||||||
local xmlValue = utils.getValueFromXML
|
local xmlValue = utils.getValueFromXML
|
||||||
|
local tHex = require("tHex")
|
||||||
|
|
||||||
return function(name)
|
return function(name)
|
||||||
-- Button
|
-- Button
|
||||||
@@ -55,14 +56,10 @@ return function(name)
|
|||||||
local w,h = self:getSize()
|
local w,h = self:getSize()
|
||||||
local verticalAlign = utils.getTextVerticalAlign(h, textVerticalAlign)
|
local verticalAlign = utils.getTextVerticalAlign(h, textVerticalAlign)
|
||||||
|
|
||||||
if(self.bgColor~=false)then
|
|
||||||
self.parent:drawBackgroundBox(obx, oby, w, h, self.bgColor)
|
|
||||||
self.parent:drawTextBox(obx, oby, w, h, " ")
|
|
||||||
end
|
|
||||||
if(self.fgColor~=false)then self.parent:drawForegroundBox(obx, oby, w, h, self.fgColor) end
|
|
||||||
for n = 1, h do
|
for n = 1, h do
|
||||||
if (n == verticalAlign) then
|
if (n == verticalAlign) then
|
||||||
self.parent:setText(obx, oby + (n - 1), utils.getTextHorizontalAlign(self:getValue(), w, textHorizontalAlign))
|
self.parent:setText(obx, oby + (n - 1), utils.getTextHorizontalAlign(self:getValue(), w, textHorizontalAlign))
|
||||||
|
self.parent:setFG(obx, oby + (n - 1), utils.getTextHorizontalAlign(tHex[self.fgColor]:rep(self:getValue():len()), w, textHorizontalAlign))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ return function(name)
|
|||||||
if(defaultText~="")then
|
if(defaultText~="")then
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
end
|
end
|
||||||
self.parent:setCursor(true, obx + textX - wIndex, oby+math.floor(self:getHeight()/2), self.fgColor)
|
self.parent:setCursor(true, obx + textX - wIndex, oby+math.max(math.ceil(self:getHeight()/2-1, 1)), self.fgColor)
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ return function(name)
|
|||||||
cursorX = self.x + w - 1
|
cursorX = self.x + w - 1
|
||||||
end
|
end
|
||||||
if (self.parent ~= nil) then
|
if (self.parent ~= nil) then
|
||||||
self.parent:setCursor(true, obx + cursorX, oby+math.floor(h/2), self.fgColor)
|
self.parent:setCursor(true, obx + cursorX, oby+math.max(math.ceil(h/2-1, 1)), self.fgColor)
|
||||||
end
|
end
|
||||||
internalValueChange = false
|
internalValueChange = false
|
||||||
return true
|
return true
|
||||||
@@ -222,7 +222,7 @@ return function(name)
|
|||||||
cursorX = x + w - 1
|
cursorX = x + w - 1
|
||||||
end
|
end
|
||||||
if (self.parent ~= nil) then
|
if (self.parent ~= nil) then
|
||||||
self.parent:setCursor(true, obx + cursorX, oby+math.floor(h/2), self.fgColor)
|
self.parent:setCursor(true, obx + cursorX, oby+math.max(math.ceil(h/2-1, 1)), self.fgColor)
|
||||||
end
|
end
|
||||||
internalValueChange = false
|
internalValueChange = false
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
@@ -247,6 +247,7 @@ return function(name)
|
|||||||
wIndex = 1
|
wIndex = 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
self.parent:setCursor(true, obx + textX-1, oby+math.max(math.ceil(h/2-1, 1)), self.fgColor)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -284,7 +285,7 @@ return function(name)
|
|||||||
cursorX = x + w - 1
|
cursorX = x + w - 1
|
||||||
end
|
end
|
||||||
if (self.parent ~= nil) then
|
if (self.parent ~= nil) then
|
||||||
self.parent:setCursor(true, obx + cursorX, oby+math.floor(h/2), self.fgColor)
|
self.parent:setCursor(true, obx + cursorX, oby+math.max(math.ceil(h/2-1, 1)), self.fgColor)
|
||||||
end
|
end
|
||||||
self:updateDraw()
|
self:updateDraw()
|
||||||
internalValueChange = false
|
internalValueChange = false
|
||||||
@@ -325,7 +326,7 @@ return function(name)
|
|||||||
if (inputType == "password") and (val ~= "") then
|
if (inputType == "password") and (val ~= "") then
|
||||||
text = string.rep("*", text:len())
|
text = string.rep("*", text:len())
|
||||||
end
|
end
|
||||||
text = text .. string.rep(" ", space)
|
text = text .. string.rep(self.bgSymbol, space)
|
||||||
self.parent:writeText(obx, oby + (n - 1), text, bCol, fCol)
|
self.parent:writeText(obx, oby + (n - 1), text, bCol, fCol)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ local tHex = require("tHex")
|
|||||||
local log = require("basaltLogs")
|
local log = require("basaltLogs")
|
||||||
local xmlValue = require("utils").getValueFromXML
|
local xmlValue = require("utils").getValueFromXML
|
||||||
|
|
||||||
|
local rep = string.rep
|
||||||
|
|
||||||
return function(name)
|
return function(name)
|
||||||
local base = Object(name)
|
local base = Object(name)
|
||||||
local objectType = "Textfield"
|
local objectType = "Textfield"
|
||||||
@@ -434,6 +436,7 @@ return function(name)
|
|||||||
cursorX = 0
|
cursorX = 0
|
||||||
end
|
end
|
||||||
self.parent:setCursor(true, obx + cursorX, oby + cursorY, self.fgColor)
|
self.parent:setCursor(true, obx + cursorX, oby + cursorY, self.fgColor)
|
||||||
|
self:updateDraw()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -470,7 +473,9 @@ return function(name)
|
|||||||
if (base.dragHandler(self, button, x, y)) then
|
if (base.dragHandler(self, button, x, y)) then
|
||||||
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
|
local obx, oby = self:getAbsolutePosition(self:getAnchorPosition())
|
||||||
local anchx, anchy = self:getAnchorPosition()
|
local anchx, anchy = self:getAnchorPosition()
|
||||||
|
local w,h = self:getSize()
|
||||||
if (lines[y - oby + hIndex] ~= nil) then
|
if (lines[y - oby + hIndex] ~= nil) then
|
||||||
|
if(anchx+w > anchx + x - (obx+1)+ wIndex)and(anchx < anchx + x - obx+ wIndex)then
|
||||||
textX = x - obx + wIndex
|
textX = x - obx + wIndex
|
||||||
textY = y - oby + hIndex
|
textY = y - oby + hIndex
|
||||||
if (textX > lines[textY]:len()) then
|
if (textX > lines[textY]:len()) then
|
||||||
@@ -485,6 +490,8 @@ return function(name)
|
|||||||
if (self.parent ~= nil) then
|
if (self.parent ~= nil) then
|
||||||
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
|
self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex, self.fgColor)
|
||||||
end
|
end
|
||||||
|
self:updateDraw()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -566,12 +573,6 @@ return function(name)
|
|||||||
if (self.parent ~= nil) then
|
if (self.parent ~= nil) then
|
||||||
local obx, oby = self:getAnchorPosition()
|
local obx, oby = self:getAnchorPosition()
|
||||||
local w,h = self:getSize()
|
local w,h = self:getSize()
|
||||||
if(self.bgColor~=false)then
|
|
||||||
self.parent:drawBackgroundBox(obx, oby, w, h, self.bgColor)
|
|
||||||
end
|
|
||||||
if(self.fgColor~=false)then
|
|
||||||
self.parent:drawForegroundBox(obx, oby, w, h, self.fgColor)
|
|
||||||
end
|
|
||||||
for n = 1, h do
|
for n = 1, h do
|
||||||
local text = ""
|
local text = ""
|
||||||
local bg = ""
|
local bg = ""
|
||||||
@@ -588,9 +589,9 @@ return function(name)
|
|||||||
if (space < 0) then
|
if (space < 0) then
|
||||||
space = 0
|
space = 0
|
||||||
end
|
end
|
||||||
text = text .. string.rep(" ", space)
|
text = text .. rep(self.bgSymbol, space)
|
||||||
bg = bg .. string.rep(tHex[self.bgColor], space)
|
bg = bg .. rep(tHex[self.bgColor], space)
|
||||||
fg = fg .. string.rep(tHex[self.fgColor], space)
|
fg = fg .. rep(tHex[self.fgColor], space)
|
||||||
self.parent:setText(obx, oby + n - 1, text)
|
self.parent:setText(obx, oby + n - 1, text)
|
||||||
self.parent:setBG(obx, oby + n - 1, bg)
|
self.parent:setBG(obx, oby + n - 1, bg)
|
||||||
self.parent:setFG(obx, oby + n - 1, fg)
|
self.parent:setFG(obx, oby + n - 1, fg)
|
||||||
|
|||||||
Reference in New Issue
Block a user