Scale Gizmos When Cursor Goes Off/On Canvas

I’ve noticed when using the gizmos (basic PG here https://playground.babylonjs.com/#4TBMBR#33) that if you grab the scale handle and drag the mouse to such an extent that the mouse leaves the canvas itself, like for example up to the URL bar, or even if you drag the mouse over an overlaid DOM element in the scene, then the scale gizmo stops responding. This maybe makes sense, but then when I let go of a scaling mouse drag when it is off the babylon canvas, and then move the mouse back to the canvas, the scale gizmo starts responding to my mouse movement - even though I’m not dragging or holding my mouse anymore. It can actually be kind of difficult to get the gizmo to stop responding to my mouse movement - I have to click on the scale handle again. This is difficult because my scale factor is set pretty high, so moving the mouse scales the object quite a bit and it’s hard to get my cursor to exactly align with the handle.

Do you suggest any way to deal with this behavior? I think ideally, if the mouse drag extends beyond the babylon canvas and I let go of the drag, the scale gizmo would just set at its last determined value, and then moving my mouse back onto the canvas wouldn’t cause the gizmo to manipulate.

Might be a good one for @Cedric

1 Like

The same thing happens with UI Sliders. If you drag a slider and move the mouse off-screen it gets stuck to your mouse when you return to the canvas https://www.babylonjs-playground.com/#BXMTCD#95

EDIT: Related thread PointerDragBehavior doesn't cancel drag when you mouse up outside the canvas

1 Like

This has more to do with events than gizmo. @PolygonalSun how is it possible to capture mouse events until button is released?

Hey @Knar, I believe this behavior is fixed in 5.0.0-alpha.16.

3 Likes