简体   繁体   English

Phonegap捏和缩放以缩放画布

[英]Phonegap pinch and zoom to scale canvas

So I recently found out that an HTML5 canvas has maximum dimensions. 因此,我最近发现HTML5画布具有最大尺寸。 This makes sense for memory and efficiency reasons. 出于内存和效率方面的考虑,这是有意义的。 What would be the smoothest way to scale a context within a canvas element in phone gap. 在电话间隙的画布元素中缩放上下文的最流畅方法是什么。 For example, how would I create an infinite pannable and zoomable canvas, similar to google maps? 例如,如何创建类似于Google地图的无限可缩放和可缩放的画布?

You can use javascript to handle multi-touch gestures. 您可以使用javascript处理多点触控手势。 There are plenty of libraries that make this easier to do. 有很多库使此操作更容易。 Sencha touch , or Hammer.js being examples of this. Sencha touchHammer.js就是这样的例子。 Then you would have to scale down your content on your canvas accordingly. 然后,您将不得不相应地缩小画布上的内容。

As for something specific to canvas, it will be a little heavier, but I would suggest something like: KineticJS 至于特定于画布的内容,它会稍重一些,但我建议使用以下内容: KineticJS

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

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