mirror of
https://github.com/CCLeonOS/LeonOS.git
synced 2026-03-03 15:17:01 +00:00
fix(lgui): 替换term.blink为颜色反转实现光标效果
由于CC Tweaked不支持term.blink,改用前景色和背景色反转的方式实现光标闪烁效果
This commit is contained in:
@@ -320,9 +320,15 @@ function TextField:draw()
|
||||
-- Draw cursor
|
||||
if self.focused and self.enabled then
|
||||
term.setCursorPos(self.x + self.cursorPosDisplay, self.y)
|
||||
term.blink(true)
|
||||
else
|
||||
term.blink(false)
|
||||
-- CC Tweaked doesn't support term.blink, so we'll invert the colors instead
|
||||
local currentFg = term.getTextColor()
|
||||
local currentBg = term.getBackgroundColor()
|
||||
term.setTextColor(currentBg)
|
||||
term.setBackgroundColor(currentFg)
|
||||
term.write(" ")
|
||||
term.setTextColor(currentFg)
|
||||
term.setBackgroundColor(currentBg)
|
||||
term.setCursorPos(self.x + self.cursorPosDisplay, self.y)
|
||||
end
|
||||
|
||||
term.setTextColor(oldFg)
|
||||
|
||||
Reference in New Issue
Block a user