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

Is it possible to set the stencil coordinates? #61

Open
Ananthumpillai opened this issue Feb 21, 2024 · 3 comments
Open

Is it possible to set the stencil coordinates? #61

Ananthumpillai opened this issue Feb 21, 2024 · 3 comments

Comments

@Ananthumpillai
Copy link

Ananthumpillai commented Feb 21, 2024

I have two input text field for entering desired height and width, can stencil be placed according to that value.

@Norserium
Copy link
Collaborator

@Ananthumpillai, yes, of course, you can set the coordinates programatically.

@Ananthumpillai
Copy link
Author

Ananthumpillai commented Feb 21, 2024

sample.webm

I want something like this
According to my height and width stencil has to relocate
@Norserium

@Norserium
Copy link
Collaborator

@Ananthumpillai, I don't get, you can set the coordinates also. For example:

const resize(width, height) => {
    if (cropperRef.current) {
        cropperRef.current.setCoordinates(({ coordinates }) => {
            width: width,
            height: height,
            left: (coordinates.left + coordinates.width / 2) - width / 2,
            top: (coordinates.top + coordinates.height / 2) - height / 2
        })
    }
};

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

2 participants