diff --git a/modules/corelib/ui/uiscrollarea.lua b/modules/corelib/ui/uiscrollarea.lua index b9732acf..f5be74e1 100644 --- a/modules/corelib/ui/uiscrollarea.lua +++ b/modules/corelib/ui/uiscrollarea.lua @@ -107,12 +107,18 @@ end function UIScrollArea:onMouseWheel(mousePos, mouseWheel) if self.verticalScrollBar then + if not self.verticalScrollBar:isOn() then + return false + end if mouseWheel == MouseWheelUp then self.verticalScrollBar:decrement() else self.verticalScrollBar:increment() end elseif self.horizontalScrollBar then + if not self.horizontalScrollBar:isOn() then + return false + end if mouseWheel == MouseWheelUp then self.horizontalScrollBar:increment() else diff --git a/modules/corelib/ui/uispinbox.lua b/modules/corelib/ui/uispinbox.lua index d3c1fca7..6586bb6a 100644 --- a/modules/corelib/ui/uispinbox.lua +++ b/modules/corelib/ui/uispinbox.lua @@ -11,6 +11,7 @@ function UISpinBox.create() spinbox.value = 0 spinbox.step = 1 spinbox.firstchange = true + spinbox.mouseScroll = true spinbox:setText("0") return spinbox end @@ -21,6 +22,9 @@ function UISpinBox:onSetup() end function UISpinBox:onMouseWheel(mousePos, direction) + if not self.mouseScroll then + return false + end if direction == MouseWheelUp then self:up() elseif direction == MouseWheelDown then @@ -70,6 +74,8 @@ function UISpinBox:onStyleApply(styleName, styleNode) addEvent(function() self:setMaximum(value) end) elseif name == 'minimum' then addEvent(function() self:setMinimum(value) end) + elseif name == 'mouse-scroll' then + addEvent(function() self:setMouseScroll(value) end) elseif name == 'buttons' then addEvent(function() if value then @@ -157,3 +163,11 @@ end function UISpinBox:setStep(step) self.step = step or 1 end + +function UISpinBox:setMouseScroll(mouseScroll) + self.mouseScroll = mouseScroll +end + +function UISpinBox:getMouseScroll() + return self.mouseScroll +end \ No newline at end of file