Skip to content

Rotated and flipped image handling #4

Open
@teknetia

Description

@teknetia

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?

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