HTML5 canvas ability to zoom in / out after drawing images?

My application is based on the fact that users place images on the canvas (through the functions I created that use the lineTo () and arc () functions to create complex shapes) and then allow them to zoom out to get a higher-level image of what they Done. In the same way, they can load someone else creating and scaling to see at a lower level that all of these objects look in more detail.

Is it possible? When I think of scaling, I think of scaling like google-maps.

If this is not possible, are there other solutions, such as using regular images and reformatting part of the page?

Thanks for any help.

+4
source share
1 answer

So here is what you are thinking: scale() .

 ctx.save(); ctx.scale(2,2); //zoom-in doMyComplexShape(); ctx.restore(); 
+3
source

Source: https://habr.com/ru/post/1415856/


All Articles