I am trying to integrate Webrotate 360 into my Magento 2 website. I have created it as a module and it is working. Now, I want to prepend the site URL before the hotspot's relative URL. I have prepended it using the API but it only works once. When I click on any of the hotspots, the new image is loaded, but the API for appending the URL is not working in the new image.
JavaScript:
require(['jquery', 'webrotate'], function($) {
jQuery(document).ready(function() {
jQuery('#wr360PlayerId').rotator({
licenseFileURL: '<?php echo $this->getViewFileUrl('Idm_InteractiveDemoRoom::webrotate360/license.lic'); ?>',
configFileURL: '<?php echo $this->getViewFileUrl('Idm_InteractiveDemoRoom::webrotate360/360_assets/Demo Room/Demo Room.xml'); ?>',
graphicsPath: '<?php echo $this->getViewFileUrl('Idm_InteractiveDemoRoom::webrotate360/imagerotator/html/img/basic'); ?>',
responsiveBaseWidth: 1000,
responsiveMinHeight: 0,
googleEventTracking: false,
apiReadyCallback: (api, isFullScreen) => {
api.hotspots.onAction(hotspotConfig => {
console.log(JSON.stringify(hotspotConfig, null, 4));
if (hotspotConfig.id == "productpage") {
hotspotConfig.hotspotInfo.url = "<?php echo $block->getUrl(''); ?>/" + hotspotConfig.hotspotInfo.url
} else {console.log(hotspotConfig.hotspotInfo.url)
hotspotConfig.hotspotInfo.url = "<?php echo $this->getViewFileUrl('Idm_InteractiveDemoRoom::webrotate360'); ?>/" + hotspotConfig.hotspotInfo.url
}
return hotspotConfig; // Returning false indicates that you don't want to override a default hotspot action.
});
}
});
});
});