Skip to content

Commit

Permalink
fix(slider): fix editor font size
Browse files Browse the repository at this point in the history
  • Loading branch information
zsliu98 committed Dec 26, 2024
1 parent be69043 commit be2a19f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ namespace zlInterface {
editor.setColour(juce::TextEditor::outlineColourId, uiBase.getTextColor());
editor.setColour(juce::TextEditor::highlightedTextColourId, uiBase.getTextColor());
#if (USE_JUCE7_INSTEAD_OF_LATEST)
editor.applyFontToAllText(uiBase.getFontSize() * FontHuge);
editor.applyFontToAllText(uiBase.getFontSize() * editorFontScale);
#else
editor.applyFontToAllText(juce::FontOptions{uiBase.getFontSize() * FontHuge});
editor.applyFontToAllText(juce::FontOptions{uiBase.getFontSize() * editorFontScale});
#endif
editor.applyColourToAllText(uiBase.getTextColor(), true);
}
Expand All @@ -145,7 +145,6 @@ namespace zlInterface {
const auto actualValue = ctext.getDoubleValue() * k;

slider.setValue(actualValue, juce::sendNotificationAsync);

leaveAnimation();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ namespace zlInterface {
inline void setFontScale(const float x1, const float x2) {
nameLookAndFeel.setFontScale(x1);
textLookAndFeel.setFontScale(x2);
editorFontScale = x2;
}

private:
Expand All @@ -73,6 +74,7 @@ namespace zlInterface {
NameLookAndFeel nameLookAndFeel, textLookAndFeel;
SnappingSlider slider;
juce::Label label, text;
float editorFontScale{FontHuge};

friz::Animator animator{};
static constexpr int animationId = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ namespace zlInterface {
editor.setColour(juce::TextEditor::outlineColourId, uiBase.getTextColor());
editor.setColour(juce::TextEditor::highlightedTextColourId, uiBase.getTextColor());
#if (USE_JUCE7_INSTEAD_OF_LATEST)
editor.applyFontToAllText(uiBase.getFontSize() * FontHuge);
editor.applyFontToAllText(uiBase.getFontSize() * editorFontScale);
#else
editor.applyFontToAllText(juce::FontOptions{uiBase.getFontSize() * FontHuge});
editor.applyFontToAllText(juce::FontOptions{uiBase.getFontSize() * editorFontScale});
#endif
editor.applyColourToAllText(uiBase.getTextColor(), true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ namespace zlInterface {
labelLookAndFeel.setFontScale(x1);
labelLookAndFeel1.setFontScale(x2);
labelLookAndFeel2.setFontScale(x2);
editorFontScale = x2;
}

private:
Expand All @@ -90,6 +91,7 @@ namespace zlInterface {
NameLookAndFeel textBoxLAF;

juce::Label label, label1, label2;
float editorFontScale{FontHuge};

std::atomic<bool> showSlider2 = true, editable;
std::atomic<float> lrPad = 0, ubPad = 0;
Expand Down

0 comments on commit be2a19f

Please sign in to comment.