Beiträge von cgspicer
-
-
Thanks for the reply sachagrffin. Your workaround would probably in fact work, but I was hoping to be able to pass more than one parameter to the js() call. Your solution depends on more javascript (the parsing of the hotspot from javascript through the panoViewerObject.get() and would only work if all needed parameters were on the referenced hotspot. Furthermore, and I haven't verified it through testing, but I'm pretty sure that it wouldn't even pass the hotspot's id as a single parameter as demonstrated in the first attempted workaround. It's a good idea though if you only need variables on one hotspot.
-
It doesn't appear to be a specific enough reference and it appears that you are trying to set some base url for select image paths. While you should use the basepath ( https://krpano.com/docu/html/#basepath ) parameter during embedding, since you may run into some cross domain issues, you could try storing your variable information in a data element and referencing that ( https://krpano.com/docu/xml/#data ).
-
Okay, so I found a workaround. It's a bit strange, but perhaps it will shed some light on the bug.
As I suspected, storing an object as the value on a single hotspot property is part of the solution, however this does not work alone. I assumed only using only one parameter would work since only the first one was being passed properly:
XML markup:Code<scene name="scene_sceneOne" title="sceneOne" > <view /> <preview /> <image></image> <!-- place your scene hotspots here --> <hotspot name="spot1" ath="0" atv="0" triggerdata="{'type':'type1','id':'id'}" onclick="js(handleTrigger( get(triggerdata) ));" /> </scene>
Corresponding javascript function:
Code
Alles anzeigenfunction handleTrigger( obj ) { //convert string to object obj = eval('('+obj+')'); //switchcase over type, to allow for all js() calls to pass through one handling function switch ( obj.type ) { case 'type1' : //do something if type 1 var dynamicParam = obj.id; //do something with dynamicParam break; default : return false; break; } }
However, it appears as though it still needs another parameter to parse the first one, which is weird. This works:
XML markup:Code<scene name="scene_sceneOne" title="sceneOne" > <view /> <preview /> <image></image> <!-- place your scene hotspots here --> <hotspot name="spot1" ath="0" atv="0" triggerdata="{'type':'type1','id':'id'}" onclick="js(handleTrigger( get(triggerdata),get(somethingElse) ));" /> </scene>
Corresponding javascript function:
Code
Alles anzeigenfunction handleTrigger( obj, garbageParam ) { //convert string to object obj = eval('('+obj+')'); //switchcase over type, to allow for all js() calls to pass through one handling function switch ( obj.type ) { case 'type1' : //do something if type 1 var dynamicParam = obj.id; //do something with dynamicParam break; default : return false; break; } }
I'm not quite sure why this works, but it does. Let me know if someone has any insight. Thanks!
-
I have run into a significant problem using the js() action on Internet Explorer 9 (IE9). I have created a <hotspot> with custom properties inside of a <scene>, and then I am using get() to retrieve them for use inside of a js() call. The problem is that only the first get(property) is being parsed properly: instead of passing the property's value, a string is being passed. This is only occurring in IE9 and below from what I can tell. I am testing inside a IE test virtual machine on Mac OS X. An example of the code is below.
The scene xml markup: (the irrelevant markup has been omitted.
Code<scene name="scene_sceneOne" title="sceneOne" > <view /> <preview /> <image></image> <!-- place your scene hotspots here --> <hotspot name="spot1" ath="0" atv="0" triggertype="type1" triggerid="id" onclick="js(handleTrigger( get(triggertype),get(triggerid) ));" /> </scene>
Corresponding javascript function:
Code
Alles anzeigenfunction handleTrigger( type, id ) { console.log(type +' '+ id); //switchcase over type, to allow for all js() calls to pass through one handling function switch ( type ) { case 'type1' : //do something if type 1 var dynamicParam = id; //do something with dynamicParam break; default : return false; break; } }
So, on all other browsers when this hotspot is clicked, "type1 id" will be logged to the console, however on IE9 and below "type1 get(triggerid)" will be logged instead.
I am going to try and figure out a work around that uses only one hotspot property, perhaps holding an object, since it passes the first parameter fine. In the meantime, is there something wrong with the above implementation or is this in fact a bug? Thanks!
[size=10]
[size=10]