Skip to content

state issue when using zoomIn/zoomOut map methods #1158

@Tim-Gaud

Description

@Tim-Gaud

I'm using map.zoomIn() and map.zoomOut() to create custom zoom controls. But when clicking multiple times in quick succession on the zoom in button, the 2nd click changes the map centre. When doing the same on the zoom out button, the 2nd click changes the centre and zooms back in.

Minimal reproduction -> https://codesandbox.io/p/sandbox/epic-proskuriakova-wkpdpc?file=%2Fsrc%2Fzoom-controls.tsx%3A10%2C36-10%2C42

The issue only happens on the 2nd click when clicking multiple times in quick succession.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions