new_editor: fix adaptive tab width semantics
This commit is contained in:
@@ -112,13 +112,18 @@ bool IsToolWindow(const EditorWindow& window) {
|
||||
return ::XCEngine::UI::UISize(640.0f, 360.0f);
|
||||
}
|
||||
|
||||
float ResolveDetachedTabWidth(std::string_view text) {
|
||||
float ResolveDetachedTabWidth(
|
||||
std::string_view text,
|
||||
const UIEditorTextMeasurer* textMeasurer) {
|
||||
const Widgets::UIEditorTabStripMetrics& metrics = ResolveUIEditorTabStripMetrics();
|
||||
Widgets::UIEditorTabStripItem item = {};
|
||||
item.title = std::string(text);
|
||||
const float desiredLabelWidth =
|
||||
Widgets::ResolveUIEditorTabStripDesiredHeaderLabelWidth(item, metrics);
|
||||
return MeasureUITabStripHeaderWidth(desiredLabelWidth, metrics.layoutMetrics);
|
||||
const float measuredLabelWidth =
|
||||
Widgets::ResolveUIEditorTabStripMeasuredLabelWidth(
|
||||
item,
|
||||
metrics,
|
||||
textMeasurer);
|
||||
return MeasureUITabStripHeaderWidth(measuredLabelWidth, metrics.layoutMetrics);
|
||||
}
|
||||
|
||||
bool HasSingleVisibleRootTab(const UIEditorWorkspaceController& controller) {
|
||||
@@ -710,7 +715,9 @@ Host::BorderlessWindowChromeLayout EditorWindowChromeController::ResolveChromeLa
|
||||
float clientWidthDips) const {
|
||||
float leadingOccupiedRight = 0.0f;
|
||||
if (ShouldUseDetachedTitleBarTabStrip(window)) {
|
||||
leadingOccupiedRight = ResolveDetachedTabWidth(ResolveDetachedTitleTabText(window));
|
||||
leadingOccupiedRight = ResolveDetachedTabWidth(
|
||||
ResolveDetachedTitleTabText(window),
|
||||
&window.m_runtime->GetTextMeasurer());
|
||||
}
|
||||
|
||||
return Host::BuildBorderlessWindowChromeLayout(
|
||||
|
||||
Reference in New Issue
Block a user