Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

305
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda