From d23c694a84056a7bf23a5b951bec3e2e704b6e9c Mon Sep 17 00:00:00 2001 From: Andray Date: Mon, 26 Feb 2024 13:37:29 +0400 Subject: [PATCH] fix resize handle --- javascript/resizeHandle.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/javascript/resizeHandle.js b/javascript/resizeHandle.js index 484d7edf..6560372c 100644 --- a/javascript/resizeHandle.js +++ b/javascript/resizeHandle.js @@ -22,17 +22,11 @@ function displayResizeHandle(parent) { if (window.innerWidth < GRADIO_MIN_WIDTH * 2 + PAD * 4) { parent.style.display = 'flex'; - parent.querySelector('.resize-handle').style.display = "none"; - if (R.handle != null) { - R.handle.style.opacity = '0'; - } + parent.resizeHandle.style.display = "none"; return false; } else { parent.style.display = 'grid'; - parent.querySelector('.resize-handle').style.display = 'block'; - if (R.handle != null) { - R.handle.style.opacity = '100'; - } + parent.resizeHandle.style.display = "block"; return true; } } @@ -67,6 +61,7 @@ const resizeHandle = document.createElement('div'); resizeHandle.classList.add('resize-handle'); parent.insertBefore(resizeHandle, rightCol); + parent.resizeHandle = resizeHandle; ['mousedown', 'touchstart'].forEach((eventType) => { resizeHandle.addEventListener(eventType, (evt) => { @@ -84,7 +79,6 @@ R.tracking = true; R.parent = parent; R.parentWidth = parent.offsetWidth; - R.handle = resizeHandle; R.leftCol = leftCol; R.leftColStartWidth = leftCol.offsetWidth; if (eventType.startsWith('mouse')) {