Camera pan getting stuck in Firefox

Hi,
I dont know if this is a bug in Firefox or Babylon.js. It’s best demonstrated with ArcRotateCamera but the same behaviour occurs even with FreeCamera in the default PG scene.

steps to reproduce

Expected behaviour

  • camera stops panning after mouse LMB is released

Current behaviour

  • camera keeps panning even with the LMB released

If this issue is caused by FF (most likely, as it doesnt happen in other browsers), what can be done to fix this behaviour? Thanks.

A similar issue happens with a gizmo, this one is across all browsers (FF, Safari, Chromium):

  • attach a position gizmo to mesh (PG sample)
  • start dragging the mesh via the gizmo by holding a LMB
  • move the mouse cursor away from the active gizmo (ie. if you are dragging mesh horizontally, move the cursor vertically)
  • start holding a RMB
  • release the LMB (and subsequently the RMB)

At this point I’d expect the gizmo dragging action will be terminated, but it remains active :thinking:

Failed to reproduce the problem on windows with FF136, I guess there is something different on actions from windows and mac

cc @amoebachant

I’ll look into this, thanks!

1 Like

Hi @yedpodtrzitko,
I investigated this bug, and it does appear that while Firefox on MacOS intentionally reports the right mouse button in pointer events when control is held down, it doesn’t ensure that the button is consistent if you release control during a drag, so you can get a pointer down on the right button and pointer up on the left button. I think it should “lock in” whichever button you are using at the beginning of the drag and keep it consistent throughout the drag. I suggest you report that Firefox bug to Mozilla.

In the meantime, I’ve merged a workaround to ensure that our cameras handle this specific situation: Fix camera behavior on Firefox on MacOS when using CTRL while draggin… · BabylonJS/Babylon.js@1297aaa · GitHub

Thanks again for reporting this!

2 Likes

@yedpodtrzitko - thanks for reporting the gizmo drag issue too! It had a different root cause, and I just fixed it with this commit: Fix gizmo drag when a second mouse button is pressed during the drag … · BabylonJS/Babylon.js@9bf391f · GitHub

2 Likes

Thank you. I have noticed the commits, however I havent an opportunity to test the fix yet.