I was following the document https://doc.babylonjs.com/divingDeeper/cameras/customizingCameraInputs and this playground demo https://playground.babylonjs.com/#KHQBRL and getting some weird behavior when using mac trackpad. I think the behavior should be the camera only rotate if you click hold and rotate, but on the trackpad sometimes you click and drag for a bit then release, the camera will keep rotating with your cursor even you are not pressing the trackpad. I only have a mac so not sure if that happens to all the trackpads or just mac. (one small tip I found out, try to click the middle area of the trackpad and drag). I wonder if that’s a bug or just triggered some gestures for apple trackpad
Based on what I’m seeing, it looks like there a flaky response from event listeners for pointerup. I was able to repro this with a mouse so I don’t think that it’s exclusive to trackpads but I think that it’s safe to say that this is an issue on Safari/MacOS. I’m gonna keep digging and update this thread when I find the root cause.
So I’ve found the root cause. The issue is inside of our move code. When you let go of the mouse button while moving, our code treats the button up as part of a pointermove event (Safari only) and also sends out a pointerup event with the button release. This is exclusively in Safari because of how they handle pointer events. When any other browser has a move event with a button already pressed (dragging), the event’s button value will be -1, while the buttons value will be a number that represents which buttons are pressed (none is 0). In Safari, the default value isn’t -1 but 0. In addition, the button value will always be the first button pressed while dragging. I am working on a fix now.
Hey @xtxz, I initially had a fix but it is breaking something in other camera movements so I’m just quickly fixing that up and finishing up my testing. Fix should be up in the next day or so. I’ll post when the PR is live.
Thank you very much! Also I wonder if this PR will also fix the problem with Arcrotate camera on safari. See https://playground.babylonjs.com/#SRZRWV#1 It has a different behavior with trackpad control(hasn’t test mouse but I assume it will be the same) using chrome vs safari