# Mod in Viewport

**URL:** <https://forum.juce.com/t/mod-in-viewport/3918>\
**Category:** General JUCE discussion\
**Created:** [May 13, 2009, 12:32pm UTC](https://forum.juce.com/t/mod-in-viewport/3918 "2009-05-13T12:32:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [May 13, 2009, 12:32pm UTC](https://forum.juce.com/t/mod-in-viewport/3918/1 "2009-05-13T12:32:14Z")

</div>

Hi Jules

When you only have an hasHorzBar, and wheelIncrementX == 0,  
shouldn’t we use the wheelIncrementY otherwise the scrollbar will never move ?  
Most of the time, only wheelIncrementY is valid on most mouse.

[code]bool Viewport::useMouseWheelMoveIfNeeded (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY)  
{  
if (! (e.mods.isAltDown() || e.mods.isCtrlDown()))  
{  
const bool hasVertBar = verticalScrollBar-\>isVisible();  
const bool hasHorzBar = horizontalScrollBar-\>isVisible();

```
    if (hasHorzBar && (wheelIncrementX != 0 || e.mods.isShiftDown() || ! hasVertBar))
    {

```

//mod  
if (!hasVertBar && wheelIncrementX == 0)  
{  
wheelIncrementX = wheelIncrementY;  
}  
// end mod  
horizontalScrollBar-\>mouseWheelMove (e.getEventRelativeTo (horizontalScrollBar),  
wheelIncrementX, wheelIncrementY);  
return true;  
}  
else if (hasVertBar && wheelIncrementY != 0)  
{  
verticalScrollBar-\>mouseWheelMove (e.getEventRelativeTo (verticalScrollBar),  
wheelIncrementX, wheelIncrementY);  
return true;  
}  
}

```
return false;

```

}[/code]

Thanks,

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 13, 2009, 1:02pm UTC](https://forum.juce.com/t/mod-in-viewport/3918/2 "2009-05-13T13:02:40Z")

</div>

Yes, that seems like a sensible behaviour!
