Parameter 'disableZoom = false' does nothing.
I'm trying to use a model on my Android application, the model works pretty well, but I can't disable the zoom from the disableZoom parameter, code bellow:
ModelViewer(
autoRotate: true,
autoRotateDelay: 0,
cameraControls: false,
disableZoom: true,
rotationPerSecond: "120deg",
src: modelPath,
),
My temporary workaround was to use AbsorbPointer class on the model, but in this way we lose every pointer in the model.
Doctor summary (to see all details, run flutter doctor -v):
- [√] Flutter (Channel stable, 3.0.1, on Microsoft Windows [versÆo 10.0.22000.856], locale pt-BR)
- [√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
- [√] Chrome - develop for the web
- [!] Visual Studio - develop for Windows (Ferramentas de Build do Visual Studio 2019 16.11.15)
- X The current Visual Studio installation is incomplete. Please reinstall Visual Studio.
- [√] Android Studio (version 2021.1)
- [√] VS Code (version 1.70.1)
- [√] Connected device (4 available)
- [√] HTTP Host Availability
According to model-viewer offical documents:
disable-zoom
Disables user zoom when camera-controls is enabled (has no effect otherwise). Has the secondary effect of not swallowing mouse wheel events and pinch gestures, so these will then scroll and zoom the page, respectively.
So I think you should try to set cameraControls from false to true first😉
Unfortunately it still doesn't work, here's the case:
- First I have a page with a auto rotating model (the code on the issue), with a AbsorbPointer as a workaround.
- Second I have a rest controllable model (just waiting a pointer on it) in code language
cameraControls: true, but even with that line still possible to zoom it with a "pincer" gesture. Sadly.
The code:
ModelViewer(
cameraControls: true,
disableZoom: true,
src: modelPath,
),
Maybe is from WebView zoom, but still a zoom anyways.