Skip to content

Commit

Permalink
Merge pull request #15004 from light-and-ray/ResizeHandleRow_-_allow_…
Browse files Browse the repository at this point in the history
…overriden_column_scale_parametr

ResizeHandleRow - allow overriden column scale parametr
  • Loading branch information
AUTOMATIC1111 committed Feb 26, 2024
1 parent 78e421e commit e651ca8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions javascript/resizeHandle.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
(function() {
const GRADIO_MIN_WIDTH = 320;
const GRID_TEMPLATE_COLUMNS = '1fr 16px 1fr';
const PAD = 16;
const DEBOUNCE_TIME = 100;

Expand Down Expand Up @@ -37,7 +36,7 @@
}

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 newParentWidth = parent.offsetWidth;
const widthL = parseInt(parent.style.gridTemplateColumns.split(' ')[0]);
Expand All @@ -59,7 +58,9 @@

parent.style.display = 'grid';
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');
resizeHandle.classList.add('resize-handle');
Expand Down Expand Up @@ -96,7 +97,7 @@
evt.preventDefault();
evt.stopPropagation();

parent.style.gridTemplateColumns = GRID_TEMPLATE_COLUMNS;
parent.style.gridTemplateColumns = parent.style.originalGridTemplateColumns;
});

afterResize(parent);
Expand Down

0 comments on commit e651ca8

Please sign in to comment.