To scroll a SKNode (called scroller) within a SKScene (called menuScene), I'm doing the following, which works perfectly but I'm not sure if it's the correct way to achieve this.
Within the NSViewController class, I'm overriding the scrollWheel event to call the scene's own scrollWheel event:
override func scrollWheel(with event: NSEvent) {
skView?.scene?.scrollWheel(with: event)
super.scrollWheel(with: event)
}
Then, within menuScene, the function is simply:
override func scrollWheel(with event: NSEvent) {
scroller.position.x = scroller.position.x + (event.deltaX*3)
}
This works perfectly, but is there a better way to achieve the same goal?