Update viewer.js
Browse files
viewer.js
CHANGED
|
@@ -78,6 +78,15 @@ export async function initializeViewer(config, instanceId) {
|
|
| 78 |
e.preventDefault(); // Only block page scroll if mouse is over viewer
|
| 79 |
}, { passive: false });
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
progressDialog.style.display = 'block';
|
| 82 |
|
| 83 |
if (!pc) {
|
|
@@ -180,6 +189,14 @@ export async function initializeViewer(config, instanceId) {
|
|
| 180 |
});
|
| 181 |
cameraEntity.script.create('orbitCameraInputMouse');
|
| 182 |
cameraEntity.script.create('orbitCameraInputTouch');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
app.root.addChild(cameraEntity);
|
| 184 |
|
| 185 |
app.resizeCanvas(viewerContainer.clientWidth, viewerContainer.clientHeight);
|
|
|
|
| 78 |
e.preventDefault(); // Only block page scroll if mouse is over viewer
|
| 79 |
}, { passive: false });
|
| 80 |
|
| 81 |
+
// après avoir créé le canvas et mis tabindex=0
|
| 82 |
+
canvas.addEventListener('keydown', (e) => {
|
| 83 |
+
if (['ArrowUp','ArrowDown','ArrowLeft','ArrowRight'].includes(e.key)) {
|
| 84 |
+
e.preventDefault();
|
| 85 |
+
}
|
| 86 |
+
});
|
| 87 |
+
canvas.focus(); // pour capter les touches dès l’ouverture (facultatif)
|
| 88 |
+
|
| 89 |
+
|
| 90 |
progressDialog.style.display = 'block';
|
| 91 |
|
| 92 |
if (!pc) {
|
|
|
|
| 189 |
});
|
| 190 |
cameraEntity.script.create('orbitCameraInputMouse');
|
| 191 |
cameraEntity.script.create('orbitCameraInputTouch');
|
| 192 |
+
cameraEntity.script.create('orbitCameraInputKeyboard', {
|
| 193 |
+
attributes: {
|
| 194 |
+
forwardSpeed: 1.2, // vitesses relatives à la distance
|
| 195 |
+
strafeSpeed: 1.2,
|
| 196 |
+
fastMultiplier: 2.5, // Shift
|
| 197 |
+
slowMultiplier: 0.5 // Ctrl
|
| 198 |
+
}
|
| 199 |
+
});
|
| 200 |
app.root.addChild(cameraEntity);
|
| 201 |
|
| 202 |
app.resizeCanvas(viewerContainer.clientWidth, viewerContainer.clientHeight);
|