Hello BJS community!
I’m on the latest commit in master branch, though the problem appears to be there for a few months I believe.
The steps:
- Open any Playground with rotation camera. e.g. this one.
- Press and hold left mouse button
- Without releasing left mouse button press right mouse button
- Release left mouse button
- Release right mouse button
Bug!
Now you can rotate the camera without pressing mouse buttons.
This happens because in scene.inputManager
eventData.inputIndex
is considered to be PointerInput.FakeMove
which is triggered when two mouse buttons are pressed.
I’m talking about this line specifically
@Eugene_R, this is an awesome repro and I ll send it over @PolygonalSun to have a loook tomorrow, thanks a ton for the detailed repro !!!
Great find! I’m gonna take a look at this today and figure out what’s going on.
3 Likes
I’ve decided to test it on the fresh alpha.33 and the camera doesn’t get stuck though the buttons still seem to not behave exactly as intended. E.g. in arc rotate camera PG you can
- press left mouse button
- without releasing press right mouse button
- release left mouse button
You can rotate with right mouse button. Could you confirm that still seems like a bug?
The same goes for panning. RMB first and then LMB.
1 Like
Sounds like by design to me
I wonder which makes more sense ? @PatrickRyan Basically, as long as you are pressed you continue the current behavior.
@sebavan, I don’t think this is the best behavior. I agree with the idea that if you press left button first, adding right button down would not cancel the rotation of the camera while left button is still down. However, releasing the left button should cancel the rotation of the camera and then the question is what happens with the right button down input.
We have two options:
- Any subsequent mouse input after the first is ignored while the first action is still live. For example, if you press left mouse, camera rotates. Then if you add right mouse, camera still rotates. When you release left button, nothing happens as the right button down was called when in an ignore state. So to pan you would need to release the right button and press again.
- Any subsequent mouse input after the first is added to the stack. Left mouse press rotates camera, then right button pressed adds the pan action to the stack waiting for rotate to end. Once rotate ends with the left button up, we check to see if right button is still down and if so immediately start panning.
I could see either of those behaviors not being too disruptive to the experience. With the first the user would probably realize quickly that they can’t press both buttons at once, which seems reasonable. With the second, the user won’t really notice anything as the experience will seems very responsive since it knows the order in which the user sends input to the system. The second seems like a more complex solution however, but I will leave that up to you to decide which is the more sustainable route with fewer edge cases.
Yup let s stick with option 1 and see when @PolygonalSun is back to introduce the fix.
2 Likes
@sebavan @PolygonalSun
Hey guys. Are there any news on this one?
This issue arises in our project quite often and in a more unpleasant form due to slightly modified controls.
Would be really happy if it is resolved according to the discussed behavior.
I’m looking at implementing option 1 though it may require additional testing and time because we’re effectively changing the original behavior. In any case, I’ve created the an issue (Rotation on ArcRotateCamera continues when button is released if another button is still active · Issue #10856 · BabylonJS/Babylon.js · GitHub) so that it’s progress can be tracked.
3 Likes
I have a fix that should change the behavior but some of our pointer unit tests are failing so I am just verifying if the tests need to be changed or if my fix is missing something. I’ll let you know when I get the PR up.
1 Like
Thanks a ton! I greatly appreciate your taking the time to resolve this stuff.