CodeEditorComponent, scrolling


#1

Is there any way I override mouseWheelMove() and scroll by position rather than by line? My current approach works something like this, but it’s a little jumpy:

void CabbageCodeEditorComponent::mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& mouse)
{
        const int numberOfLinesToScroll = owner->settings->getUserSettings()->getIntValue ("numberOfLinesToScroll");

        if (mouse.deltaY < 0)
        {
            scrollBy (numberOfLinesToScroll);
            currentLineMarker.setTopLeftPosition (13, currentLineMarker.getY() - numberOfLinesToScroll * getFontSize());
        }
        else
        {
            scrollBy (-numberOfLinesToScroll);
            currentLineMarker.setTopLeftPosition (13, currentLineMarker.getY() + numberOfLinesToScroll * getFontSize());
        }
}

The JUCE::CodeEditorComponent doesn’t scroll by lines, it scrolls by position, which is much smoother. But I can’t access the scrollbars or viewport? Any ideas?