Hi All,
1.) I firstly want to know about how can the system mouse wheel settings for scrolling can be used in our application, which is using juce. The requirment is we want to scroll the same number of lines as much as that being set in the mouse wheel properties.
2.) secondly,
below is a code snippet from juce_Viewport.cpp.. One thing that's not clear is the use of the value 14.0f, used as a multiplier for both horizontal and vertical scrolling. We would be really thankful to you, if you could tell us What is the significance of that value.
bool Viewport::useMouseWheelMoveIfNeeded (const MouseEvent& e, const MouseWheelDetails& wheel) { if (! (e.mods.isAltDown() || e.mods.isCtrlDown() || e.mods.isCommandDown())) { const bool hasVertBar = verticalScrollBar.isVisible(); const bool hasHorzBar = horizontalScrollBar.isVisible(); if (hasHorzBar || hasVertBar) { float wheelIncrementX = wheel.deltaX; float wheelIncrementY = wheel.deltaY; if (wheelIncrementX != 0) { wheelIncrementX *= 14.0f * singleStepX; wheelIncrementX = (wheelIncrementX < 0) ? jmin (wheelIncrementX, -1.0f) : jmax (wheelIncrementX, 1.0f); } if (wheelIncrementY != 0) { wheelIncrementY *= 14.0f * singleStepY; wheelIncrementY = (wheelIncrementY < 0) ? jmin (wheelIncrementY, -1.0f) : jmax (wheelIncrementY, 1.0f); } Point<int> pos (getViewPosition()); if (wheelIncrementX != 0 && wheelIncrementY != 0 && hasHorzBar && hasVertBar) { pos.setX (pos.x - roundToInt (wheelIncrementX)); pos.setY (pos.y - roundToInt (wheelIncrementY)); } else if (hasHorzBar && (wheelIncrementX != 0 || e.mods.isShiftDown() || ! hasVertBar)) { if (wheelIncrementX == 0 && ! hasVertBar) wheelIncrementX = wheelIncrementY; pos.setX (pos.x - roundToInt (wheelIncrementX)); } else if (hasVertBar && wheelIncrementY != 0) { pos.setY (pos.y - roundToInt (wheelIncrementY)); } if (pos != getViewPosition()) { setViewPosition (pos); return true; } } } return false; }