2

I am currently working with a canvas that holds shapes. So I want to be able to keep the shapes size while zooming in or out. I think that I need to know the canvas scale or the dpi, so I can recalculate the shape dimensions. My questions

  • Is there better solution for that?
  • If I am on the good track how can I get the current scale of a canvas? I am looking for something like in the code below. let scale = ctx.getCurrentScale();.

Thanks for your help.

Ataline
  • 23
  • 1
  • 4

1 Answers1

0

No long ago I had an issue, and Clemens helped me with that :

Zoom on Canvas, centered on mouse position

take his solution then "play" with it it will help you understand better.

Siegfried.V
  • 1,508
  • 1
  • 16
  • 34