hi:
i want to dynamically add text hotspot in pano viewer when click mouse, my code as below;but i canot find some method
to debug the code, could some one help me? thanks you!
my js code in html file as below:
function showMosueInfo(){
var krpano = document.getElementById("krpanoSWFObject");
var mouse_at_x = krpano.get("mouse.x");
var mouse_at_y = krpano.get("mouse.y");
var mouse_at_h = krpano.get("mouseath");
var mouse_at_v = krpano.get("mouseatv");
console.log(mouse_at_x+"-"+mouse_at_y);
document.getElementById("mouse_x").innerHTML = mouse_at_x + "px";
document.getElementById("mouse_y").innerHTML = mouse_at_y + "px";
document.getElementById("mouse_ath").innerHTML = mouse_at_h.toFixed(2) + "°";
document.getElementById("mouse_atv").innerHTML = mouse_at_v.toFixed(2) + "°";
}
// var lookat_interval = setInterval('getLookat()', 1000/30);
function mouseClick(){
var krpano = document.getElementById("krpanoSWFObject");
if(krpano && krpano.get)// it can take some time until krpano is loaded and ready
{
// krpano.call(addHostspotText);
krpano.call("screentosphere(mouse.x, mouse.y, mouseath, mouseatv);js( showMosueInfo() );"+addHostspotText);
console.log("show over");
}
}
var addHostspotText ="addhotspot(newHotspot);set(hotspot[newHotspot].name, 'addtext');set(hotspot[newHotspot].url, textfield.swf);set(hotspot[newHotspot].ath, mouseath);set(hotspot[newHotspot].atv, mouseatv);set(hotspot[newHotspot].html, '[p] aaaaaa[/p]');set(hotspot[newHotspot].backgroundcolor, 0xFFFFFF);set(hotspot[newHotspot].roundedge, 5);set(hotspot[newHotspot].shadow, 1);set(hotspot[newHotspot].borderwidth, 0);set(hotspot[newHotspot].glow, 4);set(hotspot[newHotspot].glowcolor, 0xFFFFFF);set(hotspot[newHotspot].autosize, 'center');set(hotspot[newHotspot].css, 'p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }');";
When i add static hotspot in xml file,it works:
code in xml file:
<hotspot name="textfieldhotspot" url="textfield.swf"
width="100"
height="20"
ath="61.7747"
atv="-11.2726"
html="[p]Helo[/p]"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF" autosize="center" />