Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Dienstag, 23. Mai 2023, 20:19

onready callback not being made after upgrade to 1.21.

Greetings,

I've been using krpano 1.20.11 successfully for quite some time now and it's been excellent. However, I'm running into some trouble trying to upgrade to 1.21.

For some background, the current setup I have (which works) is using version 1.20.11, is written in Typescript, where I added the following to the bottom of krpano.js:

Quellcode

1
module.exports.embedpano = embedpano; // export it


... then import it into my Typescript file with:

Quellcode

1
import * as KRPano from '../vendor/krpano';


... and finally reference it in code:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
        KRPano.embedpano({
            xml: null,
            target: targetId,
            html5: 'only+webgl',
            mobilescale: 1.0,
            onready: this.krpanoOnReady.bind(this), // bound member function
            onerror: this.krpanoOnError.bind(this), // bound member function
            consolelog: true,
            debugmode: true,
            usestrictjs: false,
        });


In 1.20.11, the call to embedpano worked as expected, and the onready callback was made successfully so I could do what I needed to after.

However, when I followed the same exact steps in 1.21, this isn't the case. While embedpano does get called (so I know the import works), the onready callback is not invoked.I rely on this callback for the other things my code needs to do.

Unfortunately, the code obfuscation makes it impossible for me to debug into it further and figure out why the callback isn't being made, or what the issue could be.

I also did try the consolelog, debugmode options as well as disabling usestrictjs but I don't get any output unfortunately.

As I mentioned, this does work with 1.20.11, but doesn't in 1.21 (and I can see there is quite a large difference between the two files). I need this upgrade to resolve some issues with iOS and gyros not working (among other things).

Any help with this would be greatly appreciated. Thank you!

2

Mittwoch, 24. Mai 2023, 10:49

Hi,

do you have a link to your example?

So far I can't image any reasons why onready wouldn't be get called...

Best regards,
Klaus

3

Mittwoch, 24. Mai 2023, 15:14

Good morning!

This is part of a very large, proprietary codebase which I can't post. However, I've gone ahead and setup a super stripped-down example of the setup, including both versions of the library, which reproduces the issue here: https://github.com/travisvromanmarxent/krpanotest

I made sure to detail the setup/structure of it in the readme, so hopefully this has everything you need.

Thank you for looking into this! Please let me know if there is anything else you need.

4

Dienstag, 30. Mai 2023, 13:51

Please post a link to a ready/complied/running example (or an archive of such example).

5

Mittwoch, 31. Mai 2023, 17:19

Apologies for the delay, I had to work out somewhere to host this.

Anyway, here are links to 2 versions of this, compiled/running.

The working version (using the old version of krpano): https://cdn.3dcloud.io/kr-pano-bug-demo/working/index.html
And the non-working version (using the new version of krpano): https://cdn.3dcloud.io/kr-pano-bug-demo/…king/index.html

6

Freitag, 2. Juni 2023, 09:16

Hi,

okay, I see now - but I have to say it works as intended...

There need to be the global 'krpanoJS' object with its functions and properties.
When it's not there, the viewer will not load.

In your example, you have fully inlined the code and so that global object doesn't exists anymore.

Best regards,
Klaus

7

Montag, 5. Juni 2023, 15:51

Perfect, you gave me the exact hint I needed. Thank you!

For anyone else running into this, I changed the module exports at the bottom of krpano.js to this:

Quellcode

1
module.exports = krpanoJS;


Then, in my TS I changed my import to:

Quellcode

1
import krpanoJS from '../vendor/krpano';



and later on added this to make sure the krpanoJS object stays global:

Quellcode

1
(window as any).krpanoJS = krpanoJS;



Finally I changed my references to my original imported alias of KRPano to krpanoJS and everything works as expected.

Thank you again, Klaus!