core/menusystem: don't draw cursor and allow selection when it overflow
This commit is contained in:
parent
b18c95455c
commit
997a66e901
2 changed files with 18 additions and 10 deletions
|
@ -107,7 +107,9 @@ function FlowBox:keyreleased(key, code)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == "A" then
|
if key == "A" then
|
||||||
self.widget.list[self.widget.selected]:action()
|
if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then
|
||||||
|
self.widget.list[self.widget.selected]:action()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -164,11 +166,13 @@ function FlowBox:draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
function FlowBox:drawCursor()
|
function FlowBox:drawCursor()
|
||||||
local w, h = self:getWidgetSize()
|
if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then
|
||||||
local col, line = self:getCoord(self.widget.selected)
|
local w, h = self:getWidgetSize()
|
||||||
local x = (col) * h
|
local col, line = self:getCoord(self.widget.selected)
|
||||||
local y = (line) * h
|
local x = (col) * h
|
||||||
menuutils.drawCursor(self.x + x, self.y + y, w, h)
|
local y = (line) * h
|
||||||
|
menuutils.drawCursor(self.x + x, self.y + y, w, h)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return FlowBox
|
return FlowBox
|
||||||
|
|
|
@ -42,7 +42,9 @@ function ListBox:keyreleased(key, code)
|
||||||
end
|
end
|
||||||
|
|
||||||
if key == "A" then
|
if key == "A" then
|
||||||
self.widget.list[self.widget.selected]:action()
|
if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then
|
||||||
|
self.widget.list[self.widget.selected]:action()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -85,9 +87,11 @@ function ListBox:draw()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ListBox:drawCursor()
|
function ListBox:drawCursor()
|
||||||
local w, h = self:getWidgetSize()
|
if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then
|
||||||
local y = (self.widget.selected - 1) * h
|
local w, h = self:getWidgetSize()
|
||||||
menuutils.drawCursor(self.x,self.y + y, w, h)
|
local y = (self.widget.selected - 1) * h
|
||||||
|
menuutils.drawCursor(self.x,self.y + y, w, h)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return ListBox
|
return ListBox
|
||||||
|
|
Loading…
Reference in a new issue