Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

307
Views
Cropperjs: Move and resize cropped area

What is a proper way to "restore" a crop box rectangle (or square) when cropperjs ready for use?

I have a global variable details which stores every position changes. Then I can use it to restore the previous position (size, offset, scale and etc). I know the way how to get that data (from crop() method), but I don't understand how to set it and move, scale crop box to the previous position (crop box — I mean the area over the image that you can resize, stretch when defining the region for cropping)

// gloval variable
let details;

// ...

cropper = new Cropper(document.querySelector("#image"), {
    viewMode: 3,
    zoomable: false,
    aspectRatio: 1,
    ready() {
        if (details) {
            // ... restore previous crop box position
        }
    },
    crop(event) {
        console.log(event.detail.x);
        console.log(event.detail.y);
        console.log(event.detail.width);
        console.log(event.detail.height);
        console.log(event.detail.rotate);
        console.log(event.detail.scaleX);
        console.log(event.detail.scaleY);

        details = event.detail;
    },
});

// ...

Can you advice me the proper way for it. I am using v1.5.12

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!