From 0a4d57e46b1752eaf498f90b1cf77c725b9c0e5f Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Wed, 13 Feb 2019 17:51:05 +0100 Subject: [PATCH] core/menusystem: make cursor position relative to first element --- sonic-boost.love/core/modules/menusystem/flowbox.lua | 3 ++- sonic-boost.love/core/modules/menusystem/listbox.lua | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sonic-boost.love/core/modules/menusystem/flowbox.lua b/sonic-boost.love/core/modules/menusystem/flowbox.lua index ebfa53f..aa55788 100644 --- a/sonic-boost.love/core/modules/menusystem/flowbox.lua +++ b/sonic-boost.love/core/modules/menusystem/flowbox.lua @@ -167,11 +167,12 @@ function FlowBox:draw() end function FlowBox:drawCursor() + local begincol, beginline = self:getCoord(self.view.firstSlot) if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then local w, h = self:getWidgetSize() local col, line = self:getCoord(self.widget.selected) local x = (col) * h - local y = (line) * h + local y = (line - beginline) * h menuutils.drawCursor(self.x + x, self.y + y, w, h) end end diff --git a/sonic-boost.love/core/modules/menusystem/listbox.lua b/sonic-boost.love/core/modules/menusystem/listbox.lua index eb5f797..3234963 100644 --- a/sonic-boost.love/core/modules/menusystem/listbox.lua +++ b/sonic-boost.love/core/modules/menusystem/listbox.lua @@ -90,7 +90,7 @@ end function ListBox:drawCursor() if (self.widget.selected >= 1 and self.widget.selected <= #self.widget.list) then local w, h = self:getWidgetSize() - local y = (self.widget.selected - 1) * h + local y = (self.widget.selected - self.view.firstSlot) * h menuutils.drawCursor(self.x,self.y + y, w, h) end end