Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image: Zoom out action disabled when fully zoomed in #4400

Closed
ewenjo opened this issue May 15, 2023 · 1 comment · Fixed by #4401
Closed

Image: Zoom out action disabled when fully zoomed in #4400

ewenjo opened this issue May 15, 2023 · 1 comment · Fixed by #4401
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@ewenjo
Copy link
Contributor

ewenjo commented May 15, 2023

Describe the bug

Both image zoom actions are disabled when either zoom limit is reached.

This causes a bug where you won't be able to zoom out when the image is fully zoomed in, and vise versa. Attempting to press the zoom out button will close the preview instead.

 const zoomDisabled = scaleState <= 0.5 || scaleState >= 1.5;
<button className="p-image-action p-link" onClick={zoomOut} type="button" disabled={zoomDisabled}>
  {zoomOutIcon}
</button>
<button className="p-image-action p-link" onClick={zoomIn} type="button" disabled={zoomDisabled}>
   {zoomInIcon}
</button>

Reproducer

No response

PrimeReact version

9.4.0

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

1: Create an image component
2: Preview the image
3: Fully zoom in
4: Attempt to zoom out

Expected behavior

You should be able to zoom out when the image is fully zoomed in.

 const zoomOutDisabled = scaleState <= 0.5;
 const zoomInDisabled =  scaleState >= 1.5;
<button className="p-image-action p-link" onClick={zoomOut} type="button" disabled={zoomOutDisabled}>
  {zoomOutIcon}
</button>
<button className="p-image-action p-link" onClick={zoomIn} type="button" disabled={zoomInDisabled}>
   {zoomInIcon}
</button>
@ewenjo ewenjo added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 15, 2023
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 15, 2023
@melloware melloware self-assigned this May 15, 2023
@melloware melloware added this to the 9.5.0 milestone May 15, 2023
melloware added a commit to melloware/primereact that referenced this issue May 15, 2023
@melloware
Copy link
Member

Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants