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

Rotated and flipped image handling #4

Open
teknetia opened this issue May 3, 2023 · 0 comments
Open

Rotated and flipped image handling #4

teknetia opened this issue May 3, 2023 · 0 comments

Comments

@teknetia
Copy link

teknetia commented May 3, 2023

I've been using this project on a small project which required the ability to flip and rotate images due to original uploads not always being in a sensible orientation.

Currently I make these changes by passing in CSS transforms:

:global(.magnifier-image) {
  transform: rotate(var(--rotation)) scaleX(var(--flip-horizontal)) scaleY(var(--flip-vertical));
}

:global(.magnifying-glass) {
  transform: rotate(var(--rotation)) scaleX(var(--flip-horizontal)) scaleY(var(--flip-vertical));
}

Because these transforms don't change the way calculations are performed, it means that a flipped image will move around "backwards" (e.g., moving the mouse left will show the right area magnified). Rotated images are even messier because of the change in dimensions causing a squashed effect.

Is it possible for the component to handle these cases in a native way so that the magnifier can appropriately re-calculate based on the current image position?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant