From 3c7ebe43f850569bc7bb23ea961038150e2e6189 Mon Sep 17 00:00:00 2001 From: Alexander Sedov <alex0player@gmail.com> Date: Sat, 24 Jan 2015 06:01:03 +0300 Subject: [PATCH] Made scrollbars count from 1 like lists and everything wants them to. --- game/engines/default/engine/ui/Slider.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/game/engines/default/engine/ui/Slider.lua b/game/engines/default/engine/ui/Slider.lua index fe674d53ad..6f4947d5f6 100644 --- a/game/engines/default/engine/ui/Slider.lua +++ b/game/engines/default/engine/ui/Slider.lua @@ -46,11 +46,11 @@ function _M:display(x, y) self.top.t:toScreenFull(x, y, self.top.w, self.top.h, self.top.tw, self.top.th) self.bottom.t:toScreenFull(x, y + self.h - self.bottom.h, self.bottom.w, self.bottom.h, self.bottom.tw, self.bottom.th) self.middle.t:toScreenFull(x, y + self.top.h, self.middle.w, self.h - self.top.h - self.bottom.h, self.middle.tw, self.middle.th) - self.pos = util.minBound(self.pos, 0, self.max) + self.pos = util.minBound(self.pos, 1, self.max) if self.inverse then - y = y + self.h - (self.pos / self.max) * (self.h - self.bottom.h - self.top.h - self.sel.h) - self.bottom.h - self.sel.h + y = y + self.h - ((self.pos - 1) / (self.max - 1)) * (self.h - self.bottom.h - self.top.h - self.sel.h) - self.bottom.h - self.sel.h else - y = y + (self.pos / self.max) * (self.h - self.bottom.h - self.top.h - self.sel.h) + self.top.h + y = y + ((self.pos - 1) / (self.max - 1)) * (self.h - self.bottom.h - self.top.h - self.sel.h) + self.top.h end self.sel.t:toScreenFull(x - (self.sel.w - self.top.w) * 0.5, y, self.sel.w, self.sel.h, self.sel.tw, self.sel.th) end -- GitLab