Skip to content

Commit b7356ba

Browse files
committed
fix: window resetting to default size when toggling header visibility in dynamic mode
1 parent 0c9e992 commit b7356ba

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/dmt/app/AbstractPluginEditor.h‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,15 @@ class AbstractPluginEditor
311311
const auto maxWidth = static_cast<int>(maxHeight * maxAspectRatio);
312312
constrainer->setSizeLimits(minWidth, minHeight, maxWidth, maxHeight);
313313
}
314+
// Keep width the same, only adjust height by header height
315+
int heightAdjustment = static_cast<int>(
316+
(isHeaderVisible ? headerHeight : -headerHeight) * sizeFactor);
317+
setSize(getWidth(), getHeight() + heightAdjustment);
314318
} else {
315319
// In fixed mode, enforce fixed aspect ratio
316320
setConstraints(baseWidth, adjustedHeight);
321+
setSize(baseWidth * sizeFactor, adjustedHeight * sizeFactor);
317322
}
318-
319-
setSize(baseWidth * sizeFactor, adjustedHeight * sizeFactor);
320323
}
321324

322325
dmt::gui::window::Layout& getMainLayout() { return mainLayout; }

0 commit comments

Comments
 (0)