640 * 480 고정 크기의 작은 HTML 5 canvas
응용 프로그램을 만들었습니다. 코드는 을 고려하여 작성되었습니다. 640 * 480canvas
(텍스트를 그리거나 이미지를 그리려면 고정 좌표가 사용되었습니다).Cocoon JS Canvas Scaling
ipad mini의 모든 기능, 즉 크기 조정 및 터치 좌표가 정상적으로 작동합니다.
그러나 크기 조정은 Android에서 문제입니다. 나는 CocoonJS 데모리스트도 언급했다. 그들은 특별히 안드로이드에 대해 margin:0px
을 설정했습니다.
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style type="text/css">body { margin: 0px; }</style> <!-- Android fix -->
</head>
<body>
<script src="main.js"></script>
</body>
</html>
것은 내가
context.font = '20pt Calibri';
context.fillStyle = 'rgb(250,130,50)';
context.fillText("Score : "+score,canvas.width-150,30);
점수 여기 render()
기능이 같은 코드를 사용하고 예상대로 제대로 표시되지 않습니다.
var canvas = document.createElement('canvas');
canvas.width= 640;
canvas.height= 480;
document.body.appendChild(canvas);
ctx= canvas.getContext("2d", {antialias : true });
이 사람이 뭔가를 바라는 점이나 제안이 제대로 확장 할 수 있도록 방향을 제시 할 수 :
참조 된 CocoonJs 문서는이 표기법을 따르라고? 지금 들어