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

146
Vistas
How to toggle borders and controls of Fabric.js objects during image save?

I would like to create a fabric.js canvas, move some content around and then save the canvas as image. It has been done before (Fabric.js demo Objects Bounding Rectangles, save), but how do I update borders and controls to hidden during saving of the image?

I tried this, but it's not removing the border. And how do I re-instate it after save?

canvas.forEachObject(function (obj) {
    obj.hasBorders = false;
    obj.hasControls = false;
});
canvas.discardActiveObject();
canvas.renderAll();
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I found out that the border is manually created by the demo, so I just had to remove that part:

canvas.on('after:render', function () {
    canvas.contextContainer.strokeStyle = '#555';

    canvas.forEachObject(function (obj) {
        var bound = obj.getBoundingRect();

        canvas.contextContainer.strokeRect(
            bound.left + 0.5,
            bound.top + 0.5,
            bound.width,
            bound.height
        );
    })
});
about 4 years ago · Juan Pablo Isaza Denunciar
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