chat: improve window sizing

This commit is contained in:
Kyle Drake 2024-04-21 11:58:26 -05:00
parent 871f13ceb1
commit 87dd81581c

View file

@ -184,12 +184,13 @@ Maintain a friendly, patient, supportive tone. Prioritize the user's learning an
e.preventDefault();
isResizing = true;
let startX = e.pageX;
let initialLeftColWidth = leftCol.offsetWidth; // Capture the initial width when resizing starts
function handleMouseMove(e) {
if (!isResizing) return;
const editorRowWidth = editorRow.offsetWidth; // Get the total width of the editor row
let moveX = e.pageX - startX;
let leftColWidth = leftCol.offsetWidth + moveX;
let leftColWidth = initialLeftColWidth + moveX; // Use the initial width for relative adjustments
// Convert to percentage
let leftColPercentage = (leftColWidth / editorRowWidth) * 100;
@ -207,9 +208,8 @@ Maintain a friendly, patient, supportive tone. Prioritize the user's learning an
// Apply the new widths
leftCol.style.width = `${leftColPercentage}%`;
rightCol.style.width = `${rightColPercentage}%`;
localStorage.setItem('leftColPct', leftCol.style.width)
localStorage.setItem('rightColPct', rightCol.style.width)
startX = e.pageX;
localStorage.setItem('leftColPct', `${leftColPercentage}%`);
localStorage.setItem('rightColPct', `${rightColPercentage}%`);
}
function handleMouseUp() {