Merge pull request #15004 from light-and-ray/ResizeHandleRow_-_allow_overriden_column_scale_parametr

ResizeHandleRow - allow overriden column scale parametr
This commit is contained in:
AUTOMATIC1111 2024-02-26 07:16:24 +03:00
parent 78e421e4ea
commit e651ca8adb

View File

@ -1,6 +1,5 @@
(function() { (function() {
const GRADIO_MIN_WIDTH = 320; const GRADIO_MIN_WIDTH = 320;
const GRID_TEMPLATE_COLUMNS = '1fr 16px 1fr';
const PAD = 16; const PAD = 16;
const DEBOUNCE_TIME = 100; const DEBOUNCE_TIME = 100;
@ -37,7 +36,7 @@
} }
function afterResize(parent) { function afterResize(parent) {
if (displayResizeHandle(parent) && parent.style.gridTemplateColumns != GRID_TEMPLATE_COLUMNS) { if (displayResizeHandle(parent) && parent.style.gridTemplateColumns != parent.style.originalGridTemplateColumns) {
const oldParentWidth = R.parentWidth; const oldParentWidth = R.parentWidth;
const newParentWidth = parent.offsetWidth; const newParentWidth = parent.offsetWidth;
const widthL = parseInt(parent.style.gridTemplateColumns.split(' ')[0]); const widthL = parseInt(parent.style.gridTemplateColumns.split(' ')[0]);
@ -59,7 +58,9 @@
parent.style.display = 'grid'; parent.style.display = 'grid';
parent.style.gap = '0'; parent.style.gap = '0';
parent.style.gridTemplateColumns = GRID_TEMPLATE_COLUMNS; const gridTemplateColumns = `${parent.children[0].style.flexGrow}fr ${PAD}px ${parent.children[1].style.flexGrow}fr`;
parent.style.gridTemplateColumns = gridTemplateColumns;
parent.style.originalGridTemplateColumns = gridTemplateColumns;
const resizeHandle = document.createElement('div'); const resizeHandle = document.createElement('div');
resizeHandle.classList.add('resize-handle'); resizeHandle.classList.add('resize-handle');
@ -96,7 +97,7 @@
evt.preventDefault(); evt.preventDefault();
evt.stopPropagation(); evt.stopPropagation();
parent.style.gridTemplateColumns = GRID_TEMPLATE_COLUMNS; parent.style.gridTemplateColumns = parent.style.originalGridTemplateColumns;
}); });
afterResize(parent); afterResize(parent);