简体   繁体   English

HTML5 Canvas绘制图像后能否放大/缩小?

[英]HTML5 Canvas ability to zoom in/out after drawing images?

My app is based on users placing images on a canvas (via functions I created that use lineTo(), and arc() to create complicated shapes) and then letting them zoom out so get a higher-level picture of what they've done. 我的应用程序基于用户将图像放置在画布上(通过我创建的使用lineTo()的函数和arc()来创建复杂的形状)然后让它们缩小以获得更高级别的图片,了解他们已完成的工作。 Similarly they can load somebody else's creation and zoom-in to see at a lower level what all these objects looks like in more detail. 同样,他们可以加载其他人的创建和放大,以更详细地查看所有这些对象的外观。

Is this possible? 这可能吗? When I think zoom, I'm thinking google-maps type zoom. 当我想放大时,我在想谷歌地图类型缩放。

If it's not possible, are there other solutions, like using regular images and re-sizing part of the page? 如果不可能,是否有其他解决方案,例如使用常规图像和重新调整页面的一部分?

Thank you for any help. 感谢您的任何帮助。

So this is what you are thinking of: scale() . 所以这就是你的想法: scale()

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM