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

149
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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