Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

310
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda