Delete or cancel the rotator before it's fully loaded

Having trouble getting started? The viewer isn't loading properly?
Paula Alves
Posts: 4
Joined: Wed Jul 14, 2021 10:34 am
Contact:

Delete or cancel the rotator before it's fully loaded

Postby Paula Alves » Wed Jul 14, 2021 11:24 am

My user needs to load the visualization of another rotator even when the last one wasn't fully loaded, but I can only delete it using the apiReadyCallback return when the visualization is already completely loaded (using api.delete();).

Is there any way to do this during loading?

WebSupport
Posts: 1127
Joined: Thu Aug 23, 2012 11:35 am
Location: Pasadena, CA
Contact:

Re: Delete or cancel the rotator before it's fully loaded

Postby WebSupport » Wed Jul 14, 2021 3:32 pm

Hi Paula, you can simply remove the HTML element with a 360 product view in progress from DOM (i.e delete viewer's html element instead), if user can't wait for it to finish loading. It's not the cleanest, but will work I think.

Also, the viewer has api.reload function that allows loading other views "in-place" (without needing to delete anything) by passing xml config as the first parameter in the call. You do need to wait for the first one to load though to get the API but then you can call "reload" at any time, i.e even if the next view is not loaded yet.

And lastly, I don't think we test this scenario but if you do viewer initialization like this (instead of jQuery plugin):

Code: Select all

var rotator = WR360.ImageRotator.Create('wr360PlayerId');
rotator.licenseFileURL = 'license.lic';
rotator.settings.configFileURL = '...;
rotator.settings.graphicsPath = 'imagerotator/html/img/basic';
rotator.settings.alt = '360 degree view - ...';
rotator.settings.googleEventTracking = false;
rotator.settings.responsiveBaseWidth = 0;
rotator.settings.responsiveMinHeight = 0;

rotator.runImageRotator();


...you can call rotator.getAPI() at any time to get the same API object. Not sure it will delete everything cleanly if you call it during loading but it's something to consider.

Paula Alves
Posts: 4
Joined: Wed Jul 14, 2021 10:34 am
Contact:

Re: Delete or cancel the rotator before it's fully loaded

Postby Paula Alves » Fri Jul 16, 2021 8:32 am

Thanks for the suggestions, but they didn't work.

I removed the Html element, but when I created a new imagerotator it didn't fully loaded and was not displayed , I inspected the element and the div "id="wr360container_webrotateproduct" was created with the class "container container_zoomoff" and the rotator was not displayed.

The same happened using api.reload, the second one was not displayed and the class was "container container_zoomoff".

I called rotator.getAPI() and used the delete function, but it was not deleted before it's fully loaded.

Is there any way I can using api.delete() before it completes the loading?

When I try to use api.delete() before it finishes loading, the error is apply:
"Uncaught TypeError: Cannot read property 'qG' of null
at WR360.ImageRotator.mU (eval at <anonymous> (imagerotator.js:4), <anonymous>:1:102627)
at WR360.ImageRotator.delete (eval at <anonymous> (imagerotator.js:4), <anonymous>:1:75151)
at Object.success (catalog-script.js?v=xCIptQEx7Q4j-m1PvesWx_JHDjZWxApsKY0sGgPdeIU:170)
at c (vendors.min.js:2)
at Object.fireWith [as resolveWith] (vendors.min.js:2)
at l (vendors.min.js:2)
at XMLHttpRequest.<anonymous> (vendors.min.js:2)"

When I tried to reloaded, using the getAPI() before it finishes loading, I got this error:
"Uncaught TypeError: Cannot read property 'length' of null
at WR360.bN.qG (eval at <anonymous> (imagerotator.js:4), <anonymous>:1:56578)
at WR360.ImageRotator.mU (eval at <anonymous> (imagerotator.js:4), <anonymous>:1:102627)
at WR360.ImageRotator.reload (eval at <anonymous> (imagerotator.js:4), <anonymous>:1:74435)
at WR360.API.reload (eval at <anonymous> (imagerotator.js:4), <anonymous>:1:144675)
at Object.success (catalog-script.js?v=o12u9HvF31FMwEKabpsHAlWs8R4ITOqPSsi4uYCu14Q:154)
at c (vendors.min.js:2)
at Object.fireWith [as resolveWith] (vendors.min.js:2)
at l (vendors.min.js:2)
at XMLHttpRequest.<anonymous> (vendors.min.js:2)"

The page has buttons that when selected, the selected button's rotators should be displayed, so I need to close one and display another rotator.

Thanks again!

WebSupport
Posts: 1127
Joined: Thu Aug 23, 2012 11:35 am
Location: Pasadena, CA
Contact:

Re: Delete or cancel the rotator before it's fully loaded

Postby WebSupport » Fri Jul 16, 2021 7:12 pm

Hmmm... sorry! we indeed don't test or design it for deletion or reloading before it loaded at least once.

Another solution could be to have two div containers , where one is absolutely positioned on top of another with visibility hidden. Then if somebody tries to load another view before the first got loaded, use the second container and attach a new viewer instance there and make it visible on top of the first one.

Paula Alves
Posts: 4
Joined: Wed Jul 14, 2021 10:34 am
Contact:

Re: Delete or cancel the rotator before it's fully loaded

Postby Paula Alves » Mon Jul 19, 2021 10:22 am

Thanks again,
Just to clarify, I forgot to mention in the previous post that I waited to load the first rotator, but errors still occurred.

I tried to load 2 divs, and the first one displayed correctly, but the second one did not display and was created with the "container container_zoomoff" class. Apparently, something is blocking the second's full loading.

WebSupport
Posts: 1127
Joined: Thu Aug 23, 2012 11:35 am
Location: Pasadena, CA
Contact:

Re: Delete or cancel the rotator before it's fully loaded

Postby WebSupport » Mon Jul 19, 2021 7:06 pm

Hmm... are you using the free version of the viewer (which doesn't allow more than a single instance of the viewer on a page as per this summary) as this is the only reason it would fail loading the second instance and can be the reason for the other issues you are having, i.e instantiating multiple instances of the viewer?

Paula Alves
Posts: 4
Joined: Wed Jul 14, 2021 10:34 am
Contact:

Re: Delete or cancel the rotator before it's fully loaded

Postby Paula Alves » Wed Jul 21, 2021 6:34 am

I appreciate the fast answer,

Our license version is Enterprise.
The licence.lic file is being referenced, but "Powered By WebRotate" is being displayed, so I imagine the license is not working correctly.

Is each webrotate generated by licence.lic different or can a single .lic file be used for any webrotate?

WebSupport
Posts: 1127
Joined: Thu Aug 23, 2012 11:35 am
Location: Pasadena, CA
Contact:

Re: Delete or cancel the rotator before it's fully loaded

Postby WebSupport » Wed Jul 21, 2021 7:07 am

Yes, a single .lic is used for multiple views. You can email your license.lic to support at webrotate360 dot com and we will check it out.


Return to “Setup Issues and Embedding”

cron