mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-01-15 03:58:09 -05:00
fix(ui): handle resizable panels not rendered in DOM
Fixes a bug introduced in a different bug fix in 9c0d357817.
This commit is contained in:
@@ -101,7 +101,7 @@ export const usePanel = (arg: UsePanelOptions): UsePanelReturn => {
|
||||
arg.panelGroupDirection
|
||||
);
|
||||
|
||||
if (minSizePct > 100) {
|
||||
if (!minSizePct || minSizePct > 100 || !defaultSizePct || defaultSizePct > 100) {
|
||||
// This can happen when the panel is hidden
|
||||
return;
|
||||
}
|
||||
@@ -244,6 +244,11 @@ const getSizeAsPercentage = (
|
||||
let availableSpace =
|
||||
panelGroupDirection === 'horizontal' ? panelGroupElement.offsetWidth : panelGroupElement.offsetHeight;
|
||||
|
||||
if (!availableSpace) {
|
||||
// No available space, size is 0
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ...minus the width/height of the resize handles
|
||||
getResizeHandleElementsForGroup(id).forEach((el) => {
|
||||
availableSpace -= panelGroupDirection === 'horizontal' ? el.offsetWidth : el.offsetHeight;
|
||||
|
||||
Reference in New Issue
Block a user