You are not logged in.

siamak

Beginner

  • "siamak" started this thread

Posts: 23

Location: Berlin

Occupation: Softwareentwickler

  • Send private message

1

Monday, May 11th 2015, 10:55am

Adding hotspots/plugins via JavaSript to current scene not possible? (Only root krpano)

Hi all,

with code like that, I can add via JavaScript some elements (hotspots/plugins/layers):

Source code

1
2
3
addhotspot(newspot);
set(hotspot[newspot].url,spot.png);
...


Reference: http://krpano.com/docu/actions/#addhotspot

However, when I have an XML with multiple scenes, I want to add an element to the CURRENT SCENE. But by using the code above, it seems that the element is added to the root-krpano-element. This results in a behavior that the elements are not removed when changing a scene (for sure, I have keep=false).

So my question is, what is the correct way to add an element (hotspots/plugins/layers) to the current scene in case of a multi-scene-XML.

Thank you for your help in advance.


Cheers
Siamak

siamak

Beginner

  • "siamak" started this thread

Posts: 23

Location: Berlin

Occupation: Softwareentwickler

  • Send private message

2

Monday, May 11th 2015, 11:27am

Hi again,

I found this: How to dynamically add a hotspot to current scene, and keep in that current scene only?

Maybe I cannot create hotspots from outside (JS) but I have to add an XML-action "into the scene" and call that action from JS.

siamak

Beginner

  • "siamak" started this thread

Posts: 23

Location: Berlin

Occupation: Softwareentwickler

  • Send private message

3

Tuesday, May 12th 2015, 8:53pm

Hi again,

digging deeper I came to a very strage behavior:

We use KrPano from GWT (Google Web Toolkit) using a JSNI interface. When I add a hotspot/plugin and do not set its keep attribute, it has the default value true (should be false by documentation). Setting the keep-attribute immediately does not take effect. Only by adding a timer (10 ms are enough) and then setting keep=false works.

The most strage thing is, that executing the JS-Code in the Chrome WebTools works. Adding hotspots/plugins results in keep=false initial value.

I have no hope that someone has this very specific problem, but maybe Klaus knows some gotchas with the JS-interface.


Cheers

Siamak

siamak

Beginner

  • "siamak" started this thread

Posts: 23

Location: Berlin

Occupation: Softwareentwickler

  • Send private message

4

Saturday, May 23rd 2015, 1:42pm

Hi again,

I ended up using a timer for setting the keep attribute. Thank you for listening to my monologue ;-)


Cheers

Siamak

5

Wednesday, May 27th 2015, 3:31pm

Hi,

that sounds all pretty strange.

Please post a link to your example or show how you try to add the hotspots.

Best regards,
Klaus

siamak

Beginner

  • "siamak" started this thread

Posts: 23

Location: Berlin

Occupation: Softwareentwickler

  • Send private message

6

Tuesday, June 2nd 2015, 10:43pm

Hi Kaus,

I think I found the root cause of my problems. There seems to be a difference between:

Source code

1
1) krpano.set('plugin[myname].keep', false);


and

Source code

1
2) krpano.call('set(plugin[myname].keep, false)');


I was using the latter. And directly after getting the keep-attribute:

Source code

1
krPano.get('plugin[myname].keep');


I get keep=true with the first call, and kee=false with the second.

Note that this happens during initialization of a new hotspot/plugin.

I think we can close that thread to not confuse people, since I have a very special environment (GWT). However, thank you Klaus!


Cheers
Siamak