Refactor: don't combine horizontal splitters

This commit is contained in:
brahim 2024-09-17 18:01:18 +02:00
parent 04a46912ea
commit fd61d7d1f1

View file

@ -379,15 +379,18 @@ var gZenViewSplitter = new class {
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
let nextRow = ''; let nextRow = '';
finalTemplateAreas += `'`; finalTemplateAreas += `'`;
let buildingHSplitter = false;
for (let j = 0; j < rows[i].length; j++) { for (let j = 0; j < rows[i].length; j++) {
const current = rows[i][j]; const current = rows[i][j];
const rightNeighbor = rows[i][j + 1]; const rightNeighbor = rows[i][j + 1];
finalTemplateAreas += " " + current; finalTemplateAreas += " " + current;
if (rightNeighbor && rightNeighbor !== current) { if (rightNeighbor) {
finalTemplateAreas += ` vSplitter${vSplitterCount + 1}`; if (rightNeighbor !== current) {
vSplitterCount++; finalTemplateAreas += ` vSplitter${vSplitterCount + 1}`;
splitters.push({nr: vSplitterCount, orient: 'vertical', gridIdx: j + 1}); vSplitterCount++;
splitters.push({nr: vSplitterCount, orient: 'vertical', gridIdx: j + 1, panels: current + 1});
} else {
finalTemplateAreas += " " + current;
}
} }
if (!rows[i + 1]) { if (!rows[i + 1]) {
@ -396,19 +399,16 @@ var gZenViewSplitter = new class {
const underNeighbor = rows[i + 1][j]; const underNeighbor = rows[i + 1][j];
if (underNeighbor !== current) { if (underNeighbor !== current) {
nextRow += ` hSplitter${hSplitterCount + 1}`; nextRow += ` hSplitter${hSplitterCount + 1}`;
buildingHSplitter = true; hSplitterCount++;
let panels = 1;
while (rows[i][j - panels] === current) {
panels++;
}
splitters.push({nr: hSplitterCount, orient: 'horizontal', gridIdx: i + 1, panels: panels});
} else { } else {
nextRow += ' ' + current; nextRow += ' ' + current;
hSplitterCount++;
splitters.push({nr: hSplitterCount, orient: 'horizontal', gridIdx: i + 1});
buildingHSplitter = false;
} }
if (j === rows[i].length - 1) { if (j === rows[i].length - 1) {
if (buildingHSplitter) {
hSplitterCount++;
splitters.push({nr: hSplitterCount, orient: 'horizontal', gridIdx: i + 1});
buildingHSplitter = false;
}
continue; continue;
} }
const rightNeighborJoinedWithUnderNeighbor = rightNeighbor === rows[i + 1][j + 1]; const rightNeighborJoinedWithUnderNeighbor = rightNeighbor === rows[i + 1][j + 1];