我有一个带有SpriteKit场景的NSViewController / NSView,它填充了整个视图。这是我需要处理的事件:
override func mouseDown(with event: NSEvent) {
override func rightMouseDown(with event: NSEvent) {
override func otherMouseDown(with event: NSEvent) {
override func mouseDragged(with event: NSEvent) {
override func rightMouseDragged(with event: NSEvent) {
override func otherMouseDragged(with event: NSEvent) {
但是它们非常不一致,而且我根本无法使rightMouseDragged正常工作。
mouseDown works fine in the SKScene
rightMouseDown works fine in the SKScene
otherMouseDown had to be implemented in the viewController and passed on to the scene
mouseDragged worked fine in the SKScene
rightMouseDragged is not working at all
otherMouseDragged had to be implemented in the viewController and passed on to the scene
我的主要需求是修复rightMouseDragged。它在视图控制器或场景控制器中均不接收任何拖动事件。
最佳答案
好的,我不明白为什么,但是rightMouseDragged被传递给了SKView。所以这是我需要实现事件处理程序的地方:
mouseDown in the SKScene
rightMouseDown in the SKScene
otherMouseDown in the viewController and passed on to the scene
mouseDragged in the SKScene
rightMouseDragged in the SKView and be passed to the scene
otherMouseDragged in the viewController and passed on to the scene
关于swift - Swift MacOS SpriteKit rightMouseDragged不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55269624/