--- a/front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js Thu Apr 12 13:09:46 2012 +0200
+++ b/front_idill/extern/fajran-tuiojs/examples/processingjs/tuio.processing.js Thu Apr 12 15:33:25 2012 +0200
@@ -1,3 +1,6 @@
+/*
+ Modified by alexandre.bastien@iri.centrepompidou.fr to manage TUIO strings.
+*/
// add hooks
(function(){
@@ -20,119 +23,119 @@
* Modifié par alexandre.bastien@iri.centrepompidou.fr
*/
function wrapPath(d) {
- var i, len = d.path.length;
- var res = [];
- for (i=0; i<len; i++) {
- var pos = d.path[i];
- res.push({
- getX: function() { return pos[0]; },
- getY: function() { return pos[1]; },
- getZ: function() { return pos[2]; },
+ var i, len = d.path.length;
+ var res = [];
+ for (i=0; i<len; i++) {
+ var pos = d.path[i];
+ res.push({
+ getX: function() { return pos[0]; },
+ getY: function() { return pos[1]; },
+ getZ: function() { return pos[2]; },
- getScreenX: function(width) { return width * pos[0]; },
- getScreenY: function(height) { return height * pos[1]; },
- });
- }
- return res;
+ getScreenX: function(width) { return width * pos[0]; },
+ getScreenY: function(height) { return height * pos[1]; },
+ });
+ }
+ return res;
}
function wrapObject(d) {
- return {
- getSessionID: function() { return d.sid; },
- getSymbolID: function() { return d.fid; },
- getX: function() { return d.x; },
- getY: function() { return d.y; },
- getAngle: function() { return d.angle; },
+ return {
+ getSessionID: function() { return d.sid; },
+ getSymbolID: function() { return d.fid; },
+ getX: function() { return d.x; },
+ getY: function() { return d.y; },
+ getAngle: function() { return d.angle; },
- getScreenX: function(width) { return width * d.x; },
- getScreenY: function(height) { return height * d.y; },
+ getScreenX: function(width) { return width * d.x; },
+ getScreenY: function(height) { return height * d.y; },
- getPath: function() { return wrapPath(d); },
- };
+ getPath: function() { return wrapPath(d); },
+ };
}
/*
* Modifié par alexandre.bastien@iri.centrepompidou.fr
*/
function wrapCursor(d) {
- return {
- getSessionID: function() { return d.sid; },
- getCursorId: function() { return d.fid; },
- getX: function() { return d.x; },
- getY: function() { return d.y; },
- getZ: function() { return d.z; },
+ return {
+ getSessionID: function() { return d.sid; },
+ getCursorId: function() { return d.fid; },
+ getX: function() { return d.x; },
+ getY: function() { return d.y; },
+ getZ: function() { return d.z; },
- getScreenX: function(width) { return width * d.x; },
- getScreenY: function(height) { return height * d.y; },
+ getScreenX: function(width) { return width * d.x; },
+ getScreenY: function(height) { return height * d.y; },
- getPath: function() { return wrapPath(d); },
- getPosition: function() { return wrapPosition(d); },
- };
+ getPath: function() { return wrapPath(d); },
+ getPosition: function() { return wrapPosition(d); },
+ };
}
/*
* Ajouté par alexandre.bastien@iri.centrepompidou.fr
*/
function wrapPosition(d) {
- return {
- getX: function() { return d.x; },
- getY: function() { return d.y; },
- getZ: function() { return d.z; },
- };
+ return {
+ getX: function() { return d.x; },
+ getY: function() { return d.y; },
+ getZ: function() { return d.z; },
+ };
}
/*
* Ajouté par alexandre.bastien@iri.centrepompidou.fr
*/
function wrapString(d) {
- return {
- getCode: function() { return d.code; },
- };
+ return {
+ getCode: function() { return d.code; },
+ };
}
tuio.TuioProcessing = function(p) {
- var listener = new tuio.Listener({
- object_add: function(d) { if (p.addTuioObject) p.addTuioObject(wrapObject(d)); },
- object_update: function(d) { if (p.updateTuioObject) p.updateTuioObject(wrapObject(d)); },
- object_remove: function(d) { if (p.removeTuioObject) p.removeTuioObject(wrapObject(d)); },
- cursor_add: function(d) { if (p.addTuioCursor) p.addTuioCursor(wrapCursor(d)); },
- cursor_update: function(d) { if (p.updateTuioCursor) p.updateTuioCursor(wrapCursor(d)); },
- cursor_remove: function(d) { if (p.removeTuioCursor) p.removeTuioCursor(wrapCursor(d)); },
- string_add: function(d) { if (p.addTuioString) p.addTuioString(wrapString(d)); },
- string_update: function(d) { if (p.updateTuioString) p.updateTuioString(wrapString(d)); },
- string_remove: function(d) { if (p.removeTuioString) p.removeTuioString(wrapString(d)); }
- });
- tuio.addListener(listener);
- tuio.start();
+ var listener = new tuio.Listener({
+ object_add: function(d) { if (p.addTuioObject) p.addTuioObject(wrapObject(d)); },
+ object_update: function(d) { if (p.updateTuioObject) p.updateTuioObject(wrapObject(d)); },
+ object_remove: function(d) { if (p.removeTuioObject) p.removeTuioObject(wrapObject(d)); },
+ cursor_add: function(d) { if (p.addTuioCursor) p.addTuioCursor(wrapCursor(d)); },
+ cursor_update: function(d) { if (p.updateTuioCursor) p.updateTuioCursor(wrapCursor(d)); },
+ cursor_remove: function(d) { if (p.removeTuioCursor) p.removeTuioCursor(wrapCursor(d)); },
+ string_add: function(d) { if (p.addTuioString) p.addTuioString(wrapString(d)); },
+ string_update: function(d) { if (p.updateTuioString) p.updateTuioString(wrapString(d)); },
+ string_remove: function(d) { if (p.removeTuioString) p.removeTuioString(wrapString(d)); }
+ });
+ tuio.addListener(listener);
+ tuio.start();
};
tuio.TuioProcessing.prototype = {
- getTuioObjects: function() {
- var res = [];
- var i, len = tuio.objects.length;
- for (i=0; i<len; i++) {
- res.push(wrapObject(tuio.objects[i]));
- }
- return res;
- },
+ getTuioObjects: function() {
+ var res = [];
+ var i, len = tuio.objects.length;
+ for (i=0; i<len; i++) {
+ res.push(wrapObject(tuio.objects[i]));
+ }
+ return res;
+ },
- getTuioCursors: function() {
- var res = [];
- var i, len = tuio.cursors.length;
- for (i=0; i<len; i++) {
- res.push(wrapCursor(tuio.cursors[i]));
- }
- return res;
- },
-
- getTuioStrings: function() {
- var res = [];
- var i, len = tuio.strings.length;
- for (i=0; i<len; i++) {
- res.push(wrapString(tuio.strings[i]));
- }
- return res;
- }
+ getTuioCursors: function() {
+ var res = [];
+ var i, len = tuio.cursors.length;
+ for (i=0; i<len; i++) {
+ res.push(wrapCursor(tuio.cursors[i]));
+ }
+ return res;
+ },
+
+ getTuioStrings: function() {
+ var res = [];
+ var i, len = tuio.strings.length;
+ for (i=0; i<len; i++) {
+ res.push(wrapString(tuio.strings[i]));
+ }
+ return res;
+ }
};
})();