diff --git a/js/histojs/designFunctionsv4.js b/js/histojs/designFunctionsv4.js index e65579f..a3e1985 100644 --- a/js/histojs/designFunctionsv4.js +++ b/js/histojs/designFunctionsv4.js @@ -608,7 +608,7 @@ */ enforcedTriggerHint = ( hintMessage = "", messageType = 'info') => { - var defer = $.Deferred(); + let defer = $.Deferred(); switch(messageType) { case 'info': @@ -939,7 +939,7 @@ */ showScreenLogo = () => { - screenLogoElem = document.getElementById("screenLogo"); + let screenLogoElem = document.getElementById("screenLogo"); screenLogoElem.className = "screen-logo"; screenLogoElem.style.display = 'block'; } @@ -984,7 +984,7 @@ * */ removeScreenLogo = () => { - screenLogoElem = document.getElementById("screenLogo"); + let screenLogoElem = document.getElementById("screenLogo"); if(screenLogoElem) { // if it is not removed before screenLogoElem.parentNode.removeChild(screenLogo); @@ -1019,7 +1019,7 @@ */ viewerZoomIn = () => { - var zoomValue = viewer.viewport.getZoom(); + let zoomValue = viewer.viewport.getZoom(); if((zoomValue*2) < viewer.viewport.getMaxZoom()) { viewerZoomTo(zoomValue * 2); @@ -1039,7 +1039,7 @@ */ viewerZoomOut = () => { - var zoomValue = viewer.viewport.getZoom(); + let zoomValue = viewer.viewport.getZoom(); if((zoomValue / 2) > viewer.viewport.getMinZoom() ) { viewerZoomTo(zoomValue / 2); @@ -1077,7 +1077,7 @@ */ initialZoom = () => { - var zoomValue = viewer.viewport.getHomeZoom(); + let zoomValue = viewer.viewport.getHomeZoom(); if( (zoomValue * 2) < viewer.viewport.getMaxZoom() ) { viewerZoomTo( zoomValue * 2 ); @@ -1137,8 +1137,8 @@ * */ goToRemoteItem = () => { - var hostUrl = getHostUrl(); - var item = getSelectedItem(); + let hostUrl = getHostUrl(); + let item = getSelectedItem(); window.open(hostUrl + "/#item/" + item._id); } @@ -1157,7 +1157,7 @@ if( !getActiveForm() ) { if(tempSceneSelections.length) { document.getElementById("grpName").value = suggestNewGrplabel(tempSceneSelections); - var grpForm = document.getElementById("grpLabelForm"); + let grpForm = document.getElementById("grpLabelForm"); grpForm.classList.remove("formflashanimation"); grpForm.style.display = "block"; getElementCenterOnScreen(grpForm); @@ -1262,12 +1262,12 @@ */ refineGrpChName = (channelName) => { - var refinedLabel = channelName; + let refinedLabel = channelName; if(channelName.includes(" ")) { if(channelName.split(" ")[1].length > 2) { if (!channelName.split(" ")[1].slice(0,1).match(/\d+/g)) { //Is first char after white space not integer - var secondLabel = channelName.split(" ")[1].slice(0,2) // secondLabel is the label after the space + let secondLabel = channelName.split(" ")[1].slice(0,2) // secondLabel is the label after the space refinedLabel = channelName.split(" ")[0] + " " + secondLabel; } } @@ -1296,9 +1296,9 @@ */ suggestNewGrplabel = (selectedChannels) => { - var grplabel = ""; + let grplabel = ""; - for (var index = 0; index < selectedChannels.length; index++) + for (let index = 0; index < selectedChannels.length; index++) { if( (grplabel.length + refineGrpChName(selectedChannels[index].channel_name).length )< currentItemInfo.maxGroupLabelLen) { grplabel = grplabel + refineGrpChName(selectedChannels[index].channel_name); @@ -1370,6 +1370,8 @@ /** * Add new group of channels to right panel of the design UI. + * tempSceneSelections is array of objects of selected channels of the new group + * tempSceneSelections e.g. [{ channel_name: "DAPI", channel_number: 0 }, { channel_name: "DAPI5", channel_number: 16 }] * * @function * @memberof HistoJS @@ -1380,11 +1382,11 @@ addNewGrpBtn = () => { if( document.getElementById("grpName").value != "") { document.getElementById("grpLabelForm").style.display = "none"; - let grpEntryColorArray = tempSceneSelections.length<=colorContrastMap.length? getArrayKeyValues(colorContrastMap, "color").splice(0, tempSceneSelections.length ) : createGrpColorsArray(tempSceneSelections.length); + let grpEntryColorArray = tempSceneSelections.length <= colorContrastMap.length ? getArrayKeyValues(colorContrastMap, "color").splice(0, tempSceneSelections.length ) : createGrpColorsArray(tempSceneSelections.length); - let grpEntryContrastMax = tempSceneSelections.length<=colorContrastMap.length? getArrayKeyValues(colorContrastMap, "contrast_Max").splice(0, tempSceneSelections.length ) : createContrastMaxArray(grpEntryColorArray); + let grpEntryContrastMax = tempSceneSelections.length <= colorContrastMap.length ? getArrayKeyValues(colorContrastMap, "contrast_Max").splice(0, tempSceneSelections.length ) : createContrastMaxArray(grpEntryColorArray); - let grpEntryContrastMin = tempSceneSelections.length<=colorContrastMap.length? getArrayKeyValues(colorContrastMap, "contrast_Min").splice(0, tempSceneSelections.length ) : createContrastMinArray(grpEntryColorArray) ; + let grpEntryContrastMin = tempSceneSelections.length <= colorContrastMap.length ? getArrayKeyValues(colorContrastMap, "contrast_Min").splice(0, tempSceneSelections.length ) : createContrastMinArray(grpEntryColorArray) ; let grpEntryMaxContrastMax = Array(tempSceneSelections.length).fill( document.getElementById("maxContrastRange").max ); @@ -2238,6 +2240,7 @@ /** * Delete a group of channels deleted from the right group panel + * * @function * @memberof HistoJS * @since 1.0.0 @@ -2320,7 +2323,7 @@ */ closeGrpForm = () => { - var grpForm = document.getElementById("grpLabelForm"); + let grpForm = document.getElementById("grpLabelForm"); if (grpForm.style.display === "block") { document.getElementById("grpName").value = ""; @@ -2342,7 +2345,7 @@ clearGrpBarRight = () => { if(!(document.getElementById("grpListViewBar").innerHTML === "")){ - var node = document.getElementById("grpListViewBarBtn"); + let node = document.getElementById("grpListViewBarBtn"); document.getElementById("grpListViewBar").innerHTML = "" document.getElementById("grpListViewBar").append(node) showPanel("chColorContrastPanel", false) @@ -2629,7 +2632,7 @@ */ getTileSource = (hostApi, itemId) => { - let tile=[]; + let tile = []; webix.ajax().sync().get(hostApi + "/item/" + itemId + "/tiles", (data) => { tile = JSON.parse(data); tile['maxLevel'] = tile['levels'] - 1; @@ -2852,10 +2855,10 @@ * @param {object} elem */ appendEmptyNode = (elem) => { - var nodeUl = document.createElement("UL"); - nodeUl.classList.add("nested") - var nodeLi = document.createElement("LI"); - var textnode = document.createTextNode("Empty"); + let nodeUl = document.createElement("UL"); + nodeUl.classList.add("nested"); + let nodeLi = document.createElement("LI"); + let textnode = document.createTextNode("Empty"); nodeLi.appendChild(textnode); nodeUl.appendChild(nodeLi); elem.appendChild(nodeUl); @@ -2897,21 +2900,21 @@ * @param {object} curLiElem */ onSelectedTreeFolder = (curLiElem) => { - var hostAPI = getHostApi(); - var folderId = curLiElem.id.split('_')[1]; - var nodes = ""; - var folderDetails = getFolderDetails(hostAPI, folderId); // e.g "nFolders": 0, "nItems": 1 + let hostAPI = getHostApi(); + let folderId = curLiElem.id.split('_')[1]; + let nodes = ""; + let folderDetails = getFolderDetails(hostAPI, folderId); // e.g "nFolders": 0, "nItems": 1 if((folderDetails.nItems || folderDetails.nFolders)) { nodes += '