Added UI Scaling support - #13
Merged
JohnGreenFC merged 7 commits intoSep 21, 2026
Merged
Conversation
Added UI Scaling from 1x-3x Tested scaling on custom UI Saving scaling settings into the IMGui Config
JohnGreenFC
force-pushed
the
PLAT-11971-Add-support-for-UI-scaling-to-CMF-Viewer
branch
from
September 16, 2026 13:56
118a549 to
f272fc9
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical font-resource and settings-handler issues, plus unresolved scaling and input-handling issues, block approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR adds configurable 1x–3x Dear ImGui UI scaling with runtime controls, monitor-based defaults, and persistent settings.
Changes:
- Adds centralized scaling constants and scaled UI dimensions.
- Rebuilds fonts and styles when scaling changes.
- Persists UI scale through ImGui configuration.
File summaries
| File | Summary |
|---|---|
src/viewer/rendering/ui/uiSettings.h |
Adds settings API declarations. |
src/viewer/rendering/ui/uiSettings.cpp |
Adds configuration persistence. Critical (3 votes): initialize settings callbacks and user data. Moderate (1 vote): reject non-finite scale values. |
src/viewer/rendering/ui/uiRenderer.h |
Declares scaling support. |
src/viewer/rendering/ui/uiRenderer.cpp |
Applies font/style scaling. Critical (3 votes): synchronize font resource replacement across frames. Moderate (1 vote): scale fixed table dimensions. |
src/viewer/rendering/ui/uiMenubar.h |
Adds slider state. |
src/viewer/rendering/ui/uiMenubar.cpp |
Adds scale controls. Moderate (1 vote): handle slider deactivation when the menu closes. |
src/viewer/rendering/ui/uiGeneralWindow.cpp |
Uses scaled button dimensions. |
src/viewer/rendering/ui/uiDetailWindow.cpp |
Uses scaled spacing and table heights. Moderate (1 vote): scale fixed table column widths. |
src/viewer/rendering/ui/uiCustomWidgets.h |
Adds scaled widget defaults. |
src/viewer/rendering/ui/uiCustomWidgets.cpp |
Applies scaled widget geometry. |
src/viewer/rendering/ui/uiConsts.h |
Defines scaling constants and accessors. |
src/viewer/rendering/ui/uiConsts.cpp |
Stores runtime scale state. |
src/viewer/rendering/ui/uiAnimationPlayback.cpp |
Scales playback controls. |
src/viewer/appState.h |
Adds UI scale state. |
src/viewer/appState.cpp |
Dispatches scale callbacks. |
src/viewer/application.cpp |
Initializes monitor-based scaling and saves settings. Moderate (2 votes): use logical window or viewport dimensions for UI layout. |
Review details
Suppressed comments (4)
src/viewer/rendering/ui/uiDetailWindow.cpp:1221
- The new scaled height still uses fixed
indexColumnWidth/columnWidthvalues (60/80px) for both tables below. At 2x/3x the text font and row heights grow but these columns do not, so vertex indices and coordinates can be clipped. Scale those base widths throughUiConsts::Scaledbefore passing them toTableSetupColumn.
const float tableHeight = std::min( (float)vertexCount * ImGui::GetTextLineHeightWithSpacing() + ImGui::GetTextLineHeightWithSpacing(), UiConsts::Scaled( 200.0f ) );
src/viewer/rendering/ui/uiMenubar.cpp:141
- If the slider is dragged and the mouse is released outside the open menu, the slider is not submitted on that frame, so
IsItemDeactivatedAfterEdit()is never observed.m_uiScaleSliderActivethen remains true and the pending value is never copied toappState.uiScale; reopening the menu also skips the synchronization at lines 135-138. Handle deactivation/menu closure outsideBeginMenuand explicitly commit or discard the pending value.
m_uiScaleSliderActive = ImGui::IsItemActive();
src/viewer/rendering/ui/uiRenderer.cpp:163
ScaleAllSizesonly scales values stored inImGuiStyle; it does not affect explicit pixel dimensions elsewhere. For example,uiDetailWindow.cppstill passes fixed 48px/72px/80px table widths, so at 3x the text and padding grow while those columns remain 1x and can clip their headers and content. Route all fixed UI dimensions through the scaled accessors as well.
// ScaleAllSizes is cumulative, so always start from a fresh style
ImGuiStyle& style = ImGui::GetStyle();
style = ImGuiStyle();
ImGui::StyleColorsDark( &style );
style.ScaleAllSizes( scale );
src/viewer/rendering/ui/uiSettings.cpp:101
strtofacceptsnan, and theendcheck succeeds for it;std::clampdoes not sanitize a NaN. A malformedUiScale=nantherefore propagates intoApplyUiScale,SizePixels, andScaleAllSizes, which can break font construction/rendering. Reject non-finite values (and ideally trailing junk) before storing the clamped scale.
const float uiScale = std::strtof( line + keyLength, &end );
if( end != line + keyLength )
{
GetAppState( handler ).uiScale.SetValueNoCallback( std::clamp( uiScale, UiConsts::MIN_UI_SCALE, UiConsts::MAX_UI_SCALE ) );
- Files reviewed: 16/16 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
CCPNobody
reviewed
Sep 17, 2026
CCPNobody
approved these changes
Sep 21, 2026
JohnGreenFC
deleted the
PLAT-11971-Add-support-for-UI-scaling-to-CMF-Viewer
branch
September 21, 2026 13:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added UI Scaling from 1x-3x
Tested scaling on custom UI
Saving scaling settings into the IMGui Config