Allow for scrolling around the chart on MacOS using two-finger trackpad scrolling, which is a more natural interaction than having to click and drag.
Implementation Details :construction:
Being new to this library, I may not be doing this the most elegant way, but I added override func scrollWheel(with:) to BarLineChartViewBase, and wrapped it with #if os(macOS). To implement the scrollWheel function, I mostly copied panGestureRecognized(_:), removing options that seemed specific to GestureRecognizer implementations, and replacing the translation and velocity calculations with NSEvent versions. The end result is that you can pan around in the view using two-finger trackpad scrolling.
Testing Details :mag:
I tested by using the ChartsDemo-macOS app in both BarDemoViewController and LineDemoViewController, each with and without dragDecelerationEnabled, to zoom and scroll. It was very simple testing, but it seemed to work.
Goals :soccer:
Allow for scrolling around the chart on MacOS using two-finger trackpad scrolling, which is a more natural interaction than having to click and drag.
Implementation Details :construction:
Being new to this library, I may not be doing this the most elegant way, but I added
override func scrollWheel(with:)
toBarLineChartViewBase
, and wrapped it with#if os(macOS)
. To implement the scrollWheel function, I mostly copiedpanGestureRecognized(_:)
, removing options that seemed specific to GestureRecognizer implementations, and replacing the translation and velocity calculations withNSEvent
versions. The end result is that you can pan around in the view using two-finger trackpad scrolling.Testing Details :mag:
I tested by using the
ChartsDemo-macOS
app in bothBarDemoViewController
andLineDemoViewController
, each with and withoutdragDecelerationEnabled
, to zoom and scroll. It was very simple testing, but it seemed to work.