Skip to content

Instantly share code, notes, and snippets.

@karliky
Created April 15, 2014 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karliky/10723840 to your computer and use it in GitHub Desktop.
Save karliky/10723840 to your computer and use it in GitHub Desktop.
CocoonJS touch events test
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
window.onload = function(){
var canvas, context;
var System = function(){
canvas = document.createElement("canvas");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
context = canvas.getContext("2d");
context.fillStyle = "#ffffff";
context.font = "bold 70px Arial";
document.body.appendChild(canvas);
canvas.addEventListener("touchstart", this.tStart);
canvas.addEventListener("touchend", this.tEnds);
};
System.prototype.tStart = function(e){
console.log("tStart");
context.fillText("WAT", e.touches[0].pageX, e.touches[0].pageY);
};
System.prototype.tEnd = function(e){
console.log("tEnd");
};
new System;
}
</script>
</head>
<body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment