mirror of https://github.com/WerWolv/ImHex
impr: Store points instead of pixels for font size in settings
This commit is contained in:
parent
fc2ed47676
commit
0e800723f5
|
|
@ -73,7 +73,7 @@ namespace hex::fonts {
|
|||
|
||||
class FontSelector : public ContentRegistry::Settings::Widgets::Widget {
|
||||
public:
|
||||
FontSelector() : m_fontSize(ImHexApi::Fonts::pointsToPixels(12), 2, 100), m_bold(false), m_italic(false) { }
|
||||
FontSelector() : m_fontSize(12, 2, 100), m_bold(false), m_italic(false) { }
|
||||
|
||||
bool draw(const std::string &name) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -199,15 +199,9 @@ namespace hex::fonts {
|
|||
}
|
||||
|
||||
bool SliderPoints::draw(const std::string &name) {
|
||||
float value = ImHexApi::Fonts::pixelsToPoints(m_value);
|
||||
float min = ImHexApi::Fonts::pixelsToPoints(m_min);
|
||||
float max = ImHexApi::Fonts::pixelsToPoints(m_max);
|
||||
|
||||
if (ImGui::SliderFloat(name.c_str(), &value, min, max, "%.0f pt"))
|
||||
if (ImGui::SliderFloat(name.c_str(), &m_value, m_min, m_max, "%.0f pt"))
|
||||
m_changed = true;
|
||||
|
||||
m_value = ImHexApi::Fonts::pointsToPixels(value);
|
||||
|
||||
if (m_changed && !ImGui::IsItemActive()) {
|
||||
m_changed = false;
|
||||
return true;
|
||||
|
|
@ -287,7 +281,7 @@ namespace hex::fonts {
|
|||
}
|
||||
|
||||
[[nodiscard]] float FontSelector::getFontSize() const {
|
||||
return m_fontSize.getValue();
|
||||
return ImHexApi::Fonts::pointsToPixels(m_fontSize.getValue());
|
||||
}
|
||||
|
||||
[[nodiscard]] bool FontSelector::isBold() const {
|
||||
|
|
|
|||
Loading…
Reference in New Issue