Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

317
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!