new_editor: unify shared UI text measurement semantics
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEditor/Foundation/UIEditorTextMeasurement.h>
|
||||
|
||||
#include <XCEngine/UI/DrawData.h>
|
||||
|
||||
#include <cstddef>
|
||||
@@ -38,7 +40,8 @@ struct UIEditorStatusBarSegment {
|
||||
UIEditorStatusBarTextTone tone = UIEditorStatusBarTextTone::Primary;
|
||||
bool interactive = true;
|
||||
bool showSeparator = false;
|
||||
float desiredWidth = 0.0f;
|
||||
// Pure measured label width. Segment padding is applied only in layout.
|
||||
float measuredLabelWidth = 0.0f;
|
||||
};
|
||||
|
||||
struct UIEditorStatusBarState {
|
||||
@@ -57,6 +60,8 @@ struct UIEditorStatusBarMetrics {
|
||||
float separatorInsetY = 5.0f;
|
||||
float slotGapMin = 18.0f;
|
||||
float cornerRounding = 0.0f;
|
||||
float labelFontSize = 12.0f;
|
||||
float labelInsetY = 0.0f;
|
||||
float estimatedGlyphWidth = 6.5f;
|
||||
float borderThickness = 1.0f;
|
||||
float focusedBorderThickness = 1.0f;
|
||||
@@ -100,6 +105,11 @@ struct UIEditorStatusBarHitTarget {
|
||||
std::size_t index = UIEditorStatusBarInvalidIndex;
|
||||
};
|
||||
|
||||
float ResolveUIEditorStatusBarMeasuredLabelWidth(
|
||||
const UIEditorStatusBarSegment& segment,
|
||||
const UIEditorStatusBarMetrics& metrics = {},
|
||||
const UIEditorTextMeasurer* textMeasurer = nullptr);
|
||||
|
||||
float ResolveUIEditorStatusBarDesiredSegmentWidth(
|
||||
const UIEditorStatusBarSegment& segment,
|
||||
const UIEditorStatusBarMetrics& metrics = {});
|
||||
|
||||
Reference in New Issue
Block a user