Delete or cancel the rotator before it's fully loaded

Paula Alves

New member
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

Active member
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:
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

New member
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

Active member
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

New member
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

Active member
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

New member
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

Active member
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.
 
Top