Created
April 15, 2014 11:15
-
-
Save karliky/10723840 to your computer and use it in GitHub Desktop.
CocoonJS touch events test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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