From 0472742468b9b784eb7822c1df8056660cbd7029 Mon Sep 17 00:00:00 2001 From: Kenny Shields Date: Mon, 26 May 2014 00:54:15 -0400 Subject: [PATCH] Fix bug that would cause tabbuttons to be positioned incorrectly when scrolling with the mouse wheel --- objects/tabs.lua | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/objects/tabs.lua b/objects/tabs.lua index 8493730..c6bc8c6 100644 --- a/objects/tabs.lua +++ b/objects/tabs.lua @@ -239,17 +239,16 @@ function newobject:mousepressed(x, y, button) local visible = internals[numinternals]:GetVisible() if col and visible then local bwidth = self:GetWidthOfButtons() - if (self.offsetx + bwidth) < self.width then - self.offsetx = bwidth - self.width + local scrollamount = self.mousewheelscrollamount + local dtscrolling = self.dtscrolling + if dtscrolling then + local dt = love.timer.getDelta() + self.offsetx = self.offsetx - scrollamount * dt else - local scrollamount = self.mousewheelscrollamount - local dtscrolling = self.dtscrolling - if dtscrolling then - local dt = love.timer.getDelta() - self.offsetx = self.offsetx - scrollamount * dt - else - self.offsetx = self.offsetx - scrollamount - end + self.offsetx = self.offsetx - scrollamount + end + if ((self.offsetx + bwidth) + self.width) < self.width then + self.offsetx = -(bwidth + 10) end end end