You are not logged in.


Thursday, June 6th 2013, 4:17pm

[resolved] when does hotspot[name].onloaded gets fired in javascript


I am trying to draw polygons after getting data from server (geometry points). When I try following rows it doesn't fire test() function:

Test case:
function test(){

When I can exactly know if hotspot is loaded to put it's points or it's picture? If I try to put its points right after addhotspot() function with:

it doesn't accepts these points all the time.

I need to know a time when it is safe to put hotspot's colour, points etc but unfortunately onloaded function doesn't get fired.

edit: If you let me know when krpano does exactly fire "onloaded" event, I can put that property after creating hotspot then add the other properties at onloaded callback. Otherwise adding properties creates inconsistency and this problem doesn't seem to be solved with setTimeouts or setIntervals in javascript.

This post has been edited 2 times, last edit by "electronicpanda" (Jun 11th 2013, 3:29pm) with the following reason: add


Monday, June 10th 2013, 4:38pm

As an example these codes doesn't work right after krpano().call('loadxml(... row, after that when I check console I see spotTest hotspot is placed but point coordinates weren't:


krpano().set("hotspot[spotTest].point[0].ath", 35);
krpano().set("hotspot[spotTest].point[0].atv", 35);
krpano().set("hotspot[spotTest].point[1].ath", 37);
krpano().set("hotspot[spotTest].point[1].atv", 37);
krpano().set("hotspot[spotTest].point[2].ath", 39);
krpano().set("hotspot[spotTest].point[2].atv", 39);
krpano().set("hotspot[spotTest].point[3].ath", 45);
krpano().set("hotspot[spotTest].point[3].atv", 45);
krpano().set("hotspot[spotTest].point[4].ath", 55);
krpano().set("hotspot[spotTest].point[4].atv", 55);
krpano().set("hotspot[spotTest].point[5].ath", 35);
krpano().set("hotspot[spotTest].point[5].atv", 35);
krpano().set("hotspot[spotTest].fillalpha", 0);
krpano().set("hotspot[spotTest].fillcolor", "0xFF0000");
krpano().set("hotspot[spotTest].distorted", false);
krpano().set("hotspot[spotTest].fillcolorhover", "0xFF1111");
krpano().set("hotspot[spotTest].borderwidth", 2);
krpano().set("hotspot[spotTest].borderwidthhover", 2);
krpano().set("hotspot[spotTest].borderalpha", 1);
krpano().set("hotspot[spotTest].bordercolorhover", "0xFF1111");
krpano().set("hotspot[spotTest].bordercolor", "0xFF1111");
krpano().set("hotspot[spotTest].visible", true);

console output:



Monday, June 10th 2013, 8:31pm


are you maybe using the HTML5 viewer?

If yes - there polygonal hotspots are not supported yet.

About the onloaded event - this is basically only needed for image hotspots, for polygonal hotspots there is nothing to load.

Best regards,


Tuesday, June 11th 2013, 9:41am

I found the issue, the problem was in the next pano photograph hotspots were coming earlier than picture load. now problem is solved after binding hot spot loading function to events.onloadcomplete.

Thanx for the help.