When reaching max or min scroll allow other scroll areas to scroll.

This commit is contained in:
BenDol 2014-07-13 02:06:36 +12:00
parent 5909634837
commit d070711409
2 changed files with 19 additions and 1 deletions

View File

@ -111,8 +111,15 @@ function UIScrollArea:onMouseWheel(mousePos, mouseWheel)
return false
end
if mouseWheel == MouseWheelUp then
if self.verticalScrollBar:getValue() < 1 then
return false
end
self.verticalScrollBar:decrement()
else
local maximum = self.verticalScrollBar:getMaximum()
if self.verticalScrollBar:getValue() >= maximum then
return false
end
self.verticalScrollBar:increment()
end
elseif self.horizontalScrollBar then
@ -120,8 +127,15 @@ function UIScrollArea:onMouseWheel(mousePos, mouseWheel)
return false
end
if mouseWheel == MouseWheelUp then
local maximum = self.horizontalScrollBar:getMaximum()
if self.horizontalScrollBar:getValue() >= maximum then
return false
end
self.horizontalScrollBar:increment()
else
if self.horizontalScrollBar:getValue() < 1 then
return false
end
self.horizontalScrollBar:decrement()
end
end

View File

@ -234,19 +234,23 @@ function UIScrollBar:onGeometryChange()
end
function UIScrollBar:onMouseWheel(mousePos, mouseWheel)
if not self.mouseScroll then
if not self.mouseScroll or not self:isOn() then
return false
end
if mouseWheel == MouseWheelUp then
if self.orientation == 'vertical' then
if self.value < 1 then return false end
self:decrement()
else
if self.value >= self.maximum then return false end
self:increment()
end
else
if self.orientation == 'vertical' then
if self.value >= self.maximum then return false end
self:increment()
else
if self.value < 1 then return false end
self:decrement()
end
end