UX improvements
This commit is contained in:
@@ -43,18 +43,30 @@ namespace Layout {
|
||||
namespace detail {
|
||||
inline float& userFontScaleRef() { static float s = 1.0f; return s; }
|
||||
inline bool& fontReloadNeededRef() { static bool s = false; return s; }
|
||||
inline float& fontAtlasScaleRef() { static float s = 1.0f; return s; }
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the user's font scale preference (1.0–3.0).
|
||||
* @brief Get the user's font scale preference (1.0–1.5).
|
||||
* Multiplied into font loading so glyphs render at the chosen size.
|
||||
*/
|
||||
inline float userFontScale() { return detail::userFontScaleRef(); }
|
||||
|
||||
/**
|
||||
* @brief Get the user font scale at which the font atlas was last built.
|
||||
* Used to compute FontScaleMain compensation during smooth slider drag.
|
||||
*/
|
||||
inline float fontAtlasScale() { return detail::fontAtlasScaleRef(); }
|
||||
|
||||
/**
|
||||
* @brief Record the font atlas scale after a rebuild.
|
||||
* Called from Typography::load() after the atlas is built.
|
||||
*/
|
||||
inline void setFontAtlasScale(float v) { detail::fontAtlasScaleRef() = v; }
|
||||
|
||||
/**
|
||||
* @brief Set the user's font scale and flag a font reload.
|
||||
* Called from the settings UI; the main loop detects the flag and
|
||||
* calls Typography::reload().
|
||||
* Called on slider release for a crisp atlas rebuild.
|
||||
*/
|
||||
inline void setUserFontScale(float v) {
|
||||
v = std::max(1.0f, std::min(1.5f, v));
|
||||
@@ -64,6 +76,16 @@ inline void setUserFontScale(float v) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the user's font scale WITHOUT flagging a font reload.
|
||||
* Called every frame while the slider is being dragged for smooth
|
||||
* visual scaling via FontScaleMain compensation.
|
||||
*/
|
||||
inline void setUserFontScaleVisual(float v) {
|
||||
v = std::max(1.0f, std::min(1.5f, v));
|
||||
detail::userFontScaleRef() = v;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Consume the pending font-reload flag (returns true once).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user