front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js
changeset 26 858e90c7cbaa
parent 25 a7b0e40bcab0
child 27 6c08d4d7219e
equal deleted inserted replaced
25:a7b0e40bcab0 26:858e90c7cbaa
    11 
    11 
    12 (function(){
    12 (function(){
    13 
    13 
    14 var tuio = this.tuio;
    14 var tuio = this.tuio;
    15 
    15 
       
    16 /*
       
    17 * Modifié par alexandre.bastien@iri.centrepompidou.fr
       
    18 */
    16 function wrapPath(d) {
    19 function wrapPath(d) {
    17 	var i, len = d.path.length;
    20 	var i, len = d.path.length;
    18 	var res = [];
    21 	var res = [];
    19 	for (i=0; i<len; i++) {
    22 	for (i=0; i<len; i++) {
    20 		var pos = d.path[i];
    23 		var pos = d.path[i];
    21 		res.push({
    24 		res.push({
    22 			getX: function() { return pos[0]; },
    25 			getX: function() { return pos[0]; },
    23 			getY: function() { return pos[1]; },
    26 			getY: function() { return pos[1]; },
       
    27 			getZ: function() { return pos[2]; },
    24 
    28 
    25 			getScreenX: function(width) { return width * pos[0]; },
    29 			getScreenX: function(width) { return width * pos[0]; },
    26 			getScreenY: function(height) { return height * pos[1]; },
    30 			getScreenY: function(height) { return height * pos[1]; },
    27 		});
    31 		});
    28 	}
    32 	}
    42 
    46 
    43 		getPath: function() { return wrapPath(d); },
    47 		getPath: function() { return wrapPath(d); },
    44 	};
    48 	};
    45 }
    49 }
    46 
    50 
       
    51 /*
       
    52 * Modifié par alexandre.bastien@iri.centrepompidou.fr
       
    53 */
    47 function wrapCursor(d) {
    54 function wrapCursor(d) {
    48 	return {
    55 	return {
    49 		getSessionID: function() { return d.sid; },
    56 		getSessionID: function() { return d.sid; },
    50 		getCursorId: function() { return d.fid; },
    57 		getCursorId: function() { return d.fid; },
    51 		getX: function() { return d.x; },
    58 		getX: function() { return d.x; },
    52 		getY: function() { return d.y; },
    59 		getY: function() { return d.y; },
       
    60 		getZ: function() { return d.z; },
    53 
    61 
    54 		getScreenX: function(width) { return width * d.x; },
    62 		getScreenX: function(width) { return width * d.x; },
    55 		getScreenY: function(height) { return height * d.y; },
    63 		getScreenY: function(height) { return height * d.y; },
    56 
    64 
    57 		getPath: function() { return wrapPath(d); },
    65 		getPath: function() { return wrapPath(d); },
       
    66 		getPosition: function() { return wrapPosition(d); },
       
    67 	};
       
    68 }
       
    69 
       
    70 /*
       
    71 * Ajouté par alexandre.bastien@iri.centrepompidou.fr
       
    72 */
       
    73 function wrapPosition(d) {
       
    74 	return {
       
    75 		getX: function() { return d.x; },
       
    76 		getY: function() { return d.y; },
       
    77 		getZ: function() { return d.z; },
    58 	};
    78 	};
    59 }
    79 }
    60 
    80 
    61 tuio.TuioProcessing = function(p) {
    81 tuio.TuioProcessing = function(p) {
    62 	var listener = new tuio.Listener({
    82 	var listener = new tuio.Listener({