|
314 | 314 | background: var(--accent-blue); |
315 | 315 | } |
316 | 316 |
|
317 | | - .divider::after { |
318 | | - content: ''; |
319 | | - position: absolute; |
320 | | - top: 50%; |
321 | | - left: 50%; |
322 | | - transform: translate(-50%, -50%); |
323 | | - width: 3px; |
324 | | - height: 40px; |
325 | | - background: var(--bg-primary); |
326 | | - border-radius: 2px; |
327 | | - } |
328 | 317 |
|
329 | 318 | #editor-wrapper { |
330 | 319 | flex: 1; |
@@ -935,28 +924,50 @@ <h1>Null-Safe Clang Playground</h1> |
935 | 924 | } |
936 | 925 |
|
937 | 926 | // Resizable panes |
| 927 | + let isDraggingOutput = false; |
| 928 | + |
938 | 929 | divider.addEventListener('mousedown', (e) => { |
939 | 930 | isDragging = true; |
940 | 931 | e.preventDefault(); |
941 | 932 | }); |
942 | 933 |
|
| 934 | + // Output divider resizing |
| 935 | + outputDivider.addEventListener('mousedown', (e) => { |
| 936 | + isDraggingOutput = true; |
| 937 | + e.preventDefault(); |
| 938 | + }); |
| 939 | + |
943 | 940 | document.addEventListener('mousemove', (e) => { |
944 | | - if (!isDragging) return; |
| 941 | + if (isDragging) { |
| 942 | + const container = document.querySelector('.main-container'); |
| 943 | + const containerRect = container.getBoundingClientRect(); |
| 944 | + const offsetX = e.clientX - containerRect.left; |
| 945 | + const percentage = (offsetX / containerRect.width) * 100; |
| 946 | + |
| 947 | + if (percentage > 20 && percentage < 80) { |
| 948 | + const panes = document.querySelectorAll('.pane'); |
| 949 | + panes[0].style.flex = `0 0 ${percentage}%`; |
| 950 | + panes[1].style.flex = `0 0 ${100 - percentage}%`; |
| 951 | + } |
| 952 | + } |
945 | 953 |
|
946 | | - const container = document.querySelector('.main-container'); |
947 | | - const containerRect = container.getBoundingClientRect(); |
948 | | - const offsetX = e.clientX - containerRect.left; |
949 | | - const percentage = (offsetX / containerRect.width) * 100; |
| 954 | + if (isDraggingOutput) { |
| 955 | + const container = document.querySelector('.output-container'); |
| 956 | + const containerRect = container.getBoundingClientRect(); |
| 957 | + const offsetY = e.clientY - containerRect.top; |
| 958 | + const percentage = (offsetY / containerRect.height) * 100; |
950 | 959 |
|
951 | | - if (percentage > 20 && percentage < 80) { |
952 | | - const panes = document.querySelectorAll('.pane'); |
953 | | - panes[0].style.flex = `0 0 ${percentage}%`; |
954 | | - panes[1].style.flex = `0 0 ${100 - percentage}%`; |
| 960 | + if (percentage > 20 && percentage < 80) { |
| 961 | + const sections = document.querySelectorAll('.output-section'); |
| 962 | + sections[0].style.flex = `0 0 ${percentage}%`; |
| 963 | + sections[1].style.flex = `0 0 ${100 - percentage}%`; |
| 964 | + } |
955 | 965 | } |
956 | 966 | }); |
957 | 967 |
|
958 | 968 | document.addEventListener('mouseup', () => { |
959 | 969 | isDragging = false; |
| 970 | + isDraggingOutput = false; |
960 | 971 | }); |
961 | 972 |
|
962 | 973 | // Examples dropdown |
|
0 commit comments