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

318
Visualizações
JavaScript canvas, drawing to 2d context. Is there really no way to get dimensions of the drawn content afterwards?

Acknowledging the rhetorical nature of this question, maybe better to ask:

Is there a work around to having to pre-analyze the size and location of and every shape and image being drawn to a 2d context to extract the maximum extents of the final drawing?

This seems to be the requirement in order to determine the proper scaling factor for the final context to ensure that nothing is drawn outside the canvas border, if so desired.

For drawings with a multitude of overlapping shapes and images, this seems like excessive computational overhead. As opposed to simply analyzing the resulting 1:1 "window image" once for the used pixel width and height.

Vice-versa, if the drawing is smaller than the canvas and you want to zoom to fill instead.

An zoom-to-extents function built into the canvas would be nice.

Is there a another way to do this?

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