front_idill/extern/fajran-tuiojs/connector/npTuioClient/tuiojs.npTuioClient.js
changeset 30 45c889eae324
parent 29 fcf435874395
child 31 2c7fc855eba8
equal deleted inserted replaced
29:fcf435874395 30:45c889eae324
     1 /*
       
     2     Modified by alexandre.bastien@iri.centrepompidou.fr to manage TUIO strings.
       
     3 */
       
     4 
       
     5 tuio.setConnector({
       
     6     _failmsg: "Unable to initialize npTuioClient plugin.",
       
     7     _id: "__tuiojs_connector_npTuioClient",
       
     8 
       
     9     start: function() {
       
    10         var el = document.getElementById(this._id);
       
    11         if (el == undefined) {
       
    12             var el = document.createElement('object');
       
    13             el.setAttribute('id', this._id);
       
    14             el.setAttribute('type', 'application/x-tuio');
       
    15             el.appendChild(document.createTextNode(this._failmsg));
       
    16             document.body.appendChild(el);
       
    17         }
       
    18 
       
    19         // TODO: check if the plugin can be loaded. 
       
    20         //       if so, hide the plugin (display:none).
       
    21     },
       
    22 
       
    23     stop: function() {
       
    24         var el = document.getElementById(this._id);
       
    25         if (el != undefined) {
       
    26             document.body.removeChild(el);
       
    27         }
       
    28     }
       
    29 });
       
    30 
       
    31 function tuio_callback(type, sid, fid, x, y, z, angle, code)  {
       
    32 
       
    33     if(type < 6)
       
    34         tuio.cursorCallback(type, sid, fid, x, y, z, angle);
       
    35     else
       
    36         tuio.stringCallback(type, sid, code);
       
    37 }
       
    38