<commit_before>(function(oCanvas, window, document, undefined){
	
	// Define the class
	var touch = function () {
		
		// Return an object when instantiated
		return {
			// Method used by oCanvas to give this object access to the current instance of the core object
			setCore: function (thecore) {
				this.core = thecore;
			},
			
			// List of all events that are added
			eventList: {
				touchstart: [],
				touchend: [],
				touchmove: [],
				touchenter: [],
				touchleave: [],
				tap: []
			},
			
			last_event: {},
			
			// Method for initializing the module
			init: function () {
				var _this = this,
					core = this.core,
					canvasElement = core.canvasElement,
					types,
					isTouch = ("ontouchstart" in window || "createTouch" in document);
				
				// Register pointer
				core.events.types.touch = types = ["touchstart", "touchend", "touchmove", "touchenter", "touchleave", "tap"];
				core.events.pointers.touch = function (type, doAdd) {
					if (~types.indexOf(type) && isTouch) {
						doAdd("touch", "tap");
					}
				};
				if (isTouch) {
					core.pointer = this;
					
					// Set iOS specific settings to prevent selection of the canvas element
					canvasElement.style.WebkitUserSelect = "none";
					canvasElement.style.WebkitTouchCallout = "none";
					canvasElement.style.WebkitTapHighlightColor = "rgba(0,0,0,0)";
				}
				
				// Define properties
				this.x = 0;
				this.y = 0;
				this.touchState = 'up';
				this.canvasFocused = false;
				this.canvasHovered = false;
				this.cancel();
				
				// Add event listeners to the canvas element
				canvasElement.addEventListener('touchmove', function (e) { _this.touchmove.call(_this, e); }, false);
				canvasElement.addEventListener('touchstart', function (e) { _this.touchstart.call(_this, e); }, false);<commit_msg>Changed the start value of the touch module's x/y properties. This fixes problems with onCanvas() that returned true on non-touch devices, and also true on touch devices before the finger has touched the canvas.<commit_after>(function(oCanvas, window, document, undefined){
	
	// Define the class
	var touch = function () {
		
		// Return an object when instantiated
		return {
			// Method used by oCanvas to give this object access to the current instance of the core object
			setCore: function (thecore) {
				this.core = thecore;
			},
			
			// List of all events that are added
			eventList: {
				touchstart: [],
				touchend: [],
				touchmove: [],
				touchenter: [],
				touchleave: [],
				tap: []
			},
			
			last_event: {},
			
			// Method for initializing the module
			init: function () {
				var _this = this,
					core = this.core,
					canvasElement = core.canvasElement,
					types,
					isTouch = ("ontouchstart" in window || "createTouch" in document);
				
				// Register pointer
				core.events.types.touch = types = ["touchstart", "touchend", "touchmove", "touchenter", "touchleave", "tap"];
				core.events.pointers.touch = function (type, doAdd) {
					if (~types.indexOf(type) && isTouch) {
						doAdd("touch", "tap");
					}
				};
				if (isTouch) {
					core.pointer = this;
					
					// Set iOS specific settings to prevent selection of the canvas element
					canvasElement.style.WebkitUserSelect = "none";
					canvasElement.style.WebkitTouchCallout = "none";
					canvasElement.style.WebkitTapHighlightColor = "rgba(0,0,0,0)";
				}
				
				// Define properties
				this.x = -1;
				this.y = -1;
				this.touchState = 'up';
				this.canvasFocused = false;
				this.canvasHovered = false;
				this.cancel();
				
				// Add event listeners to the canvas element
				canvasElement.addEventListener('touchmove', function (e) { _this.touchmove.call(_this, e); }, false);
				canvasElement.addEventListener('touchstart', function (e) { _this.touchstart.call(_this, e); }, false);
{'fraction_non_alphanumeric': 0.12584856396866842, 'fraction_numerical': 0.003133159268929504, 'mean_word_length': 2.8618951612903225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '597823', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1126, 'n_words': 326}