Merge pull request #15010 from light-and-ray/fix_resize-handle_for_vertical_layout

Fix resize-handle visability for vertical layout (mobile)
This commit is contained in:
AUTOMATIC1111 2024-02-26 12:52:34 +03:00 committed by GitHub
commit ca0308b60d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -22,15 +22,11 @@
function displayResizeHandle(parent) { function displayResizeHandle(parent) {
if (window.innerWidth < GRADIO_MIN_WIDTH * 2 + PAD * 4) { if (window.innerWidth < GRADIO_MIN_WIDTH * 2 + PAD * 4) {
parent.style.display = 'flex'; parent.style.display = 'flex';
if (R.handle != null) { parent.resizeHandle.style.display = "none";
R.handle.style.opacity = '0';
}
return false; return false;
} else { } else {
parent.style.display = 'grid'; parent.style.display = 'grid';
if (R.handle != null) { parent.resizeHandle.style.display = "block";
R.handle.style.opacity = '100';
}
return true; return true;
} }
} }
@ -65,6 +61,7 @@
const resizeHandle = document.createElement('div'); const resizeHandle = document.createElement('div');
resizeHandle.classList.add('resize-handle'); resizeHandle.classList.add('resize-handle');
parent.insertBefore(resizeHandle, rightCol); parent.insertBefore(resizeHandle, rightCol);
parent.resizeHandle = resizeHandle;
['mousedown', 'touchstart'].forEach((eventType) => { ['mousedown', 'touchstart'].forEach((eventType) => {
resizeHandle.addEventListener(eventType, (evt) => { resizeHandle.addEventListener(eventType, (evt) => {
@ -82,7 +79,6 @@
R.tracking = true; R.tracking = true;
R.parent = parent; R.parent = parent;
R.parentWidth = parent.offsetWidth; R.parentWidth = parent.offsetWidth;
R.handle = resizeHandle;
R.leftCol = leftCol; R.leftCol = leftCol;
R.leftColStartWidth = leftCol.offsetWidth; R.leftColStartWidth = leftCol.offsetWidth;
if (eventType.startsWith('mouse')) { if (eventType.startsWith('mouse')) {