mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 16:30:01 +02:00
Refactor: don't combine horizontal splitters
This commit is contained in:
parent
04a46912ea
commit
fd61d7d1f1
1 changed files with 14 additions and 14 deletions
|
@ -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) {
|
||||||
|
if (rightNeighbor !== current) {
|
||||||
finalTemplateAreas += ` vSplitter${vSplitterCount + 1}`;
|
finalTemplateAreas += ` vSplitter${vSplitterCount + 1}`;
|
||||||
vSplitterCount++;
|
vSplitterCount++;
|
||||||
splitters.push({nr: vSplitterCount, orient: 'vertical', gridIdx: j + 1});
|
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];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue