mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-02-17 16:20:13 +08:00
Add setting to disable gamepad controls
This commit is contained in:
parent
3d88d91bf0
commit
7488b73f9b
@ -490,6 +490,7 @@ const Settings = {
|
||||
Preview.all.forEach(viewport => viewport.controls.zoomSpeed = value / 100 * 1.5)
|
||||
}});
|
||||
new Setting('editor_2d_zoom_speed', {category: 'controls', value: 100, min: 10, max: 1000, type: 'number'});
|
||||
new Setting('gamepad_controls', {category: 'controls', value: true, name: 'Gamepad Controls', description: 'Use a gamepad or 3D mouse to navigate the viewport'});
|
||||
new Setting('double_click_switch_tools',{category: 'controls', value: true});
|
||||
new Setting('canvas_unselect', {category: 'controls', value: false});
|
||||
new Setting('selection_tolerance', {category: 'controls', value: 10, type: 'number', min: 1, max: 50});
|
||||
|
@ -1939,12 +1939,15 @@ class OrbitGizmo {
|
||||
window.addEventListener("gamepadconnected", function(event) {
|
||||
let is_space_mouse = event.gamepad.id.includes('SpaceMouse') || event.gamepad.id.includes('SpaceNavigator') || event.gamepad.id.includes('3Dconnexion');
|
||||
|
||||
console.log('Gamepad Connected', event);
|
||||
|
||||
let zoom_timer = 0;
|
||||
|
||||
let interval = setInterval(() => {
|
||||
let gamepad = navigator.getGamepads()[event.gamepad.index];
|
||||
let preview = Preview.selected;
|
||||
if (!document.hasFocus() || !preview || !gamepad || !gamepad.axes || gamepad.axes.allEqual(0) || gamepad.axes.find(v => isNaN(v)) != undefined) return;
|
||||
if (settings.gamepad_controls.value == false) return;
|
||||
if (!document.hasFocus() || !preview || !gamepad || !gamepad.axes || !gamepad.connected || gamepad.axes.allEqual(0) || gamepad.axes.find(v => isNaN(v)) != undefined) return;
|
||||
|
||||
if (is_space_mouse) {
|
||||
let offset = new THREE.Vector3(
|
||||
|
Loading…
Reference in New Issue
Block a user