|
8 | 8 | <style> |
9 | 9 | #panes { |
10 | 10 | display: grid; |
11 | | - height: 100%; |
12 | | - width: 100%; |
| 11 | + gap: 5px; |
13 | 12 | position: relative; |
| 13 | + overflow: hidden; |
14 | 14 | } |
15 | 15 |
|
16 | 16 | #divider { |
|
41 | 41 | height: 100%; |
42 | 42 | width: 100%; |
43 | 43 | border: none; |
| 44 | + overflow-y: auto; |
44 | 45 | } |
45 | 46 |
|
46 | 47 | #devtools { |
47 | 48 | height: 100%; |
48 | 49 | width: 100%; |
49 | | - overflow: hidden; |
| 50 | + overflow-y: auto; |
50 | 51 | z-index: 10000001; |
51 | 52 | } |
52 | 53 |
|
53 | 54 | body { |
54 | | - display: flex; |
55 | 55 | height: 100vh; |
56 | 56 | width: 100vw; |
57 | | - contain: strict; |
58 | | - flex-direction: column; |
| 57 | + display: grid; |
| 58 | + grid-template-rows: auto 1fr; |
59 | 59 | margin: 0; |
60 | 60 | padding: 0; |
61 | 61 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, |
|
128 | 128 | function setLayout(layoutType, splitRatio) { |
129 | 129 | const panes = document.getElementById('panes'); |
130 | 130 | if (layoutType === 'topbottom') { |
131 | | - panes.style.gridTemplateColumns = '100%'; // Full width for each row |
132 | | - panes.style.gridTemplateRows = `${splitRatio * 100}% ${(1 - splitRatio) * 100}%`; |
| 131 | + panes.style.setProperty('--top-row-height', `${splitRatio * 100}%`); |
| 132 | + panes.style.gridTemplateRows = "var(--top-row-height) 1fr"; |
| 133 | + panes.style.gridTemplateColumns = null; |
133 | 134 | } else if (layoutType === 'leftright') { |
134 | | - panes.style.gridTemplateRows = '100%'; // Full height for each column |
135 | | - panes.style.gridTemplateColumns = `${splitRatio * 100}% ${(1 - splitRatio) * 100}%`; |
| 135 | + panes.style.setProperty('--left-column-width', `${splitRatio * 100}%`); |
| 136 | + panes.style.gridTemplateRows = null; |
| 137 | + panes.style.gridTemplateColumns = "var(--left-column-width) 1fr"; |
136 | 138 | } |
137 | 139 | } |
138 | 140 | layout.addEventListener('change', () => { |
|
147 | 149 | if (layoutType === 'topbottom') { |
148 | 150 | // For top/bottom layout, divider should be horizontal (spanning across) |
149 | 151 | divider.className = 'horizontal-divider'; |
150 | | - divider.style.top = `calc(${splitRatio * 100}% - 2.5px)`; |
| 152 | + divider.style.top = `calc(${splitRatio * 100}%)`; |
151 | 153 | divider.style.left = '0'; |
152 | 154 | } else { |
153 | 155 | // For left/right layout, divider should be vertical (spanning down) |
154 | 156 | divider.className = 'vertical-divider'; |
155 | | - divider.style.left = `calc(${splitRatio * 100}% - 2.5px)`; |
| 157 | + divider.style.left = `calc(${splitRatio * 100}%)`; |
156 | 158 | divider.style.top = '0'; |
157 | 159 | } |
158 | 160 | } |
|
0 commit comments