|
28
|
1 |
/* |
|
|
2 |
Modified by alexandre.bastien@iri.centrepompidou.fr to manage TUIO strings. |
|
|
3 |
*/ |
|
25
|
4 |
|
|
|
5 |
tuio.setConnector({ |
|
28
|
6 |
_failmsg: "Unable to initialize npTuioClient plugin.", |
|
|
7 |
_id: "__tuiojs_connector_npTuioClient", |
|
25
|
8 |
|
|
28
|
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 |
} |
|
25
|
18 |
|
|
28
|
19 |
// TODO: check if the plugin can be loaded. |
|
|
20 |
// if so, hide the plugin (display:none). |
|
|
21 |
}, |
|
25
|
22 |
|
|
28
|
23 |
stop: function() { |
|
|
24 |
var el = document.getElementById(this._id); |
|
|
25 |
if (el != undefined) { |
|
|
26 |
document.body.removeChild(el); |
|
|
27 |
} |
|
|
28 |
} |
|
25
|
29 |
}); |
|
|
30 |
|
|
27
|
31 |
function tuio_callback(type, sid, fid, x, y, z, angle, code) { |
|
|
32 |
|
|
28
|
33 |
if(type < 6) |
|
|
34 |
tuio.cursorCallback(type, sid, fid, x, y, z, angle); |
|
|
35 |
else |
|
|
36 |
tuio.stringCallback(type, sid, code); |
|
25
|
37 |
} |
|
|
38 |
|