Post marked as solved
Click to stop watching this thread.
You have stopped watching this post. Click to start watching again.
Post marked as solved with 3 replies, 0 views
I've removed checking for mouse button presses inside the mouse moved event, I noticed that though the method is guaranteed to be called on move events no matter where the move originated, the handler called used is not guaranteed to be the same handler for the device that originated the event. For example, when clicking and dragging from a device that's not current, the move handler used is the handler of the current device giving inaccurate button information inside the move callback
mouseInput.mouseMovedHandler = { (input, deltaX, deltaY) in
if (self.cameraRotationEnabled) {
let delta: SIMD2<Float> = [deltaX, deltaY]
self.cameraManager.current.rotate(delta: delta)
}
}
mouseInput.leftButton.valueChangedHandler = { (button, value, pressed) in
self.cameraRotationEnabled = pressed
}
mouseInput.scroll.valueChangedHandler = { (dpad, deltaX, deltaY) in
self.cameraManager.current.zoom(delta: deltaY)
}