Skip to content

Can I set a min/max zoom for the camera? #46

@AnEpicName

Description

@AnEpicName

I want to have a limit for the camera zoom, something like maxZoom = 20 and minZoom = 7.

So far I've forced this behaviour in the onCameraChangeListener event by doing this:

 await mapboxMap!.getCameraState().then((value) {
            if (zoom >= minZoom) {
              zoom = value.zoom;
            } else {
              zoom = minZoom;
              mapboxMap!.setCamera(CameraOptions(zoom: minZoom));
            }
          });

But it doesn't feel "clean", because every time I try to go over the threshold, the map starts to "vibrate". Is there a better way to do this? Or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions