Beiträge von bobbyani

    Managed to find a solution for anyone who experiences this issue. I found that if I make a "direct call" to load xml, which I found in this post https://krpano.com/forum/wbb/inde…&threadID=16960, then it works. I hadn't seen this anywhere before but for some reason it fixes it. It works fine whether myXml is escaped or not. This ended up being the only change I needed to make.

    Hmm I took a look and yeah after removing the escaping I'm just taking the encrypted string directly from the krpano encrypt tool without modifying it. I did some more testing this morning though and found that if I use the unecrypted xml I shared previously and run that through the krpano tools encrypt GUI tool it seems to work every time. My code is running it with the command line tool and using stdout instead of writing it to a file. So not sure if that is causing the issue for some reason.

    From the encrypt docs:

    • When using stdout as output filename, the encrypted filedata will be written to the console.


    I'll try experimenting with this and see if it affects my results and post back with more info. Thanks again taking the time to help out.

    1. Tried removing that but doesn't seem to make a difference. Still works on and off.
    2. Since I'm using loadxml with just a string instead of a path to a file I have to escape the string first. To make it easier I'm just escaping the string before storing it so I don't have to do it every time. I tried removing that, which resulting in the normal encrypted xml that you're describing, and then in JavaScript doing loadXml(escape(myXml)) and I got the same outcome of parsing failed every so often.

    I've attached an encrypted file that I didn't escape which gave me an error.

    Edit: I also tried loading that unescaped xml locally directly from a file with the testing server and it still gives a parsing error so it seems there's something else going on.

    The XML is kind of long but I'll attach it here. The unencrypted.xml is just my default xml that works. Then there are two different encrypted xml files, one which worked and one which gave me the parsing error. Let me know if you need anything else or want additional examples of encrypted files that work/fail. Thanks a lot for taking a look.

    Update on this. Since there were a lot of places were this could go wrong I tried replacing the generated XML with a hardcoded XML string so I could confirm it's the same every time. I did this and I am still getting the same outcome of a parsing error about 25% of the time. I also tried replacing the hardcoded XML string with '<krpano><preview type="grid();" /></krpano>' and here the encryption worked 100% of the time. So it seems it is related to my XML somehow but it is just inconsistent. Again the unencrypted XML still works 100% of the time. Hopefully that info is helpful.

    Hello. I'm running into an issue where, after running my XML through the encrypt tool, I will get an XML parsing error maybe about 25% of the time even when using the same XML. These are the steps that generate the XML that I'm using.

    1. Get info about hotspots and scenes from database
    2. Turn that into XML for krpano
    3. Encrypt the XML and then escape the encrypted string
    4. Load the xml string (not a file) in JavaScript with loadxml() call

    For some reason the encryption part seems to cause the parsing to fail sometimes. I've checked the xml before encryption and it is always the same. If I remove encryption step then it is successfully parsed every time. If it is helpful I can send examples of encryption xml that worked and some that failed. I've looked at them side by side and haven't noticed any major differences and as far as I know there is no way to decrypt these to try to find the xml issue.



    Would really appreciate any insight on this.


    Thanks!

    Doesn't krpano have to determine how much to change the fov every time there is a mousewheel event? The reason I have to use the mousehweel event is that I only want the value to display when the user zooms in or out and then fade out after a second, similar to what happens when you zoom in or out in your browser. However, if that's not possible then I think the method you are both describing is a good compromise. Thanks for the advice!

    Thanks for the reply. I think I could use the onviewchanged event as mentioned in that thread to make it work. This isn't exactly what I'm after though as if I do that method, when I zoom in it would show, 100% 101% 102%... and change constantly as the event is fired until reaching its final value. Ideally I would want it to immediately display the final zoom value so say 105% instead repeatedly updating after a zoom. Is there any way I can get that final zoom value beforehand? I really just want to mimic what krpano is doing internally to determine what the resulting fov will be after a mousewheel event.

    I'm trying to add some simple code to display the current zoom level when the user zooms in or out. I'm simply capturing the mousewheel event and then converting the view.fov to a percentage to display. My problem is that in the mousewheel event the fov will be the starting fov instead of the final fov. For example if I start out with an fov of 120 and then zoom out, the code will display an fov of 120 even though it will end up higher like 125. Is there any way to determine what the value of fov will be after the transition of zooming finishes? I looked at the wheeldata and wheeldata_raw variables but I'm not sure how you can convert these numbers into the actual change in the fov.

    Any help would be much appreciated.

    Thanks!

    Hello. I've encountered a strange issue when trying to pass a hotspot as a parameter to my javascript function. Initially this was working fine when set up as follows:

    Code
    <action name="move_hotspot" scope="local">
        ...
        js(MoveHotspot(get(hotspot[get(caller.name)]));
    </action>

    When this gets to my js function, MoveHotspot(hotspot), hotspot is passed correctly as an object with ath, atv, linkedscene all as properties which I can access.

    I rearranged my javascript to stop using global scope so that now the function is called with VTourModule.MoveHotspot(hotspot) instead of MoveHotspot(hotspot);

    Here's the action code.

    Code
    <action name="move_hotspot" scope="local">
        ...
        js(VTourModule.MoveHotspot(get(hotspot[get(caller.name)]));
    </action>

    Now when my javascript function is called hotspot is just equal to the string "[object object]". This is the only change I've made and switching it back to the original action code causes it to work again.

    Am I doing something wrong or is this some kind of bug? Any help would be much appreciated.

    Thanks!