Mod in Viewport


#1

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,


#2

Yes, that seems like a sensible behaviour!