除了缩放画布外,我让我的KineticJS游戏在CocoonJS中运行得非常好.我有1024x768的画布,非常适合iPad 2.但对于iPad 4,由于视网膜屏幕,游戏只占屏幕的1/4.
CocoonJS说这个缩放:
CocoonJS automatically scales your main canvas to fill the whole screen while you still
continue working on your application coordinates. There are 3 different ways to specify how
the scaling should be done:
idtkScale
'ScaleToFill' // Default
'ScaleAspectFit'
'ScaleAspectFill'
canvas.style.cssText="idtkscale:SCALE_TYPE;"; // The SCALE_TYPE can be any of
the ones listed above.
Run Code Online (Sandbox Code Playgroud)
我试过这个添加这个:
layer.getCanvas()._canvas.style.cssText='idtkScale:ScaleAspectFit;';
Run Code Online (Sandbox Code Playgroud)
但它没有用.知道如何让KineticJS在CocoonJS中创建Canvases吗?