<aside> 💡 Description: Commands and examples which shows how to disable mobile gesture controls like moving, scaling and rotation the scene in the mobile experience.
</aside>
gestureContainer
- pinch and drag event group.
Prevent Scaling
const gestureContainer = this.activeSceneModel.scene.children[0].children[1].children[0].children[0];
const render = () => {
if (gestureContainer.scale.x !== 1) {
gestureContainer.scale.set(1, 1, 1);
}
// this.activeSceneModel.emitter.emit('on-scale-reset'); // Optional event for scaling reset
}
this.activeSceneModel.userCallbacks.onRender = render;
Prevent Rotation
const gestureContainer = this.activeSceneModel.scene.children[0].children[1].children[0].children[0];
const render = () => {
if (gestureContainer.rotation.y !== 0) {
gestureContainer.rotation.set(0, 0, 0);
}
// this.activeSceneModel.emitter.emit('on-rotation-reset'); // Optional event for rotation reset
}
this.activeSceneModel.userCallbacks.onRender = render;
Prevent Dragging
const gestureContainer = this.activeSceneModel.scene.children[0].children[1].children[0].children[0];
const render = () => {
if (gestureContainer.position.x !== 0 || gestureContainer.position.z !== 0) {
gestureContainer.position.set(0, 0, 0);
}
// this.activeSceneModel.emitter.emit('on-position-reset'); // Optional event for scaling reset
}
this.activeSceneModel.userCallbacks.onRender = render;
Later will be possible to change it through:
this.activeSceneModel.setGestureOption('gestureOn', false);
this.activeSceneModel.setGestureOption('dragOn', false);
this.activeSceneModel.setGestureOption('scaleOn', false);
this.activeSceneModel.setGestureOption('rotateOn', false);
this.activeSceneModel.setGestureOption('minScaleLimit', 0.05);
this.activeSceneModel.setGestureOption('onPinchListener', true);
gestureOn
- completely disable Gesture Control if false