Skip to content

Zoom In / Zoom Out API calls don't behave as expected depending on initialZoomLevel #59

@vicatcu

Description

@vicatcu

Describe the bug
With the following configuration:

  panZoomConfig: PanZoomConfig = new PanZoomConfig({
    panOnClickDrag: true,
    zoomOnDoubleClick: true,
    zoomOnMouseWheel: true,
    initialZoomLevel: 5,
  });

Calling api.zoomOut() initially works, but then right afterward calling api.zoomIn() does not do anything. Calling api.zoomIn() initially actually causes it the image to zoom out.

It behaves as expected with { initialZoomLevel: 3 }, but not with { initialZoomLevel: 5 }

Reduced Test Case
https://stackblitz.com/edit/ngx-panzoom-test-10-2-s6zgpf

To Reproduce
Steps to reproduce the behavior:

  1. Click Zoom In button
  2. Observe it actually Zooms Out
  3. Refresh the page
  4. Click the Zoom Out button
  5. Click the Zoom In button
  6. Observe it stays at the current Zoom level
  7. Click Zoom Out button again
  8. Click Zoom In button again
  9. That works as expected

Expected behavior
I expect api.zoomIn to always Zoom In at up to some limit (e.g. initial zoom).
I expect to be able to get back to the initial zoom level by using api.zoomIn.

Screenshots
Not applicable

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Browser: Chrome
  • Version: 114.0.5735.198 (Official Build) (64-bit)

Smartphone (please complete the following information):
N/A

Additional context
N/A

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