Disable Zomm with ctrl + to my scene

hello ,

i’m working with babylonjs and i want to disabled the zoom with ctrl + to my playground
PG : https://www.babylonjs-playground.com/#31M2AP#97

thanks for help :slight_smile:

ctrl + is a browser feature and not a babylon feature. We won’t add those kind of hacks globally to the playground, but you can add it yourself:

or:

1 Like

thanks for the reponse @RaananW , i have already used this solution , but not working still anable to add CTRL + after showing popups :confused:

It’s a bit out of scope of this forum, but if you want to show an example of code that partly works, please go right a head, we might be able to help!

1 Like

thanka a lot @RaananW :)))

just use event.preventDefault()
This works when canvas has focus;
https://www.babylonjs-playground.com/#31M2AP#120

use window.addEventlistener for entire page.
(Note; In PG this will add a new eventListener every time you click run without disposing the old one!)
https://www.babylonjs-playground.com/#31M2AP#121

1 Like

thanks a lot @aWeirdo , it’s still just the control the zoom in/out with CTRL+ mouse wheel .

thanks a lot another time :slight_smile:

@Viche same method can be applied to wheel events,
https://playground.babylonjs.com/#20OAV9#2432

1 Like

so CTRL + wheel still juste doing simple Zoom in/out to scene ? it’s possible to not doing anything with CTRL+ wheel ?

You can completely disable the mouse wheel with camera.inputs.remove(camera.inputs.attached.mousewheel);

If you still want the zoom in/out with the wheel but not with ctrl+wheel, I think you will have to track the ctrl key state in a keyboard handler and add a mouse handler where you disable the wheel action when the ctrl key is down.

1 Like

thanks a lot amigo :slight_smile:

doc: Customize Camera Inputs - Babylon.js Documentation

1 Like