Skip to content
Snippets Groups Projects
Commit 6a75d3b6 authored by Lucio Zambon's avatar Lucio Zambon
Browse files

Update panther2d.js

parent 0a5c9ea2
No related branches found
No related tags found
No related merge requests found
......@@ -286,7 +286,8 @@
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.documentElement.scrollHeight + 'px';
}
const latticeFile = document.location.href.split('?')[0].split('/').slice(0,-1).join('/')+'/'+machine+'_lattice.json';
let latticeFile = document.location.href.split('?')[0].split('/').slice(0,-1).join('/')+'/'+machine+'_lattice.json';
if (machine.indexOf('simulator_')>-1) {latticeFile = document.location.href.split('?')[0].split('/').slice(0,-1).join('/')+'/'+'simulator.php?lattice&machine='+machine.split('simulator_')[1];}
const menuParams = {machine: machineCaseSensitive.toLowerCase(), search: '', backgroundColor: '#333333'};
gui.title('PAnTHer - controls');
// if (navigator.userAgent.indexOf('Firefox/63')>-1) {$( "body" ).append('<button id="starter" style="align: center;height: 500px; width: 95%;background-color: #449944; font-size: 100px;" onClick="mystart()">START</button>');}
......@@ -591,7 +592,7 @@
$("#sname").on("keydown", searchText);
if (lattice.conf && lattice.conf.modules) {
for (let i=0; i<lattice.conf.modules.length; i++) {
window[lattice.conf.modules[i]](lattice, menuParams, compData);
window[lattice.conf.modules[i]+'2d'](lattice, menuParams, compData);
}
}
menuParams.gotoAdmin = function() {document.location = './admin.php';};
......@@ -767,7 +768,8 @@
x:0, y:0, style:"display: "+display, fill:"white", stroke:"#101020","stroke-width":0, "font-family":"Arial", "font-size":100*fontSize, "font-weight":"700",
"text-anchor": (labelReverse? "end": "start"),
transform: transformLabel(x, y, beta, labelReverse)
}, false, id, false, appendTo);
}, false, appendTo=="svg"? id: '', false, appendTo);
// }, false, id, false, appendTo);
}
function appendLabel2(param, labelclass, display, x, y, beta, labelReverse, suffix='label') {
const id = param.name;
......@@ -834,7 +836,7 @@
appendLabel(components[i].name, comp+' label '+section+facility+compClass, 'none', x, y, beta, components[i].labelReverse);
if (id[0].indexOf('<')==-1) {
appendSvg("g", {"id": id[0]+'_g'});
appendLabel('', comp+' value '+section+facility, 'none', x+600, y+400, 90, true, 'value', 0.7, '#'+id[0]+'_g');
appendLabel(components[i].name, comp+' value '+section+facility, 'none', x+600, y+400, 90, true, 'value', 0.7, '#'+id[0]+'_g');
}
names.push(id[0]);
shrinkedNames.push(shrinkName(id[0]));
......@@ -867,11 +869,11 @@
}
}
}
if (!String.prototype.replaceAll) {
/*if (!String.prototype.replaceAll) {
String.prototype.replaceAll = function(search, replace) {
return this.split(search).join(replace);
};
}
}*/
function extractId(name) {
if (name.indexOf('(')>-1) {
let tok = name.split('(');
......@@ -933,8 +935,8 @@
if (wall) {
console.log('w', w, sections, d);
//appendSvg("path", {d: d, fill: "none", stroke: "#990000", "stroke-dasharray": "200 200", "stroke-width": 50, id:"wall"+facility});
appendSvg("path", {d: d, fill: "none", stroke: "#f0fff0", "stroke-width": w+20, id:"chamber"+facility});
appendSvg("path", {d: d, fill: "none", stroke: "#ff0000", "stroke-width": w, id:"chamber"+facility});
appendSvg("path", {d: d, fill: "none", stroke: "#f0fff0", "stroke-width": w+20, id:"chamber"+facility, class: facility});
appendSvg("path", {d: d, fill: "none", stroke: "#ff0000", "stroke-width": w, id:"chamber"+facility, class: facility});
}
else appendSvg("path", {d: d, fill: "none", stroke: "#999999", "stroke-width": 20, id:"chamber"+facility, class: facility});
}
......@@ -1052,8 +1054,16 @@
clearmeasurement();
setUrl('zoom', Math.round(newScale*100)/100);
zoom = newScale;
if (newScale>3.9) $('.label').show(); else $('.label').hide();
if (newScale>3.9) {
$('.bending').css('font-size', 150);
$('.label').show();
}
else {
$('.bending').css('font-size', newScale<1? 800: 350);
$('.label').hide();
}
for (let i=1; i<=15; i++) if (newScale>i) $('.zoom'+i).show(); else $('.zoom'+i).hide();
for (let i=1; i<facilities.length; i++) if(!menuParams[facilities[i]]) $('.'+facilities[i]).hide();
if (myPanZoomTimer == null && document.location.search.indexOf('&autoPanZoom')==-1) myPanZoomTimer = setTimeout(myPanZoomDelayed, panZoomTime);
// mylog('myZoom', zoom);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment