Fixed createSelection bug + hide right part on client side

This commit is contained in:
l_samenv
2024-08-20 11:30:58 +02:00
parent 7bd4a1591f
commit 2ea1674991
3 changed files with 23 additions and 23 deletions

View File

@ -328,25 +328,19 @@ let graphs = (function (){
*/
function createSelection(gindex){
let graph_elm = graph_elm_array[gindex];
console.log("clear for createSelection", gindex)
clear(gindex);
for(let tag in tag_dict){
if (tag_dict[tag] === gindex){ // we indicate that the tag is not displayed
tag_dict[tag] = -1
break
}
}
let selection = document.createElement('div');
selection.classList.add('selection');
delete prev_blk[gindex];
console.log('cresel', gindex, prev_blk, tag_dict);
let creidx = null;
let creblock = null;
for (let i in prev_blk) {
creblock = prev_blk[i];
if (tag_dict[creblock.tag] == gindex) {
creidx = i;
break;
}
}
for (let block of blocks) {
console.log('ck', block.tag, tag_dict[block.tag], creidx)
let bel = document.createElement('div');
bel.classList.add('select');
let title = document.createElement('div');
@ -363,21 +357,18 @@ let graphs = (function (){
}
bel.appendChild(params);
bel.addEventListener('click', function(){
if (block.tag in tag_dict) {
let idx = tag_dict[block.tag];
createSelection(idx);
prev_blk[idx] = block;
if (block.tag in tag_dict) { //if the block that we might select is in the ones that are displayed
let idx = tag_dict[block.tag]; // we get the current gindex (idx) of the clicked block
if(idx != -1){ //if the clicked block is displayed somewhere, we create a selection window
createSelection(idx); // We will create a selection at the gindex
}
}
createGraph(gindex, block);
createGraph(gindex, block); // we create at the current shown selector (gindex), the graph corresponding to the one clicked (block)
})
selection.appendChild(bel);
}
graph_elm.appendChild(selection);
if (creidx !== null) {
console.log('creblock', creidx, creblock);
createGraph(creidx, creblock);
}
}
/**

View File

@ -76,6 +76,7 @@ new Settings()
.treat("showConsole", "sc", to_bool, true)
.treat("showOverview", "so", to_bool, true)
.treat("showGraphics", "sg", to_bool, true) // false)
.treat("hideRightPart", "hr", to_bool, false)
.treat("showAsync", "sa", to_bool, false)
function loadFirstBlocks() {

View File

@ -67,6 +67,14 @@ function adjustGrid() {
paramSlider = [0,1,2,3];
prevActiveSlider = 0;
if (window["hideRightPart"]){
style(0,"100vw","100vh");
style(1); // hide
style(2); // hide
style(3); // hide
return
}
switch (nColumns) {
case 1:
if (menuMode) {