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

master
BenDol 10 years ago
parent 5909634837
commit d070711409

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

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

Loading…
Cancel
Save