<commit_before>document.getElementById("id_logic_version").innerHTML = "Logic version: 2018.11.26.10";
var canvas = document.getElementById("id_canvas");
canvas.addEventListener("touchstart", on_touch_start);
canvas.addEventListener("touchmove", on_touch_move);
canvas.addEventListener("touchend", on_touch_end);

var canvas_bounding_rect = canvas.getBoundingClientRect();


var last_pos_array = [];
//------------------------------------
function on_touch_start(e)
{
	for (var i = 0; i < e.changedTouches.length; i++){
		var context = canvas.getContext("2d");
		context.beginPath();
		context.fillStyle = "black";
		context.arc(e.changedTouches[i].pageX - canvas_bounding_rect.left,
					e.changedTouches[i].pageY - canvas_bounding_rect.top,
					10,
					0, 2 * Math.PI);
		context.fill();
		context.stroke();
		var last_pos = {x: e.changedTouches[i].pageX, 
						y: e.changedTouches[i].pageY, 
						id: e.changedTouches[i].identifier};

		last_pos_array.push(last_pos);
	}
}
//------------------------------------
function on_touch_move(e)
{
	e.preventDefault();
	
	for (var i = 0; i < e.changedTouches.length; i++){
		var j = 0;
		for (; j < last_pos_array.length; j++)
			if (last_pos_array[j].id == e.changedTouches[i].identifier)
				break;
		
		var context = canvas.getContext("2d");
		context.beginPath();
		context.lineWidth = 20;
		context.moveTo(last_pos_array[j].x - canvas_bounding_rect.left, last_pos_array[j].y - canvas_bounding_rect.top);
		context.lineTo(e.changedTouches[i].pageX - canvas_bounding_rect.left,
					e.changedTouches[i].pageY - canvas_bounding_rect.top);
		context.stroke();
		
		context.beginPath();
		context.lineWidth = 1;		
		context.fillStyle = "black";
		context.arc(e.changedTouches[i].pageX - canvas_bounding_rect.left,
					e.changedTouches[i].pageY - canvas_bounding_rect.top,
					10,
					0, 2 * Math.PI);
		context.fill();
		context.stroke();
		
		last_pos_array[j].x = e.changedTouches[i].pageX;
		last_pos_array[j].y = e.changedTouches[i].pageY;		<commit_msg>Update touch.js<commit_after>document.getElementById("id_logic_version").innerHTML = "Logic version: 2018.11.26.11";
var canvas = document.getElementById("id_canvas");
canvas.addEventListener("touchstart", on_touch_start);
canvas.addEventListener("touchmove", on_touch_move);
canvas.addEventListener("touchend", on_touch_end);

var canvas_bounding_rect = canvas.getBoundingClientRect();


var last_pos_array = [];
//------------------------------------
function on_touch_start(e)
{
	for (var i = 0; i < e.changedTouches.length; i++){
		var context = canvas.getContext("2d");
		context.beginPath();
		var last_pos = {x: e.changedTouches[i].pageX, 
						y: e.changedTouches[i].pageY, 
						id: e.changedTouches[i].identifier,
						color: get_random_color()};
		last_pos_array.push(last_pos);

		context.fillStyle = last_pos_array[last_pos_array.length - 1].color;
		context.strokeStyle = last_pos_array[last_pos_array.length - 1].color;
		
		context.arc(e.changedTouches[i].pageX - canvas_bounding_rect.left,
					e.changedTouches[i].pageY - canvas_bounding_rect.top,
					10,
					0, 2 * Math.PI);
		context.fill();
		context.stroke();

	}
}
//------------------------------------
function on_touch_move(e)
{
	e.preventDefault();
	
	for (var i = 0; i < e.changedTouches.length; i++){
		var j = 0;
		for (; j < last_pos_array.length; j++)
			if (last_pos_array[j].id == e.changedTouches[i].identifier)
				break;
		
		var context = canvas.getContext("2d");
		context.beginPath();
		context.lineWidth = 20;
		context.fillStyle = last_pos_array[j].color;
		context.strokeStyle = last_pos_array[j].color;
		context.moveTo(last_pos_array[j].x - canvas_bounding_rect.left, last_pos_array[j].y - canvas_bounding_rect.top);
		context.lineTo(e.changedTouches[i].pageX - canvas_bounding_rect.left,
					e.changedTouches[i].pageY - canvas_bounding_rect.top);
		context.stroke();
		
		context.beginPath();
		context.lineWidth = 1;		
		context.fillStyle = last_pos_array[j].color;
		context.strokeStyle = last_pos_array[j].color;

		context.arc(e.changedTouches[i].pageX - canvas_bounding_rect.left,
					e.changedTouches[i].pageY - canvas_bounding_rect.top,
					10,
					0, 2 * Math.PI);
		context.fill();
		context.stroke();
		
		last_pos_array[j].x = e.changedTouches[i].pageX;
		last_pos_array[j].y = e.changedTouches[i].pageY;		
{'fraction_non_alphanumeric': 0.17751615881809787, 'fraction_numerical': 0.012465373961218837, 'mean_word_length': 3.75109649122807, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1627840', 'n_tokens_mistral': 1751, 'n_tokens_neox': 1539, 'n_words': 227}