#2 javascript interface

open
nobody
None
5
2008-02-20
2008-02-20
yuv
No

would be nice if similar to ptviewer there was a way for freepv to call back javascript functions to communicate current FOV, pan, tilt values as well as mouse actions.

The relevant parameters in the HTML object for PTviewer are:

<param name="scriptable" value="true">
<param name="mayscript" value="true">
<param name="getview" value="getview">
<param name="mousehs" value="mousehs">

And the corresponding JavaScript:
<script>
function mousehs(n) {
alert('here');
if( n== -1 ){
document.cn.hsnum.value = "---" ;
}else{
document.cn.hsnum.value = n ;
}
}

function getview(p,t,f) {
document.cn.pan.value = p ;
document.cn.tilt.value = t ;
document.cn.fov.value = f ;
}
</script>

unfortunately I have no clue of freepv's internals to do this :(

Discussion