Skip to content

Commit 8a2a60f

Browse files
committed
Fix draggable dividers in playground UI
- Remove visual gripper from main vertical divider (cleaner look) - Add drag functionality for horizontal output divider - Consolidate drag handlers for both dividers
1 parent a0340b7 commit 8a2a60f

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

nullsafe-playground/index.html

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,6 @@
314314
background: var(--accent-blue);
315315
}
316316

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-
}
328317

329318
#editor-wrapper {
330319
flex: 1;
@@ -935,28 +924,50 @@ <h1>Null-Safe Clang Playground</h1>
935924
}
936925

937926
// Resizable panes
927+
let isDraggingOutput = false;
928+
938929
divider.addEventListener('mousedown', (e) => {
939930
isDragging = true;
940931
e.preventDefault();
941932
});
942933

934+
// Output divider resizing
935+
outputDivider.addEventListener('mousedown', (e) => {
936+
isDraggingOutput = true;
937+
e.preventDefault();
938+
});
939+
943940
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+
}
945953

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;
950959

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+
}
955965
}
956966
});
957967

958968
document.addEventListener('mouseup', () => {
959969
isDragging = false;
970+
isDraggingOutput = false;
960971
});
961972

962973
// Examples dropdown

0 commit comments

Comments
 (0)