-
${menu_object.content.map((content) => {
return `
- ${content.text} `; }).join('')}
var animationLoading, _scenePollInterval, timeStart, loaderbarWidth = 0;
var updateEnabled = true;
var canvas = null;
var nozzleImg = null;
var iMacZoom = null;
//var imgcanvas = null;
var scene = null;
window.isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
window.mob = (navigator.userAgent.indexOf("iPhone") != -1) || ((navigator.userAgent.indexOf("Android") != -1) || (navigator.userAgent.indexOf("Mobile") != -1)) || (navigator.userAgent == "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.1 Safari/605.1.15");
window.mobForDesktop = (navigator.userAgent.indexOf("iPhone") != -1) || ((navigator.userAgent.indexOf("Android") != -1) || (navigator.userAgent.indexOf("Mobile") != -1)) || (navigator.userAgent == "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.1 Safari/605.1.15");
window.isipad = navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && (navigator.userAgent.indexOf("iPhone") == -1);
window.selectedButton = '';
window.checkedButton = '';
window.selectedButtonType = '';
window.isExplode = false;
window.currID;
window.prevID
var config = {
'name': 'p2424ht-monitor',
'cameraReset':'Render_Cam_F01_FL',
'reset': '2.08333',
}
window.ProjectTitle = 'p2424ht-monitor';
var productType = '2-in-1';
var openCloseOnOff = false;
var backliteOnOff = false;
function InfinityRTStart(fnAllGeometryComplete) {
if (window.mob || window.isipad) {
console.log("window.isipad")
var urlDataPath = './model_gl_mob/';
} else {
var urlDataPath = './model_gl/';
}
timeStart = new Date().getTime();
touch = new Vector3();
touches = [new Vector3(), new Vector3(), new Vector3()];
prevTouches = [new Vector3(), new Vector3(), new Vector3()];
$("#loader").css('display', 'block');
$("#infinityrt-canvas").css('display', 'none');
$("#calloutcanvas").css('display', 'none');
var mainLoad = document.getElementById('mainload');
document.getElementById("popupContainer").style.display = 'none';
setTimeout(() => {
document.getElementById('mainload').style.visibility = "visible";
document.getElementById('mainload').style.opacity = "1";
document.getElementById('footerControlDesk').style.display = 'block';
}, 100);
animationLoading = setInterval(function () {
loaderbarWidth++;
if (loaderbarWidth > 50) loaderbarWidth = 50;
$("#loaderbar", window.document).css("width", loaderbarWidth + "px");
}, 100);
try {
canvas = document.getElementById("infinityrt-canvas");
calloutcanvas = document.getElementById("calloutcanvas");
ui = document.getElementById("root");
if (typeof (canvas) != 'undefined') {
var gl = infinityrt_getwebglcontext(canvas, { xrCompatible: true, antialias: true, depth: true });
if (!gl) {
alert("***Could not initialise WebGL canvas");
}
else {
if (mob || isipad) {
infinityrt_codeprefix = "./model_gl_mob/";
} else {
infinityrt_codeprefix = "./model_gl/";
}
if (fnAllGeometryComplete == undefined)
fnAllGeometryComplete = AllGeometryComplete;
var url = new URL(window.location.href);
scene = new infinityrt_scene({ rtgl: gl }, urlDataPath, canvas.width, canvas.height, undefined, undefined, undefined, function () { }, fnAllGeometryComplete);
scene._nDoFApertureMode = 1;
scene._nDoFApplyToNear = 0;
scene._nav = new infinityrt_navigation(scene, canvas.width, canvas.height);
scene._jitRadius = 2;
scene.start();
_scenePollInterval = setInterval("isInfinityRTReady()", 10);
addMouseListeners(canvas);
window.GotoPosInTimeNamedValue(config.cameraReset);
if (!window.mob && !isMac) {
addMouseListeners(ui);
}
addMouseListeners(calloutcanvas);
window.addEventListener('keypress', keyPress, false);
}
}
}
catch (e) {
console.log(e);
}
if (scene != null) {
window.requestAnimationFrame(frameUpdate);
$(this).bind("contextmenu", onRightClick); //prevents a right click
document.body.oncontextmenu = onRightClick;
if (typeof (onInit) != 'undefined') onInit();
}
}
function exploreFun() {
if (document.getElementById('selectProductBtn')) {
document.getElementById('selectProductBtn').removeAttribute("aria-expanded");
}
if (document.getElementById('colorBtn')) {
document.getElementById('colorBtn').removeAttribute("aria-expanded");
}
if (document.getElementById('positionBtn')) {
document.getElementById('positionBtn').removeAttribute("aria-expanded");
}
if (document.getElementById('productViewBtn')) {
document.getElementById('productViewBtn').removeAttribute("aria-expanded");
}
if (document.getElementById('feature')) {
document.getElementById('feature').removeAttribute("aria-expanded");
}
/* Fix for Screen reader end */
if (document.getElementById('exploreButtton')) {
document.getElementById('exploreButtton').style.display = 'none';
}
if (document.getElementById('onScreenControlContainer')) {
document.getElementById('onScreenControlContainer').style.display = 'flex';
}
if (document.getElementById('root')) {
document.getElementById('root').style.zIndex = '1';
document.getElementById('root').style.opacity = '1';
}
if (document.getElementById('sliderRange')) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
}
if (document.getElementById('mainload')) {
document.getElementById('mainload').style.opacity = "0";
document.getElementById('mainload').style.visibility = "hidden";
document.getElementById('mainload').style.transition = ".5s ease-out";
}
if (document.getElementById('loader')) {
document.getElementById('loader').style.display = "none";
}
if (document.getElementById('loading')) {
document.getElementById('loading').style.display = "none";
}
if (document.getElementById('LeftMenuWrapper')) {
window.document.getElementById('LeftMenuWrapper').setAttribute('aria-hidden', 'false');
}
if (document.getElementById('loaders')) {
document.getElementById('loaders').style.display = "none";
}
if (document.getElementById("onScreenControlContainer")) {
document.getElementById("onScreenControlContainer").style.display = 'block';
}
if (document.getElementById("infinityrt-canvas")) {
document.getElementById("infinityrt-canvas").style.opacity = '1';
}
if (document.getElementById("calloutcanvas")) {
document.getElementById("calloutcanvas").style.opacity = '1';
}
document.getElementById("popupContainer").style.display = 'block';
// setTimeout(() => {
// },100);
}
function onRightClick(event) {
return false;
}
var timeStart;
function isInfinityRTReady() {
document.getElementById('exploreButtton').disabled = true;
LangName = getLangUrl();
if (scene == null) return;
scene.start();
// timeStart = new Date().getTime();
outstandingJobs = scene.getOutstandingJobs();
if (outstandingJobs <= 0 && scene._prepared) {
onInfinityRTReady();
clearInterval(_scenePollInterval);
} else if (scene._projectparsed) {
clearInterval(animationLoading);
updateProgressBar();
}
}
function iOSversion() {
var iosVersion = navigator.appVersion;
iosVersion = iosVersion.split(' ')
var isChromeOniOS154 = (iosVersion.indexOf("15_4") > -1);
return isChromeOniOS154;
}
function updateProgressBar() {
if (scene == null)
return;
totalJobs = scene.getTotalJobs();
outstandingJobs = scene.getOutstandingJobs();
var perc = 100 - Math.round(outstandingJobs / totalJobs * 100);
var newwidth = perc;
$("#loaderbar", window.document).css("width", newwidth + "%");
}
window.addEventListener("orientationchange", event => {
setTimeout(() => {
resizeCanvas();
}, 1000);
})
window.LangName;
var time = (new Date().getTime() - timeStart);
const websiteURL = () => {
let url = window.location.origin;
}
function onInfinityRTReady() {
if (time < 60000) {
RT_RecordTiming("Load", time, window.ProjectTitle);
}
// if (window.mob) {
// scene._bDoF = false;
// } else {
// scene._bDoF = true;
// }
if (((navigator.userAgent.indexOf("iPhone") != -1) || (navigator.userAgent.indexOf('iPad') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent == "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.1 Safari/605.1.15") || window.detectIpadDevice()) || (navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && (navigator.userAgent.indexOf("iPhone") == -1))) {
document.getElementById('container').style.bottom = '';
} else {
document.getElementById('container').style.bottom = ' 95vh';
}
if ((/Android|webOS|iPhone|BlackBerry/i.test(navigator.userAgent)) || (window.isipad && window.innerHeight > window.innerWidth)) {
$("#loading", window.document).css('display', 'none');
$("#loading").css('display', 'none');
$(".desktop").css('z-index', '-1');
$("#root").css('opacity', '1');
document.getElementById("infinityrt-canvas").style.opacity = '1';
document.getElementById("calloutcanvas").style.opacity = '1';
document.getElementById("mainload").style.visibility = 'hidden';
document.getElementById("mainload").style.opacity = '0';
document.getElementById("popupContainer").style.display = 'none';
$("#root", window.document).css('display', 'block');
}
setTimeout(() => {
document.getElementById('footerControlDesk').style.display = 'block';
}, 1500);
document.getElementById('loader').style.opacity = '0';
$("#loaderbar", window.document).css('width', '0px');
$("#infinityrt-canvas", window.document).css('display', 'block');
$("#calloutcanvas", window.document).css('display', 'block');
document.getElementById('exploreButtton').disabled = false;
document.getElementById('exploreButtton').style.backgroundColor = '#0076CE';
$("#btnBackground", window.document).css('display', 'block');
if ($("#btnXR").css("display") == "block" || $("#btnXR-iphone").css("display") == "none") {
var accordionContent = document.querySelectorAll('.accordionContent');
// for (var i = 0; i <= accordionContent.length - 1; i++) {
// accordionContent[i].style.top = '123px';
// }
} else {
var accordionContent = document.querySelectorAll('.accordionContent');
// for (var i = 0; i <= accordionContent.length - 1; i++) {
// accordionContent[i].style.top = '160px';
// }
}
if(window.mob || window.isipad && (window.innerWidth < window.innerHeight)){
if(document.getElementById('accordion_exteriorView')){
document.getElementById('accordion_exteriorView').classList.add('active')
}
}
console.log('End time: ' + (new Date().getTime() - timeStart));
checkForXR({
startAR: function () {
arView = true;
},
endAR: function () {
resizeCanvas();
arView = false;
}
});
resizeCanvas();
zoonOutCamStatus = false;
window.GotoPosInTimeNamedValue(config.cameraReset);
window.scene.groupApplyState("Internal_ON");
var isiOS154 = iOSversion();
if (isiOS154) {
document.getElementById("btnXR-iphone").style.display = 'none';
var accordionContent = document.querySelectorAll('.accordionContent');
// for (var i = 0; i <= accordionContent.length - 1; i++) {
// accordionContent[i].style.top = '123px';
// }
}
}
function addMouseListeners(canvas) {
canvas.addEventListener('mousemove', mouseMove, false);
canvas.addEventListener('mousedown', mouseDown, false);
canvas.addEventListener('mouseup', mouseUp, false);
canvas.addEventListener('wheel', mouseWheel, false);
canvas.addEventListener('DOMMouseScroll', mouseWheel, false);
canvas.addEventListener('touchstart', touchStart, false);
canvas.addEventListener('touchmove', touchMove, false);
canvas.addEventListener('touchend', touchEnd, false);
canvas.addEventListener('mouseout', mouseOut);
}
var sceneViewMatrix;
function frameUpdate() {
if (btnXR && btnXR.session && btnXR.session.isImmersive)
return;
setTimeout(function () {
window.requestAnimationFrame(frameUpdate);
}, scene.backoff);
sceneViewMatrix = scene._nav.NavCreateViewMatrix(scene._initialNavMatrix);
scene.setViewMatrix(sceneViewMatrix);
if (scene._refineCount < 64) frameUpdateForScene(scene);
}
function frameUpdateForScene(scene) {
var bGotoPosUpdate = scene._nav._navGotoPosActive;
scene.setViewMatrix(scene._nav.NavCreateViewMatrix(scene._initialNavMatrix));
scene.setModelMatrix(scene._nav.NavCreateModelMatrix(scene._initialNavMatrix));
var drawn = scene.draw();
if (bGotoPosUpdate)
scene.clearRefine();
if (drawn) hotspotPosAsignment();
if (drawn) ReflectionHide();
}
if (!navigator.userAgent.match(/Android/)) {
window.addEventListener('resize', resizeCanvas, false);
}
var nozzleImg = document.getElementById('playVideos');
window.windowWidth = window.innerWidth;
function resizeCanvas() {
var size = scene.get3DCanvasSize("infinityrt-canvas", window.innerWidth, window.innerHeight);
// var size1 = scene.get3DCanvasSize("calloutcanvas", window.innerWidth, window.innerHeight);
var dpr = window.devicePixelRatio;
var dprccs = 1.0 / dpr;
/// var size2 =scene.get3DCanvasSize("#ports_popup1", window.innerWidth, window.innerHeight);
// console.log('resize function called!')
if(document.querySelector('#root')){
document.querySelector('#root').style.opacity = '1'
}
if (isMac) {
console.log('mac')
const popup = document.querySelectorAll(".popup");
popup.forEach(element => element.style.transform = 'scale(0.8)');
const menu = document.querySelectorAll(".menu ");
menu.forEach(element => element.style.outline = 'none');
console.log(document.querySelector('.popup li'));
// if(document.querySelector('.content')){
// console.log('content')
// document.querySelector('.popup li').style = `letter-spacing: 0px`
// }
// window.scene._nav._navMinDolly = 13; //50
// window.scene._nav._navMaxDolly = 50; //50
}
if (canvas != null) {
var currentActiv = document.getElementById("menu_id_"+window.checkedButton);
if(currentActiv){
currentActiv.classList.add('active');
}
if (window.innerWidth > 935) {
window.checkWindowSize();
window.mob = false;
// console.log('window.mob', window.mob);
}
if (window.mob && !window.isipad) {
console.log('mobile resized');
document.getElementById('footerControls').style.zIndex = '0';
document.getElementById('footerControls').style.opacity = '0';
var reslimit = { w: 1920, h: 1080 };
if (scene && scene._glVersionNum > 1)
reslimit = { w: 3840, h: 2160 };
var w = window.innerWidth * dpr;//canvas.parentElement.offsetWidth * dpr;
var h = window.innerHeight * dpr;//canvas.parentElement.offsetHeight * dpr;
if (window.innerHeight < window.innerWidth) {
console.log('mobile landscap resized');
// document.getElementById('root').style.zIndex = '-1';
document.getElementById("root").style.opacity = "0";
document.getElementById("mainload").style.opacity = "0";
if (w > reslimit.w || h > reslimit.h) {
var scale = Math.min(reslimit.w / w, reslimit.h / h);
w *= scale;
h *= scale;
dprccs /= scale;
}
calloutcanvas.width = canvas.width = w;
calloutcanvas.height = canvas.height = h;
}
else {
console.log('mobile potrait resized');
document.getElementById("root").style.zIndex = "1";
document.getElementById("infinityrt-canvas").style.opacity = "1";
document.getElementById("calloutcanvas").style.opacity = "1";
document.getElementById("root").style.opacity = "1";
document.getElementById("mainload").style.visibility = "hidden";
document.getElementById("mainload").style.opacity = "0";
document.getElementById('leftMenuWrapper').style.transform = "unset";
// code for AR button
if ($("#btnXR").css("display") == "none") {
var accordionContent = document.querySelectorAll('.accordionContent');
// for (var i = 0; i <= accordionContent.length - 1; i++) {
// accordionContent[i].style.top = '85px';
// }
} else {
var accordionContent = document.querySelectorAll('.accordionContent');
// for (var i = 0; i <= accordionContent.length - 1; i++) {
// accordionContent[i].style.top = '160px';
// }
}
// code to set active menu when resize
h = window.innerHeight * 0.55 * dpr;//canvas.parentElement.offsetHeight * dpr;
if (w > reslimit.w || h > reslimit.h) {
var scale = Math.min(reslimit.w / w, reslimit.h / h);
w *= scale;
h *= scale;
dprccs /= scale;
}
canvas.width = w;
canvas.height = h;
calloutcanvas.width = canvas.width;
calloutcanvas.height = canvas.height;
document.getElementById('root').style.height = (window.innerHeight * 0.5) + 'px';
}
if (scene != null) {
scene._nav.canvasResize(canvas.width, canvas.height);
scene.resize(canvas.width, canvas.height);
scene._nav.canvasResize(calloutcanvas.width, calloutcanvas.height);
scene.resize(calloutcanvas.width, calloutcanvas.height);
}
document.getElementById('popupContainer').style.display = 'none';
}
else if (isipad) {
console.log('ipad');
var reslimit = { w: 1920, h: 1080 };
if (scene && scene._glVersionNum > 1) reslimit = { w: 3840, h: 2160 };
var w = window.innerWidth * dpr; //canvas.parentElement.offsetWidth * dpr;
var h = window.innerHeight * dpr; //canvas.parentElement.offsetHeight * dpr;
// document.getElementById("qrCode").style.display = 'none';
// window.scene._nav._panMax = [3,2];
// window.scene._nav._panMin = [-3,-1];
// window.scene._nav._navMinDolly = 58; //50
// window.scene._nav._navMaxDolly = 210; //50
if (window.innerHeight < window.innerWidth) {
console.log("ipad landscape");
// alert('iphone landscape')
var size2 = scene.get3DCanvasSize("ports_popup1,#ports_popup5,#ports_popup4,#ports_popup6,#ports_popup7", window.innerWidth, window.innerHeight);
// document.getElementById('root').style.zIndex = "2";
// document.getElementById('root').style.visibility = "visible";
// document.getElementById('root').style.opacity = "1";
// document.getElementById('mainload').style.visibility = "hidden";
// document.getElementById('infinityrt-canvas').style.opacity = "1"
// document.getElementById('calloutcanvas').style.opacity = "1"
// document.getElementById("mainload").style.opacity = "0";
var allPopup = document.querySelector(".popup.active");
const toolTip = document.querySelector('.tooltiptext');
if(toolTip !== undefined){
toolTip.style.display = "none"
}
if (allPopup != null) {
document.getElementById("popupContainer").style.display = "block";
}
document.getElementById("onScreenControlContainer").style.display = "block";
if (document.getElementById("footerControls")) {
document.getElementById("footerControls").style.zIndex = "1";
document.getElementById("footerControls").style.opacity = "1";
}
setTimeout(() => {
document.getElementById("popupContainer").style.display = "block";
var menu_active = document.querySelectorAll(".menu");
if (
window.selectedButton != "" &&
window.selectedButton != "onResetMode"
) {
// document.getElementById('menu_id_' + window.selectedButton).classList.add('active');
}
}, 500);
// condition to set menu offset
var accordionContent = document.querySelectorAll(".menu");
for (var i = 0; i <= accordionContent.length - 1; i++) {
let accordionContent1 = accordionContent[i].nextSibling.firstChild;
if (accordionContent[i].classList.contains("active")) {
console.log('ipad condition')
accordionContent[i].nextSibling.style.height =
accordionContent1.offsetHeight + "px";
} else {
// accordionContent[i].classList.remove("active");
}
}
// leftMenuWidth = window.mainMenuRef.offsetWidth;
// calloutcanvas.width = canvas.width = size.width - leftMenuWidth;
// calloutcanvas.height = canvas.height = size.height;
// leftMenuHeight = window.mainMenuRef.offsetHeight;
// canvas.style.marginLeft = leftMenuWidth + "px";
// calloutcanvas.style.marginLeft = leftMenuWidth + "px";
console.log(window.mainMenuRef.offsetWidth);
leftMenuWrapper = document.getElementById('leftMenuWrapper');
leftMenuWidth = window.mainMenuRef.offsetWidth;
console.log('leftMenuScale', window.mainMenuRef);
leftMenuComputedStyle = window.getComputedStyle(leftMenuWrapper);
var leftMenuScale = leftMenuComputedStyle.transform;
console.log('leftMenuScale', leftMenuScale);
leftMenuScale = leftMenuScale.substr(7,7);
console.log('leftMenuScale', leftMenuScale);
leftMenuScale = parseFloat(leftMenuScale);
console.log('leftMenuScale', leftMenuScale);
calloutcanvas.width = canvas.width = size.width - leftMenuWidth;
calloutcanvas.height = canvas.height = size.height;
leftMenuHeight = window.mainMenuRef.offsetHeight;
canvas.style.marginLeft = leftMenuWidth + 'px';
calloutcanvas.style.marginLeft = leftMenuWidth + 'px';
if (window.innerWidth > window.innerHeight) {
var scalePopup =
window.innerWidth / window.innerHeight - window.devicePixelRatio;
if (scalePopup < 0.5) scalePopup = 0.5;
if (scalePopup > 1) scalePopup = 1;
}
} else {
console.log("ipad potrait");
// alert('ipad potrait')
document.getElementById("infinityrt-canvas").style.marginLeft = "1";
document.getElementById("calloutcanvas").style.marginLeft = "1";
document.getElementById("popupContainer").style.display = "none";
document.getElementById("footerControls").style.zIndex = "0";
document.getElementById("footerControls").style.opacity = "0";
document.getElementById("onScreenControlContainer").style.display = "none";
document.getElementById('leftMenuWrapper').style.transform = "unset";
if (
window.selectedButton != "" &&
window.selectedButton != "onResetMode"
) {
// document.getElementById("menu_id_" + window.selectedButton).classList.add("active");
}
if (
window.selectedButton != "" &&
window.selectedButton != "onResetMode"
) {
// document.getElementById("menu_id_" + window.selectedButton).classList.add("active");
}
h = window.innerHeight * 0.55 * dpr; //canvas.parentElement.offsetHeight * dpr;
if (w > reslimit.w || h > reslimit.h) {
var scale = Math.min(reslimit.w / w, reslimit.h / h);
w *= scale;
h *= scale;
dprccs /= scale;
}
canvas.style.marginLeft = "0px";
calloutcanvas.style.marginLeft = "0px";
calloutcanvas.width = canvas.width = w;
calloutcanvas.height = canvas.height = h;
document.getElementById("root").style.height = window.innerHeight * 0.5 + "px";
setTimeout(() => {
document.getElementById("infinityrt-canvas").style.opacity = "1";
document.getElementById("calloutcanvas").style.opacity = "1";
document.getElementById("mainload").style.visibility = "hidden";
document.getElementById("mainload").style.opacity = "0";
}, 2000);
}
if (scene != null) {
scene._nav.canvasResize(canvas.width, canvas.height);
scene.resize(canvas.width, canvas.height);
scene._nav.canvasResize(calloutcanvas.width, calloutcanvas.height);
scene.resize(calloutcanvas.width, calloutcanvas.height);
}
}
else {
// console.log("desktop")
window.windowWidth = window.innerWidth;
var size2 = scene.get3DCanvasSize("ports_popup1,#ports_popup5,#ports_popup4,#ports_popup6,#ports_popup7", window.innerWidth, window.innerHeight);
if (!window.mob && !window.isipad && window.innerWidth < 1024) {
$("#loading", window.document).css('display', 'none');
$(".desktop").css('z-index', '-1');
$("#root").css('opacity', '1');
document.getElementById("infinityrt-canvas").style.opacity = '1';
document.getElementById("calloutcanvas").style.opacity = '1';
document.getElementById("mainload").style.visibility = 'hidden';
document.getElementById("popupContainer").style.display = 'none';
}
if (!window.mob && !window.isipad && window.innerWidth < 935) {
var reslimit = { w: 1920, h: 1080 };
if (scene && scene._glVersionNum > 1)
reslimit = { w: 3840, h: 2160 };
var w = window.innerWidth * dpr;//canvas.parentElement.offsetWidth * dpr;
var h = window.innerHeight * dpr;//canvas.parentElement.offsetHeight * dpr;
var menu_active = document.querySelectorAll('.menu');
// console.log(e.target.closest('.menu').nextSibling.style.height);
for (var i = 0; i <= menu_active.length - 1; i++) {
if (window.selectedButtonType !== menu_active[i].id) {
menu_active[i].classList.remove('active');
}
}
if (window.selectedButtonType && document.getElementById(`accordion_${window.selectedButtonType}`)) {
document.getElementById(`accordion_${window.selectedButtonType}`).classList.add('active');
}
else {
// document.getElementsByClassName("accordionContainer")[0].firstChild.classList.add('active');
}
document.getElementById('infinityrt-canvas').style.marginLeft = '0';
document.getElementById('calloutcanvas').style.marginLeft = '0';
document.getElementById('root').style.zIndex = '1';
document.getElementById('footerControls').style.zIndex = '0';
document.getElementById('footerControls').style.opacity = '0';
document.getElementById('container').style.bottom = '100vh';
document.getElementById("mainload").style.visibility = 'hidden';
document.getElementById("popupContainer").style.display = 'none';
h = window.innerHeight * 0.55 * dpr;//canvas.parentElement.offsetHeight * dpr;
if (w > reslimit.w || h > reslimit.h) {
var scale = Math.min(reslimit.w / w, reslimit.h / h);
w *= scale;
h *= scale;
dprccs /= scale;
}
calloutcanvas.width = canvas.width = w;
calloutcanvas.height = canvas.height = h;
document.getElementById('root').style.height = (window.innerHeight * 0.5) + 'px';
if (scene != null) {
scene._nav.canvasResize(canvas.width, canvas.height);
scene.resize(canvas.width, canvas.height);
scene._nav.canvasResize(calloutcanvas.width, calloutcanvas.height);
scene.resize(calloutcanvas.width, calloutcanvas.height);
}
document.getElementById('popupContainer').style.display = 'none';
} else {
// console.log(window.mainMenuRef.offsetWidth);
leftMenuWrapper = document.getElementById('leftMenuWrapper');
leftMenuWidth = window.mainMenuRef.offsetWidth;
// console.log('leftMenuScale', window.mainMenuRef);
leftMenuComputedStyle = window.getComputedStyle(leftMenuWrapper);
var leftMenuScale = leftMenuComputedStyle.transform;
// console.log('leftMenuScale', leftMenuScale);
leftMenuScale = leftMenuScale.substr(7,7);
// console.log('leftMenuScale', leftMenuScale);
leftMenuScale = parseFloat(leftMenuScale);
// console.log('leftMenuScale', leftMenuScale);
calloutcanvas.width = canvas.width = size.width - leftMenuWidth;
calloutcanvas.height = canvas.height = size.height;
leftMenuHeight = window.mainMenuRef.offsetHeight;
canvas.style.marginLeft = leftMenuWidth + 'px';
calloutcanvas.style.marginLeft = leftMenuWidth + 'px';
window.mainMenuRef.classList.remove('responsive-div');
var allPopup = document.querySelector('.popup.active');
if (allPopup != null) {
document.getElementById("popupContainer").style.display = 'block';
}
document.getElementById('footerControls').style.zIndex = '1';
if (document.getElementById('btnXR')) {
document.getElementById('btnXR').style.display = "none";
}
var menu_active = document.querySelectorAll('.menu');
for (var i = 0; i <= menu_active.length - 1; i++) {
if (window.selectedButtonType !== menu_active[i].id) {
menu_active[i].classList.remove('active');
}
}
if (window.selectedButtonType && document.getElementById(`accordion_${window.selectedButtonType}`)) {
document.getElementById(`accordion_${window.selectedButtonType}`).classList.add('active');
}
else {
// if(window.innerHeight>window.innerWidth)
// document.getElementsByClassName("accordionContainer")[0].firstChild.classList.add('active');
}
if (window.selectedButton != '' && window.selectedButton != 'onResetMode') {
// document.getElementById('menu_id_' + window.selectedButton).classList.add('active');
}
calloutcanvas.width = canvas.width;
calloutcanvas.height = canvas.height;
if (window.innerWidth > window.innerHeight) {
var scalePopup = ((window.innerWidth / window.innerHeight) - window.devicePixelRatio);
if (scalePopup < 0.5) scalePopup = 0.5;
if (scalePopup > 1) scalePopup = 1;
}
if (scene != null) {
scene._nav.canvasResize(canvas.width, canvas.height);
scene.resize(canvas.width, canvas.height);
scene._nav.canvasResize(calloutcanvas.width, calloutcanvas.height);
scene.resize(calloutcanvas.width, calloutcanvas.height);
}
}
}
}
$("#infinityrt-canvas, #calloutcanvas").css({
'transform': 'scale(' + dprccs + ')',
'transform-origin': '0% 0%',
'-webkit-transform': 'scale(' + dprccs + ')',
'-webkit-transform-origin': '0% 0%',
'-moz-transform': 'scale(' + dprccs + ')',
'-moz-transform-origin': '0% 0%',
'-o-transform': 'scale(' + dprccs + ')',
'-o-transform-origin': '0% 0%',
'-ms-transform': 'scale(' + dprccs + ')',
'-ms-transform-origin': '0% 0%',
});
// console.log('window.mobForDesktop',window.mobForDesktop);
if (window.innerWidth < 935) {
window.checkWindowSize();
window.mob = true;
// console.log('window.mob', window.mob);
}
else if (window.innerWidth > 935) {
window.checkWindowSize();
window.mob = false;
// console.log('window.mob', window.mob);
}
}
function keyPress(ev) {
if (ev.keyCode === 0 || ev.keyCode === 32) {
return
ev.preventDefault()
scene._nav._navDX = scene._nav._navDY = 0;
scene._nav._navMX = scene._nav._navMY = 0;
scene._nav._navXAng = scene._nav._navYAng = 0;
scene._nav._navDolly = 0.0;
scene._nav._navPan = [0.0, 0.0];
scene.clearRefine();
}
}
function getScene(ev) {
return scene;
}
var mpos = [0, 0];
var mdown = false;
var panNav = false;
var iMacZoom = false;
var isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
window.Animation = 'on';
window.AnimComplated = true;
var previous_anim_value = config['reset'];
function mouseDown(ev) {
if (isMac) {
if (ev.srcElement.id != 'calloutcanvas') return;
}
else {
for (i in ev.path) {
if (ev.path[i].id == "mainMenu" || ev.path[i].id == 'footerControls') return;
// console.log(ev.path[i].id)
}
}
window.hideSoft();
window.hidePopUp();
handClosed();
window.hideDimension();
portClicked = '';
mdown = true;
if (ev.shiftKey && ev.ctrlKey) {
iMacZoom = true;
}
if (ev.which == 3 || ev.which == 2 || (isMac && ev.ctrlKey))
panNav = true;
mpos = [ev.clientX - canvas.offsetLeft, ev.clientY - canvas.offsetTop];
if (zoonOutCamStatus == true && zoomOutCam != "") {
zoonOutCamStatus = false;
// this code is used to hide pop on mouse down
var allPopup = document.querySelector('.popup.active');
if (allPopup != null) {
allPopup.classList.remove('active');
}
if (zoomOutPort == "processor") {
// window.scene.groupApplyState("STAND_ON");
// window.scene.groupApplyState("Reflection_ON");
// window.scene.groupApplyState("GP_ON");
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}else if(zoomOutPort == "memory"){
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}else if(zoomOutPort == "fans"){
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}
}
// if (zoonOutCamStatus == true && zoomOutCam != "") {
// zoonOutCamStatus = false;
// // this code is used to hide pop on mouse down
// var allPopup = document.querySelector('.popup.active');
// if (allPopup != null) {
// allPopup.classList.remove('active');
// }
// var center = [0, 0, 0];
// window.scene._nav.SetRotationCenter(center);
// // if (zoomOutPort == "quickAccessPorts") {
// // window.scene.groupApplyState("STAND_ON");
// // window.scene.groupApplyState("REF_BOX_ON");
// // window.scene.groupApplyState("GP_ON");
// // window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // // update the scroll bar
// // var slider = document.getElementById("sliderRange");
// // if (slider != null) {
// // document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// // setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// // }
// // var center = [0, 20.774332, 0];
// // window.scene._nav.SetRotationCenter(center);
// // });
// // } else if (zoomOutPort == "ports") {
// // portFirstClick = false;
// // window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // // update the scroll bar
// // var slider = document.getElementById("sliderRange");
// // if (slider != null) {
// // document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// // setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// // }
// // var center = [0, 20.774332, 0];
// // window.scene._nav.SetRotationCenter(center);
// // });
// // } else if (zoomOutPort == "back") {
// // window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // // update the scroll bar
// // var slider = document.getElementById("sliderRange");
// // if (slider != null) {
// // document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// // setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// // }
// // var center = [0, 20.774332, 0];
// // window.scene._nav.SetRotationCenter(center);
// // });
// // }
// }
// scene.clearRefine();
}
function mouseUp(ev) {
mdown = false;
iMacZoom = false;
if (ev.which == 3 || ev.which == 2 || panNav) panNav = false;
handOpen();
}
function mouseOut(ev) {
if (!mdown) return;
mdown = false;
}
var animStoped = true;
function mouseMove(ev) {
if (!animStoped) return;
if (!mdown)
return;
if (window.selectedButton != 'accordion_interiorFeatur') {
window.selectedButton = '';
}
window.hideSoft();
window.hidePopUp();
window.hideDimension();
var allPopup = document.querySelector('.popup.active');
if (allPopup != null) {
allPopup.classList.remove('active');
}
if (ev.target.id !== 'infinityrt-canvas' && ev.target.id !== 'calloutcanvas') return;
var s = getScene(ev);
var mousePos = [ev.clientX - canvas.offsetLeft, ev.clientY - canvas.offsetTop];
var mdelta = [(mpos[0] - mousePos[0]), (mpos[1] - mousePos[1])];
mpos = [mousePos[0], mousePos[1]];
if (!panNav && !iMacZoom) {
if (s._nav.NavRotation(mpos, mdelta))
s.clearRefine();
}
else if (iMacZoom) {
var s = getScene(ev);
const delta = normalizeWheel(ev);
console.log(mdelta[0])
if (s._nav.NavChangeDolly(mdelta[0] * 10)) scene.clearRefine();
}
else {
if (s._nav.NavPan(mdelta))
s.clearRefine();
}
}
function mouseWheel(ev) {
for (i in ev.path) {
if (ev.path[i].id == "mainMenu" || ev.path[i].id == 'footerControls') return;
}
var s = getScene(ev);
var delta = ev.wheelDelta;
if (!ev) ev = window.event; /* IE7, IE8, Chrome, Safari */
if (ev.preventDefault) ev.preventDefault(); /* Chrome, Safari, Firefox */
ev.returnValue = false; /* IE7, IE8 */
// var delta = -ev.deltaY;
var deltaScene = delta * 4.3;
if (ev.target.id !== 'infinityrt-canvas' && ev.target.id !== 'calloutcanvas') return;
if (s._nav.NavChangeDolly(deltaScene, true)) {
document.getElementById("sliderRange").value = s._nav.getZoomFactor();
s.clearRefine();
}
window.hideSoft();
window.hidePopUp();
window.hideDimension();
portClicked = '';
if (window.selectedButton != 'accordion_interiorFeatur') {
window.selectedButton = '';
}
setTimeout(function () { document.getElementById("sliderRange").value = s._nav.getZoomFactor(); }, 100);
if (zoonOutCamStatus == true && zoomOutCam != "") {
zoonOutCamStatus = false;
// this code is used to hide pop on mouse down
var allPopup = document.querySelector('.popup.active');
if (allPopup != null) {
allPopup.classList.remove('active');
}
if (zoomOutPort == "processor") {
// window.scene.groupApplyState("STAND_ON");
// window.scene.groupApplyState("Reflection_ON");
// window.scene.groupApplyState("GP_ON");
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}else if(zoomOutPort == "memory"){
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}else if(zoomOutPort == "fans"){
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}
}
// if (zoonOutCamStatus == true && zoomOutCam != "") {
// zoonOutCamStatus = false;
// var allPopup = document.querySelector('.popup.active');
// if (allPopup != null) {
// allPopup.classList.remove('active');
// }
// var center = [0, 0, 0];
// window.scene._nav.SetRotationCenter(center);
// if (zoomOutPort == "quickAccessPorts") {
// window.scene.groupApplyState("STAND_ON");
// window.scene.groupApplyState("REF_BOX_ON");
// window.scene.groupApplyState("GP_ON");
// window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // update the scroll bar
// var slider = document.getElementById("sliderRange");
// if (slider != null) {
// document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// }
// var center = [0, 20.774332, 0];
// window.scene._nav.SetRotationCenter(center);
// });
// } else if (zoomOutPort == "ports") {
// portFirstClick = false;
// window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // update the scroll bar
// var slider = document.getElementById("sliderRange");
// if (slider != null) {
// document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// }
// var center = [0, 20.774332, 0];
// window.scene._nav.SetRotationCenter(center);
// });
// } else if (zoomOutPort == "back") {
// window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // update the scroll bar
// var slider = document.getElementById("sliderRange");
// if (slider != null) {
// document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// }
// var center = [0, 20.774332, 0];
// window.scene._nav.SetRotationCenter(center);
// });
// }
// }
}
var touch, touches, prevTouches, prevDistance = null;
var firstInteraction = true;
function touchStart(event) {
// console.log("touchstrt")
// console.log(event.path)
for (i in event.path) {
if (event.path[i].id == "mainMenu" || event.path[i].id == 'footerControls') return;
}
switch (event.touches.length) {
case 1:
touches[0].set(event.touches[0].pageX, event.touches[0].pageY, 0);
touches[1].set(event.touches[0].pageX, event.touches[0].pageY, 0);
break;
case 2:
touches[0].set(event.touches[0].pageX, event.touches[0].pageY, 0);
touches[1].set(event.touches[1].pageX, event.touches[1].pageY, 0);
prevDistance = touches[0].distanceTo(touches[1]);
break;
}
prevTouches[0].copy(touches[0]);
prevTouches[1].copy(touches[1]);
}
var doubleTouch = false;
//TOUCH VARIABLES NAVIGATION ************************
var touchSensitivity = 500.0;
var touchZoom = 0.01;
var touchPan = 500.0;
//***************************************************
function touchMove(event) {
window.hideSoft();
window.hidePopUp();
window.hideDimension();
portClicked = '';
var screenX = document.getElementById('infinityrt-canvas').clientWidth;
var screenY = document.getElementById('infinityrt-canvas').clientHeight;
var s = getScene(event);
event.preventDefault();
event.stopPropagation();
if (zoonOutCamStatus == true && zoomOutCam != "") {
zoonOutCamStatus = false;
// this code is used to hide pop on mouse down
var allPopup = document.querySelector('.popup.active');
if (allPopup != null) {
allPopup.classList.remove('active');
}
if (zoomOutPort == "processor") {
// window.scene.groupApplyState("STAND_ON");
// window.scene.groupApplyState("Reflection_ON");
// window.scene.groupApplyState("GP_ON");
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}else if(zoomOutPort == "memory"){
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}else if(zoomOutPort == "fans"){
window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// update the scroll bar
var slider = document.getElementById("sliderRange");
if (slider != null) {
document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
}
});
}
}
// if (zoonOutCamStatus == true && zoomOutCam != "") {
// zoonOutCamStatus = false;
// var allPopup = document.querySelector('.popup.active');
// if (allPopup != null) {
// allPopup.classList.remove('active');
// }
// var center = [0, 0, 0];
// window.scene._nav.SetRotationCenter(center);
// if (zoomOutPort == "quickAccessPorts") {
// window.scene.groupApplyState("STAND_ON");
// window.scene.groupApplyState("REF_BOX_ON");
// window.scene.groupApplyState("GP_ON");
// window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // update the scroll bar
// var slider = document.getElementById("sliderRange");
// if (slider != null) {
// document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// }
// var center = [0, 20.774332, 0];
// window.scene._nav.SetRotationCenter(center);
// });
// } else if (zoomOutPort == "ports") {
// portFirstClick = false;
// window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // update the scroll bar
// var slider = document.getElementById("sliderRange");
// if (slider != null) {
// document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// }
// var center = [0, 20.774332, 0];
// window.scene._nav.SetRotationCenter(center);
// });
// } else if (zoomOutPort == "back") {
// window.GotoPosInTimeNamedValue(zoomOutCam, function () {
// // update the scroll bar
// var slider = document.getElementById("sliderRange");
// if (slider != null) {
// document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor();
// setTimeout(function () { document.getElementById("sliderRange").value = window.scene._nav.getZoomFactor(); }, 1000);
// }
// var center = [0, 20.774332, 0];
// window.scene._nav.SetRotationCenter(center);
// });
// }
// }
var getClosest = function (touch, touches) {
var closest = touches[0];
for (var i in touches) {
if (closest.distanceTo(touch) > touches[i].distanceTo(touch)) closest = touches[i];
}
return closest;
}
switch (event.touches.length) {
case 1:
if (doubleTouch == false) {
touches[0].set(event.touches[0].pageX, event.touches[0].pageY, 0);
touches[1].set(event.touches[0].pageX, event.touches[0].pageY, 0);
if (s._nav.NavRotation([touches[0].x, touches[0].y], [(prevTouches[0].x - touches[0].x) * touchSensitivity / screenX, (prevTouches[0].y - touches[0].y) * touchSensitivity / screenY])) s.clearRefine();
if (firstInteraction) {
firstInteraction = false;
RT_RecordEvent("First 3D Interaction", "First 3D Interaction", window.ProjectTitle);
} else {
RT_RecordEvent("3D Model Interaction", "Rotating", window.ProjectTitle);
}
}
break;
case 2:
doubleTouch = true;
touches[0].set(event.touches[0].pageX, event.touches[0].pageY, 0);
touches[1].set(event.touches[1].pageX, event.touches[1].pageY, 0);
var distance = touches[0].distanceTo(touches[1]);
var deltaScene = (prevDistance - distance) * touchZoom * screenX;
if (s._nav.NavChangeDolly(-deltaScene)) {
RT_RecordEvent("3D Model Interaction", "Zooming", window.ProjectTitle);
s.clearRefine();
}
prevDistance = distance;
var offset0 = touches[0].clone().sub(getClosest(touches[0], prevTouches));
var offset1 = touches[1].clone().sub(getClosest(touches[1], prevTouches));
offset0.x = -offset0.x;
offset1.x = -offset1.x;
var mdelta2 = [offset1.x * touchPan / screenX, -offset1.y * touchPan / screenY];
if (s._nav.NavPan(mdelta2)) s.clearRefine();
break;
}
prevTouches[0].copy(touches[0]);
prevTouches[1].copy(touches[1]);
}
function touchEnd(event) {
setTimeout(function () { doubleTouch = false; }, 1000);
}
//ADDED THIS ALL ABOVE - CURSORS
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i = 0; i < data.length; i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
},
dataBrowser: [
{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
},
{
string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari",
versionSearch: "Version"
},
{
prop: window.opera,
identity: "Opera",
versionSearch: "Version"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS: [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.userAgent,
subString: "iPhone",
identity: "iPhone/iPod"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
BrowserDetect.init();
function AllGeometryComplete() {
window.scene.groupApplyState('Defer_ON');
setTimeout(function () {
}, 2);
}
var dragCursor;
var curBrowser = BrowserDetect.browser;
// IE doesn't support co-ordinates
var cursCoords = (curBrowser == "Explorer") ? "" : " 4 4";
function handClosed() {
dragCursor = (curBrowser == "Firefox") ? "-moz-grabbing" : "url(images/closedhand.cur)" + cursCoords + ", move";
if (curBrowser == "Opera") dragCursor = "move";
document.getElementById("infinityrt-canvas").style.cursor = dragCursor;
document.getElementById("img-canvas").style.cursor = dragCursor;
}
function handOpen() {
dragCursor = (curBrowser == "Firefox") ? "-moz-grab" : "url(images/openhand.cur)" + cursCoords + ", move";
document.getElementById("infinityrt-canvas").style.cursor = dragCursor;
document.getElementById("img-canvas").style.cursor = dragCursor;
}
var jsonobject;
function getCameraValues(uijson) {
var jsonhttp = new XMLHttpRequest();
jsonhttp.skin = this;
jsonhttp.open("GET", uijson, true);
jsonhttp.onload = function (e) {
if (jsonhttp.status >= 200 && jsonhttp.status <= 299) {
var s = jsonhttp.skin;
jsonobject = JSON.parse(jsonhttp.response);
}
};
jsonhttp.send("");
}
window.addEventListener('DOMContentLoaded', function () {
getCameraValues("./model_gl/config.json");
});
window.GotoPosInTimeNamedValue = (gotoposname, onComplete, onSample) => {
const urlParams = new URLSearchParams(window.location.search);
const myParam = urlParams.get('selfcheck');
if (!myParam) {
}
var opt = undefined, gp = jsonobject.positions[gotoposname];
if (gp.fovy && scene.fovy != gp.fovy)
opt = { fovy: gp.fovy };
if (gp.pos.length > 5) {
if (!opt)
opt = {};
opt.zang = gp.pos[5];
}
if (window.Animation == 'off') { gp.time = 0; }
else { gp.time = 1500; }
if (window.mob) {
if((gotoposname == "Render_Cam_F20_Interior")){
scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4] + 85, gp.time, onComplete, slowinout2, opt);
}else{
scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4] + 20, gp.time, onComplete, slowinout2, opt);
}
}
else if (window.isipad) {
if((gotoposname == "Render_Cam_F20_Interior")){
scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4] + 65, gp.time, onComplete, slowinout2, opt);
}
else if((gotoposname == "Render_Cam_F01_Software")){
scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4] + 100, gp.time, onComplete, slowinout2, opt);
}
else{
scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4] + 35, gp.time, onComplete, slowinout2, opt);
}
}
else if (window.isMac || (window.innerWidth <= 1440 && window.innerHeight <= 1024) && (!window.mob && !window.isipad)) {
if((gotoposname == "Render_Cam_F20_Interior")){
scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4] + 50, gp.time, onComplete, slowinout2, opt)
}else {
scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4], gp.time, onComplete, slowinout2, opt);
}
}
else {
scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4], gp.time, onComplete, slowinout2, opt);
}
// scene.gotoPosInTime(gp.pos[0], gp.pos[1], gp.pos[2], gp.pos[3], gp.pos[4], gp.time, onComplete, slowinout2, opt);
}
function slowinout2(x) {
var a = 4.0;
var x2 = 1.0 - x;
var px = Math.pow(x, a);
var px2 = Math.pow(x2, a);
return px / (px + px2);
}
ctxCallouts = null;
var portClicked = '';
function hotspotPosAsignment() {
calloutcanvas = window.document.getElementById("calloutcanvas");
ctxCallouts = calloutcanvas.getContext("2d");
ctxCallouts.resetTransform();
ctxCallouts.clearRect(0, 0, calloutcanvas.width, calloutcanvas.height);
if (window.mob) {
//console.log("mob")
if (portClicked.id == 'front') {
let FrontPortsLeft = null;
HS_SimpleCalloutCircle([0, -10], 0, -10, "Hotspot_Front_2", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([0, -10], 0, -10, "Hotspot_Front_1", "2", "", "center", 0, 10, 0)//circle2
HS_SimpleCalloutCircle([-30, 0], -30, 0, "Hotspot_Front_6", "3", "", "center", 0, 10, 0)//circle3
HS_SimpleCalloutCircle([-22, -10], -22, -10, "Hotspot_Front_5", "4", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-18, -90], -18, -90, "Hotspot_Front_4", "5", "", "center", 0, 10, 0)//circle5
HS_SimpleCalloutCircle([-18, 50], -18, 50, "Hotspot_Front_4", "5", "", "center", 0, 10, 0)//circle5
}
else if (portClicked.id == "rear") {
let RearPortsLeft = null;
HS_SimpleCalloutCircle([0, -30], 0, -30, "Hotspot_Back_1", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([0, -30], 0, -30, "Hotspot_Back_2", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([40, 10], 40, 10, "Hotspot_Back_10", "2", "", "center", 0, 10, 0)//circle2
HS_SimpleCalloutCircle([40, -15], 40, -15, "Hotspot_Back_9", "3", "", "center", 0, 10, 0)//circle3
HS_SimpleCalloutCircle([-3,-20], -3,-20, "Hotspot_Back_14", "4", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-3, -20], -3, -20, "Hotspot_Back_3", "5", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-10, 15], -10, 15, "Hotspot_Back_11", "6", "", "center", 0, 10, 0)//circle5
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_4", "7", "", "center", 0, 10, 0)//circle6
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_5", "8", "", "center", 0, 10, 0)//circle7
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_6", "9", "", "center", 0, 10, 0)//circle8
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_7", "10", "", "center", 0, 10, 0)//circle9
HS_SimpleCalloutCircle([0,30], 0,30, "Hotspot_Back_8", "11", "", "center", 0, 10, 0)//circle10
HS_SimpleCalloutCircle([0,1], 0,1, "Hotspot_Back_13", "12", "", "center", 0, 10, 0)//circle11
}
else if (portClicked.id == "processor") {
HS_SimpleCalloutCircle([-38, 0], -38, 0, "Hotspot_Int_1", "1", "", "center", 0, 10, 0)//circle1
}
else if (portClicked.id == "memory") {
HS_SimpleCalloutCircle([0, 10], 0, 10, "Hotspot_Int_2", "1", "", "center", 0, 10, 0)//circle1
}
else if (portClicked.id == "fans") {
HS_SimpleCalloutCircle([0, -1], 0, -1, "Hotspot_Int_7", "1", "", "center", 0, 10, 0)//circle1
}
}
else if (window.isipad) {
console.log("ipad ")
if (window.innerWidth > window.innerHeight) {
if (portClicked.id == 'front') {
let FrontPortsLeft = null;
HS_SimpleCalloutCircle([0, -10], 0, -10, "Hotspot_Front_2", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([0, -10], 0, -10, "Hotspot_Front_1", "2", "", "center", 0, 10, 0)//circle2
HS_SimpleCalloutCircle([-30, 0], -30, 0, "Hotspot_Front_6", "3", "", "center", 0, 10, 0)//circle3
HS_SimpleCalloutCircle([-22, -10], -22, -10, "Hotspot_Front_5", "4", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-18, -90], -18, -90, "Hotspot_Front_4", "5", "", "center", 0, 10, 0)//circle5
HS_SimpleCalloutCircle([-18, 50], -18, 50, "Hotspot_Front_4", "5", "", "center", 0, 10, 0)//circle5
}
else if (portClicked.id == "rear") {
let RearPortsLeft = null;
HS_SimpleCalloutCircle([0, -30], 0, -30, "Hotspot_Back_1", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([0, -30], 0, -30, "Hotspot_Back_2", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([40, 10], 40, 10, "Hotspot_Back_10", "2", "", "center", 0, 10, 0)//circle2
HS_SimpleCalloutCircle([40, -15], 40, -15, "Hotspot_Back_9", "3", "", "center", 0, 10, 0)//circle3
HS_SimpleCalloutCircle([-3,-20], -3,-20, "Hotspot_Back_14", "4", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-3, -20], -3, -20, "Hotspot_Back_3", "5", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-10, 15], -10, 15, "Hotspot_Back_11", "6", "", "center", 0, 10, 0)//circle5
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_4", "7", "", "center", 0, 10, 0)//circle6
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_5", "8", "", "center", 0, 10, 0)//circle7
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_6", "9", "", "center", 0, 10, 0)//circle8
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_7", "10", "", "center", 0, 10, 0)//circle9
HS_SimpleCalloutCircle([0,30], 0,30, "Hotspot_Back_8", "11", "", "center", 0, 10, 0)//circle10
HS_SimpleCalloutCircle([0,1], 0,1, "Hotspot_Back_13", "12", "", "center", 0, 10, 0)//circle11
}
else if (portClicked.id == "processor") {
HS_SimpleCalloutCircle([-38, 0], -38, 0, "Hotspot_Int_1", "1", "", "center", 0, 10, 0)//circle1
}
else if (portClicked.id == "memory") {
HS_SimpleCalloutCircle([0, 10], 0, 10, "Hotspot_Int_2", "1", "", "center", 0, 10, 0)//circle1
}
else if (portClicked.id == "fans") {
HS_SimpleCalloutCircle([0, -1], 0, -1, "Hotspot_Int_7", "1", "", "center", 0, 10, 0)//circle1
}
}
else if (window.innerHeight > window.innerWidth) {
if (portClicked.id == 'front') {
let FrontPortsLeft = null;
HS_SimpleCalloutCircle([0, -10], 0, -10, "Hotspot_Front_2", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([0, -10], 0, -10, "Hotspot_Front_1", "2", "", "center", 0, 10, 0)//circle2
HS_SimpleCalloutCircle([-30, 0], -30, 0, "Hotspot_Front_6", "3", "", "center", 0, 10, 0)//circle3
HS_SimpleCalloutCircle([-22, -10], -22, -10, "Hotspot_Front_5", "4", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-18, -90], -18, -90, "Hotspot_Front_4", "5", "", "center", 0, 10, 0)//circle5
HS_SimpleCalloutCircle([-18, 50], -18, 50, "Hotspot_Front_4", "5", "", "center", 0, 10, 0)//circle5
}
else if (portClicked.id == "rear") {
let RearPortsLeft = null;
HS_SimpleCalloutCircle([0, -30], 0, -30, "Hotspot_Back_1", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([0, -30], 0, -30, "Hotspot_Back_2", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([40, 10], 40, 10, "Hotspot_Back_10", "2", "", "center", 0, 10, 0)//circle2
HS_SimpleCalloutCircle([40, -15], 40, -15, "Hotspot_Back_9", "3", "", "center", 0, 10, 0)//circle3
HS_SimpleCalloutCircle([-3,-20], -3,-20, "Hotspot_Back_14", "4", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-3, -20], -3, -20, "Hotspot_Back_3", "5", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-10, 15], -10, 15, "Hotspot_Back_11", "6", "", "center", 0, 10, 0)//circle5
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_4", "7", "", "center", 0, 10, 0)//circle6
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_5", "8", "", "center", 0, 10, 0)//circle7
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_6", "9", "", "center", 0, 10, 0)//circle8
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_7", "10", "", "center", 0, 10, 0)//circle9
HS_SimpleCalloutCircle([0,30], 0,30, "Hotspot_Back_8", "11", "", "center", 0, 10, 0)//circle10
HS_SimpleCalloutCircle([0,1], 0,1, "Hotspot_Back_13", "12", "", "center", 0, 10, 0)//circle11
}
else if (portClicked.id == "processor") {
HS_SimpleCalloutCircle([-38, 0], -38, 0, "Hotspot_Int_1", "1", "", "center", 0, 10, 0)//circle1
}
else if (portClicked.id == "memory") {
HS_SimpleCalloutCircle([0, 10], 0, 10, "Hotspot_Int_2", "1", "", "center", 0, 10, 0)//circle1
}
else if (portClicked.id == "fans") {
HS_SimpleCalloutCircle([0, -1], 0, -1, "Hotspot_Int_7", "1", "", "center", 0, 10, 0)//circle1
}
}
}
else {
//this if condition for resize only
if (window.innerHeight > window.innerWidth) {
console.log('desktop resize')
// if (window.innerWidth < 925) {
// if (portClicked.id == 'quickAccessPorts') {
// HS_SimpleCalloutCircle([-15, 0], -15, 0, "hotspot4", "1", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([-15, 0], -15, 0, "hotspot5", "2", "", "center", 0, 10, 0)//circle1
// }
// else if (portClicked.id == 'topView') {
// HS_SimpleCalloutCircle([1, 0], 1, 0, "hotspot6", "1", "", "center", 0, 10, 0)//circle1
// }
// else if (portClicked.id == "back") {
// HS_SimpleCalloutCircle([-23, -20], -23, -20, "hotspot7", "1", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([-23, -20], -23, -20, "hotspot8", "2", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([-15, 0], -15, 0, "hotspot10", "3", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([-15, 0], -15, 0, "hotspot11", "4", "", "center", 0, 10, 0)//circle1
// }
// else if (portClicked.id == "ports") {
// console.log('desktop resize')
// HS_SimpleCalloutCircle([-15, 0], -15, 0, "HotspotPort1", "1", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([-25, 0], -25, 0, "HotspotPort2", "2", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 15], 0, 15, "HotspotPort3", "3", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 13], 0, 13, "HotspotPort4", "4", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 13], 0, 13, "HotspotPort5", "5", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 13], 0, 13, "HotspotPort6", "6", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 13], 0, 13, "HotspotPort7", "7", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 13], 0, 13, "HotspotPort8", "8", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 13], 0, 13, "HotspotPort9", "9", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 13], 0, 13, "HotspotPort10", "7", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0, 1], 0, 1, "HotspotPort11", "10", "", "center", 0, 10, 0)//circle1
// HS_SimpleCalloutCircle([0,1], 0, 1, "HotspotPort12", "10", "", "center", 0, 10, 0)//circle1
// // //circle11
// }
// }
}
else {
// desktop
if (portClicked.id == 'front') {
let FrontPortsLeft = null;
HS_SimpleCalloutCircle([0, -10], 0, -10, "Hotspot_Front_2", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([0, -10], 0, -10, "Hotspot_Front_1", "2", "", "center", 0, 10, 0)//circle2
HS_SimpleCalloutCircle([-30, 0], -30, 0, "Hotspot_Front_6", "3", "", "center", 0, 10, 0)//circle3
HS_SimpleCalloutCircle([-22, -10], -22, -10, "Hotspot_Front_5", "4", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-18, -90], -18, -90, "Hotspot_Front_4", "5", "", "center", 0, 10, 0)//circle5
HS_SimpleCalloutCircle([-18, 50], -18, 50, "Hotspot_Front_4", "5", "", "center", 0, 10, 0)//circle5
}
else if (portClicked.id == "rear") {
let RearPortsLeft = null;
HS_SimpleCalloutCircle([0, -30], 0, -30, "Hotspot_Back_1", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([0, -30], 0, -30, "Hotspot_Back_2", "1", "", "center", 0, 10, 0)//circle1
HS_SimpleCalloutCircle([40, 10], 40, 10, "Hotspot_Back_10", "2", "", "center", 0, 10, 0)//circle2
HS_SimpleCalloutCircle([40, -15], 40, -15, "Hotspot_Back_9", "3", "", "center", 0, 10, 0)//circle3
HS_SimpleCalloutCircle([-3,-20], -3,-20, "Hotspot_Back_14", "4", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-3, -20], -3, -20, "Hotspot_Back_3", "5", "", "center", 0, 10, 0)//circle4
HS_SimpleCalloutCircle([-10, 15], -10, 15, "Hotspot_Back_11", "6", "", "center", 0, 10, 0)//circle5
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_4", "7", "", "center", 0, 10, 0)//circle6
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_5", "8", "", "center", 0, 10, 0)//circle7
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_6", "9", "", "center", 0, 10, 0)//circle8
HS_SimpleCalloutCircle([18,0], 18,0, "Hotspot_Back_7", "10", "", "center", 0, 10, 0)//circle9
HS_SimpleCalloutCircle([0,30], 0,30, "Hotspot_Back_8", "11", "", "center", 0, 10, 0)//circle10
HS_SimpleCalloutCircle([0,1], 0,1, "Hotspot_Back_13", "12", "", "center", 0, 10, 0)//circle12
}
else if (portClicked.id == "processor") {
HS_SimpleCalloutCircle([-38, 0], -38, 0, "Hotspot_Int_1", "1", "", "center", 0, 10, 0)//circle1
}
else if (portClicked.id == "memory") {
HS_SimpleCalloutCircle([130, 30], 130, 30, "Hotspot_Int_2", "1", "", "center", 0, 10, 0)//circle1
}
else if (portClicked.id == "fans") {
HS_SimpleCalloutCircle([-70, -10], -70, -10, "Hotspot_Int_7", "1", "", "center", 0, 10, 0)//circle1
}
}
}
}
function HS_SimpleCallout(pt, horizontalShift, verticalShift, hotspotname, txtNum, txtValue, txtAlign, txtDist, maxWidth, textHorizontalShift) {
if (textHorizontalShift == undefined) textHorizontalShift = 0;
var npt = [pt[0], pt[1]];
var nptlen = Math.sqrt(npt[0] * npt[0] + npt[1] * npt[1]);
npt[0] /= nptlen;
npt[1] /= nptlen;
HS_SetOriginFromHotspot(hotspotname);
HS_DrawLine(pt, [horizontalShift, verticalShift]);
if (txtNum != '') {
ctxCallouts.fillStyle = '#d8d8d8';
HS_DrawCircle([pt[0] + 5 * npt[0], pt[1] + 5 * npt[1]], 13);
ctxCallouts.fillStyle = 'black';
HS_DrawText([pt[0] + 5 * npt[0] + 1, pt[1] + 5 * npt[1] + 1], txtNum, "Roboto", 13, "center");
}
if (mob) {
HS_DrawText([pt[0] + ((txtDist) * npt[0]) + textHorizontalShift, pt[1] + (5 + txtDist) * npt[1]], txtValue, "Roboto", 10, txtAlign, maxWidth);
}
else if (isipad) {
HS_DrawText([pt[0] + ((txtDist) * npt[0]) + textHorizontalShift, pt[1] + (5 + txtDist) * npt[1]], txtValue, "Roboto", 13, txtAlign, maxWidth);
}
else {
HS_DrawText([pt[0] + ((txtDist) * npt[0]) + textHorizontalShift, pt[1] + (5 + txtDist) * npt[1]], txtValue, "Roboto", 13, txtAlign, maxWidth);
}
}
//for circleDraw
function HS_SimpleCalloutCircle(pt, horizontalShift, verticalShift, hotspotname, txtNum, txtValue, txtAlign, txtDist, maxWidth, textHorizontalShift) {
if (textHorizontalShift == undefined) textHorizontalShift = 0;
var npt = [pt[0], pt[1]];
var nptlen = Math.sqrt(npt[0] * npt[0] + npt[1] * npt[1]);
npt[0] /= nptlen;
npt[1] /= nptlen;
HS_SetOriginFromHotspot(hotspotname);
HS_DrawLine(pt, [horizontalShift, verticalShift]);
if (txtNum != '') {
ctxCallouts.fillStyle = '#EEEEEE';
HS_DrawCircle([pt[0] + 5 * npt[0], pt[1] + 5 * npt[1]], 10);
ctxCallouts.fillStyle = 'black';
HS_DrawText([pt[0] + 5 * npt[0] + 1, pt[1] + 5 * npt[1] + 1], txtNum, "Roboto", 12, "center");
}
}
var lineHeight;
if (mob) {
lineHeight = 11;
}
else if (isipad) {
lineHeight = 15;
}
else {
lineHeight = 20;
}
function HS_SetOriginFromHotspot(name) {
var pos2D = scene.projectPoint(scene.getObjectLocation(name, true));
pos2D[0] = pos2D[0] * 0.5 + 0.5;
pos2D[1] = pos2D[1] * 0.5 + 0.5;
pos2D[1] = 1.0 - pos2D[1];
pos2D[0] *= calloutcanvas.width;
pos2D[1] *= calloutcanvas.height;
HS_SetOrigin(pos2D);
ctxCallouts.fillStyle = 'black';
}
function HS_SetOrigin(pt) {
ctxCallouts.resetTransform();
ctxCallouts.translate(pt[0], pt[1]);
var scale = calloutcanvas.height / 800;
ctxCallouts.scale(scale, scale);
}
function HS_DrawLine(pt0, pt1) {
ctxCallouts.strokeStyle = '#979797';
ctxCallouts.beginPath();
ctxCallouts.moveTo(pt0[0], pt0[1]);
ctxCallouts.lineTo(pt1[0], pt1[1]);
ctxCallouts.stroke();
//ctxCallouts.strokeStyle = '#0076CE';
}
function HS_DrawRect(x, y, width, height) {
ctxCallouts.fillStyle = "#EEEEEE";
ctxCallouts.fillRect(x, y, width, height);
// ctxCallouts.strokeStyle = '#0076CE';
// ctxCallouts.beginPath();
// ctxCallouts.strokeStyle = "red";
// ctxCallouts.rect(x,y,width,height);
// ctxCallouts.stroke();
}
function HS_DrawLine_blue(pt0, pt1) {
ctxCallouts.strokeStyle = 'blue';
ctxCallouts.beginPath();
ctxCallouts.moveTo(pt0[0], pt0[1]);
ctxCallouts.lineTo(pt1[0], pt1[1]);
ctxCallouts.stroke();
//ctxCallouts.strokeStyle = '#0076CE';
}
function HS_DrawLine2(pt0, pt1) {
ctxCallouts.beginPath();
ctxCallouts.moveTo(pt0[0], pt0[1]);
ctxCallouts.lineTo(pt1[0], pt1[1]);
ctxCallouts.stroke();
//ctxCallouts.strokeStyle = '#0076CE';
ctxCallouts.strokeStyle = 'blue';
}
function HS_DrawCircle(pt, radius) {
ctxCallouts.beginPath();
ctxCallouts.ellipse(pt[0], pt[1], radius, radius, 0, 0, 2 * Math.PI);
ctxCallouts.fill();
}
function HS_DrawText(pt, text, font, fontsize, txtalign, maxWidth, lineHeight, linheight) {
ctxCallouts.font = fontsize + "px " + font;
ctxCallouts.textAlign = txtalign;
ctxCallouts.textBaseline = 'middle';
ctxCallouts.lineHeight = linheight + "px ";
//ctxCallouts.style.letterSpacing = 10 + "px ";
//if(text.indexOf("
")) {console.log(text.indexOf("
"))};
var words = text.split(' ');
// if (calloutsRTL == true) {
// if (words.length == 1) {
// ctxCallouts.direction = 'ltr';
// } else {
// ctxCallouts.direction = 'rtl';
// }
// }
var line = '';
//console.log(words)
for (var n = 0; n < words.length; n++) {
var testLine = line + words[n] + ' ';
var metrics = ctxCallouts.measureText(testLine);
var testWidth = metrics.width;
if (testWidth > maxWidth && n > 0 || words[n] == '
') {
if (words[n] == '
') words[n] = '';
ctxCallouts.fillText(line, pt[0], pt[1]);
if (words[n] != '
') {
line = words[n] + ' ';
}
pt[1] += lineHeight;
} else {
line = testLine;
}
}
ctxCallouts.fillText(line, pt[0], pt[1]);
}
var calloutcanvas = null,
ctxCallouts = null;
var hotspotOn;
function setHotSpot(divid, hotsoptName, leftNum, topNum, hotspotopacityspeed) {
var leftNumHolder = leftNum;
var viewCameraZV = [sceneViewMatrix[8], sceneViewMatrix[9], sceneViewMatrix[10]];
var hotspotopacityspeedConst = 3.0;
var pos2Dpoint = [];
var norm3Dpoint1 = scene.projectPoint(scene.getObjectLocation(hotsoptName, true));
var hotspotopacity1 = infinityrt_dp(norm3Dpoint1, viewCameraZV) * hotspotopacityspeedConst - hotspotopacityspeed;
if (hotspotopacity1 > 0 && (hotspotOn == false)) hotspotopacity1 = 1.0;
if (hotspotopacity1 < 0.0) hotspotopacity1 = 1.0;
else if (hotspotopacity1 > 1.0) hotspotopacity1 = 1.0;
if (document.getElementById(divid)) {
document.getElementById(divid).style.opacity = hotspotopacity1;
}
var hotspotClass = document.getElementsByClassName("hotspots");
if (hotspotopacity1 == 0) {
}
else {
if (document.getElementById(divid)) {
var allPopup = document.querySelector('.popup.active');
}
}
pos2Dpoint = scene.projectPoint(scene.getObjectLocation(hotsoptName, true));
calloutcanvas = window.document.getElementById("calloutcanvas");
pos2Dpoint[0] = pos2Dpoint[0] * 0.5 + 0.5;
pos2Dpoint[1] = pos2Dpoint[1] * 0.5 + 0.5;
pos2Dpoint[1] = 1.0 - pos2Dpoint[1];
pos2Dpoint[0] *= calloutcanvas.width;
pos2Dpoint[1] *= calloutcanvas.height;
if (document.getElementById(divid)) {
if (window.devicePixelRatio >= 2) {
pos2Dpoint[0] = pos2Dpoint[0] / 2;
}
window.document.getElementById(divid).style.left = (pos2Dpoint[0] + leftNumHolder + 'px');
}
}
window.addEventListener("DOMContentLoaded", (function () {
getCameraValues("./model_gl/config.json")
}));
window.addEventListener("DOMContentLoaded", (function () {
if (document.getElementById("close")) {
document.getElementById("close").addEventListener('click', function () {
this.parentElement.classList.remove('active');
});
}
if (document.getElementById("btnXR-iphone")) {
document.getElementById("btnXR-iphone").addEventListener("click", function () {
window.usdzRTClicked();
});
document.getElementById('btnXR-iphone').style.display = "inline-block";
}
if (document.getElementById("btnXR-ipad")) {
document.getElementById("btnXR-ipad").addEventListener("click", function () {
window.usdzRTClicked();
});
document.getElementById('btnXR-ipad').style.display = "inline-block";
}
}));
const fadeIn = (callback) => {
console.log("Fade In --");
document.getElementById("fadeInOut").style.zIndex = 99;
document.getElementById("fadeInOut").style.opacity = 1;
document.getElementById("fadeInOut").style.transition = "all 0.5s";
window.setTimeout(callback, 500);
}
const fadeOut = () => {
console.log("Fade Out --");
document.getElementById("fadeInOut").style.zIndex = 0;
document.getElementById("fadeInOut").style.opacity = 0;
document.getElementById("fadeInOut").style.transition = "all 0.5s";
}
//create your own functions for cameras
window.hidePopUp = () => {
var allPopup = document.querySelector('.popup.active');
if (allPopup != null) {
allPopup.classList.remove('active');
}
var popup = document.querySelectorAll('.popup.active');
for (var i = 0; i <= popup.length - 1; i++) {
popup[i].classList.remove('active');
}
portClicked = '';
}
// code of language translation
window.getLangUrl = () => {
var queryString = window.location.href.split('?')[1];
let userLang;
let isUserLang;
if (queryString) {
var params = queryString.split('&');
for (var i = 0; i < params.length; i++) {
if (params[i].toLowerCase().indexOf("locale=") >= 0) {
userLang = params[i].replace("locale=", "");
isUserLang = true;
break;
}
}
if (!isUserLang) {
userLang = "EN";
}
} else {
userLang = "EN";
}
return userLang.toUpperCase();
}
// reflection hide code
var reflectionHide;
var refStatus = true;
var refport = false;
function ReflectionHide() {
// console.log(menu_object)
if (scene._nav._navXAng < -0.029196000000000017 && (refStatus == true )) {
window.scene.groupApplyState('REFLECTION_OFF');
refStatus = false;
}
else if (scene._nav._navXAng >= -0.029196000000000017 && refStatus != true) {
if (refport == true) {
window.scene.groupApplyState('REFLECTION_OFF');
}
else {
window.scene.groupApplyState('REFLECTION_ON');
refStatus = true;
}
}
}
// code to reset animations
window.resetAnimAll = () => {
// console.log("check reset");
if (window.scene.animIsPlaying("Height_Anime")) window.scene.getAnim("Height_Anime").stop();
if (window.scene.animIsPlaying("Swivel_anim")) window.scene.getAnim("Swivel_anim").stop();
if (window.scene.animIsPlaying("Tilt_Anime_Stand")) window.scene.getAnim("Tilt_Anime_Stand").stop();
if (window.scene.animIsPlaying("Pivot_anim")) window.scene.getAnim("Pivot_anim").stop();
window.scene.clearRefine();
};
// function to hide dimension
window.hideDimension = () => {
window.scene.groupApplyState("HEIGHT_DIMENSION_OFF");
window.scene.groupApplyState("SLANT_DIMENSION_OFF");
window.scene.groupApplyState("SWIVEL_DIMENSION_OFF");
window.scene.groupApplyState("TILT_DIMENSION_OFF");
window.scene.clearRefine();
}
window.portFirstClick = false;
window.hideSoft = () => {
document.getElementById("iAutomationTool").style.display = "none";
document.getElementById("cResiliencyTool").style.display = "none";
document.getElementById("processorText").style.display = "none";
}
// In this function we have call camera angles, state buttons, animations objects from data json file
var prevParentFunction = '';
window.execute_all = (menu_object, parentFunction) => {
resizeCanvas();
if(parentFunction != undefined) prevParentFunction = parentFunction;
AnimComplated = false;
if (menu_object == undefined) {
return false;
}
if((!window.mob || !window.isipad) && (window.innerHeight < window.innerWidth)){
if(menu_object.id == "embeddedManagement" || menu_object.id == "openManageTools"){
window.scene._nav._panMax = [14,18]; //[left, bottom];
window.scene._nav._panMin = [-28.5,8]; //[right, top];
window.scene._nav._navMinDolly = 20; //50
window.scene._nav._navMaxDolly = 36; //50
}else {
window.scene._nav._panMax = [14,20]; //[left, bottom];
window.scene._nav._panMin = [-14,8]; //[right, top];
window.scene._nav._navMinDolly = 13; //50
window.scene._nav._navMaxDolly = 36; //50
}
}
if (window.mob || window.isipad) {
if(menu_object.id == "embeddedManagement" || menu_object.id == "openManageTools"){
window.scene._nav._navMinDolly = 190; //50
window.scene._nav._navMaxDolly = 360; //50
window.scene._nav._panMax = [14,18]; //[left, bottom];
window.scene._nav._panMin = [-28,8]; //[right, top];
}else {
window.scene._nav._navMinDolly = 100; //50
window.scene._nav._navMaxDolly = 300; //50
window.scene._nav._panMax = [14,18]; //[left, bottom];
window.scene._nav._panMin = [-14,8]; //[right, top];
}
}
// console.log(menu_object.id);
zoonOutCamStatus = menu_object.zoomOutCamerStatus;
zoomOutCam = menu_object.zoomOutCameraName;
zoomOutPort = menu_object.id;
// this code is used to keep pop unhide when we double click on same view
if (window.prevID !== window.currID) {
window.hidePopUp();
portClicked = '';
}
// portFirstClick is used to avoid re-camera angle set for port view
portFirstClick = false;
console.log('prevParentFunction', prevParentFunction)
console.log('parentFunction', parentFunction)
if(parentFunction != 'onReset') resetAnimAll();
menu_object.before_cam_state_buttons && menu_object.before_cam_state_buttons.map((before_states) => {
window.scene.groupApplyState(before_states);
})
// code to stop animations
menu_object.animations_stop && menu_object.animations_stop.map((animations_stop) => {
window.scene.animPlayInTime(animations_stop, menu_object['animvale_stop'], window.Animation == 'on' ? 1 : 1);
})
// code for animations before camera angles
// menu_object.animations_before_cam && menu_object.animations_before_cam.map((animations_before_cam) => {
// window.scene.animPlayAllChildrenInTime(animations_before_cam, menu_object['animvale_before_cam'], 0);
// })
if((window.mob || window.isipad) && (window.innerHeight > window.innerWidth)){
if((menu_object.id === 'embeddedManagement' || menu_object.id === 'openManageTools')){
menu_object['mobCameraName'] && window.GotoPosInTimeNamedValue(menu_object['mobCameraName'], function () {
menu_object.inside_cam_state_buttons && menu_object.inside_cam_state_buttons.map((inside_states) => {
window.scene.groupApplyState(inside_states);
})
// code for animations
menu_object.animations && menu_object.animations.map((animations) => {
// window.scene.animPlayAllChildrenInTime(animations, menu_object['animvale'], window.Animation == 'on' ? 1000 : 1, function(){
window.scene.animPlayInTime(animations,menu_object['animvale'],window.Animation == 'on' ? 1000 : 1, function(){
menu_object.after_cam_state_buttons && menu_object.after_cam_state_buttons.map((after_states) => {
window.scene.groupApplyState(after_states);
})
});
})
});
}else {
menu_object['cameraName'] && window.GotoPosInTimeNamedValue(menu_object['cameraName'], function () {
// state button in callback
menu_object.inside_cam_state_buttons && menu_object.inside_cam_state_buttons.map((inside_states) => {
window.scene.groupApplyState(inside_states);
})
// code for animations
menu_object.animations && menu_object.animations.map((animations) => {
// window.scene.animPlayAllChildrenInTime(animations, menu_object['animvale'], window.Animation == 'on' ? 1000 : 1, function(){
window.scene.animPlayInTime(animations,menu_object['animvale'],window.Animation == 'on' ? 1000 : 1, function(){
menu_object.after_cam_state_buttons && menu_object.after_cam_state_buttons.map((after_states) => {
window.scene.groupApplyState(after_states);
})
});
})
})
}
}else {
menu_object['cameraName'] && window.GotoPosInTimeNamedValue(menu_object['cameraName'], function () {
// state button in callback
menu_object.inside_cam_state_buttons && menu_object.inside_cam_state_buttons.map((inside_states) => {
window.scene.groupApplyState(inside_states);
})
// code for animations
menu_object.animations && menu_object.animations.map((animations) => {
// window.scene.animPlayAllChildrenInTime(animations, menu_object['animvale'], window.Animation == 'on' ? 1000 : 1, function(){
window.scene.animPlayInTime(animations,menu_object['animvale'],window.Animation == 'on' ? 1000 : 1, function(){
menu_object.after_cam_state_buttons && menu_object.after_cam_state_buttons.map((after_states) => {
window.scene.groupApplyState(after_states);
})
});
})
})
}
window.scene.clearRefine();
window.hideSoft();
// code related to show callouts in box div
setTimeout(() => {
// for hotspot
// added this condition for showing the hostspot after the animation complete for quick access port only
if (window.mob || (window.isipad && window.innerHeight> window.innerWidth)) {
document.getElementById("iAutomationTool").style.display = "none";
document.getElementById("cResiliencyTool").style.display = "none";
}else {
if(menu_object.id === 'embeddedManagement'){
document.getElementById("iAutomationTool").style.display = "block";
}
else if(menu_object.id === 'openManageTools'){
document.getElementById("cResiliencyTool").style.display = "block";
}
}
if(menu_object.id === 'processor'){
document.getElementById("processorText").style.display = "block";
}
portClicked = menu_object;
if (menu_object['content'] && menu_object['popupVisibility'] && window.innerWidth > window.innerHeight) {
popupContent = `