Hi all krpano fans,
I'm new in KRpano, and I want to add a panoramic view in a website,
I already managed to do that for the 'user-view', now I try to add an admin page for my panorama,
where I will add/remove hotspot with onclick event of the mouse.
I found the editor plugin but it didn't do exactly what I want, so I started to develop my own plugin in Javascript.
My problem is, when I try to get the mouse coordinates of the click event when I add hotspot,
In my plugin :
function edithotspot(callingObject)
{
krpano.call("screentosphere(mouse.x,mouse.y,m_ath,m_atv);");
var posX = krpano.get('m_ath');
var posY = krpano.get('m_atv');
krpano.trace(1,posX);
krpano.trace(1,posY);
if (callingObject == 'mouse') {
if (addclicked) {
var uniqname = "hs" + Date.now();
krpano.trace(1, 'add hotspot');
krpano.call("addhotspot(" + uniqname + ");");
krpano.call("set(hotspot[" + uniqname + "].ath," + posX + ");");
krpano.call("set(hotspot[" + uniqname + "].atv, " + posY + ");");
krpano.call("hotspot[" + uniqname + "].loadstyle('hotspot_ani_white');")
krpano.call("set(hotspot[" + uniqname + "].onclick,openplugin();");
}
} else {
if (delclicked) {
krpano.trace(1, "del hotspots");
krpano.trace(1, callingObject);
krpano.call("removehotspot(" + callingObject + ");");
}
}
}
Display More
and in my XML I have :
But when I try that the coordinates show in the logs have one click late,
first clic : null, null
second click : ath of first click, atv of first click
third click : ath of second click, atv of second click
...
Anybody knows where I'm wrong ?
Note :
in the code addclicked/delclicked are two boolean variables activate when I click on "add hotspot" or "remove hotspot" buttons
Thanks for help
sorry if my english is bad I'm french