Skip to content

Commit

Permalink
correctly compensate for buttons on top row
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Dec 28, 2023
1 parent afd8982 commit f415f7a
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/gui/panels/ValentineCenterPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,11 @@ void CenterPanel::resized()
auto topRowSliders = topRowComponents.removeFromLeft (
juce::roundToInt (topRowComponents.getWidth() * .65f));

// Get basic width for top row sliders
auto topRowSliderWidth = juce::roundToInt (topRowSliders.getWidth() * .33f);
// Use slider width as reference for button width
const auto topRowButtonWidth = juce::roundToInt (topRowSliderWidth * .10f);
// Adjust button width to make room
topRowSliderWidth -= topRowButtonWidth;
const auto topRowButtonWidth = juce::roundToInt (topRowSliders.getWidth() * .033f);
const auto adjustedTopRowComponentsWidth =
topRowSliders.getWidth() - (topRowButtonWidth * 2.0f);
const auto topRowSliderWidth =
juce::roundToInt (adjustedTopRowComponentsWidth / 3.0f);

// We want the buttons to be centered vertically, and need the button bounds to
// be square;
Expand All @@ -120,14 +119,12 @@ void CenterPanel::resized()

crushEnableButton.setBounds (
topRowSliders.removeFromLeft (topRowButtonWidth).reduced (0, topRowButtonSpacer));

crushSlider.setBounds (topRowSliders.removeFromLeft (topRowSliderWidth));

compressSlider.setBounds (topRowSliders.removeFromLeft (topRowSliderWidth));

saturateEnableButton.setBounds (
topRowSliders.removeFromLeft (topRowButtonWidth).reduced (0, topRowButtonSpacer));

saturateSlider.setBounds (topRowSliders.removeFromLeft (topRowSliderWidth));

const auto logoHeight = juce::roundToInt (topRowComponents.getHeight() * .25f);
Expand Down Expand Up @@ -162,8 +159,6 @@ void CenterPanel::resized()
attackSlider.setBounds (bottomRowComponents.removeFromLeft (bottomRowSliderWidth));
releaseSlider.setBounds (bottomRowComponents.removeFromLeft (bottomRowSliderWidth));

// Kludging this for now. There is a much better way of finding this...
// but I don't want to figure it out rn.
const auto dividerBounds = bottomRowComponents.removeFromLeft (borderSpacer);
bottomRowDivider =
juce::Rectangle<int> (juce::roundToInt (dividerBounds.getCentreX()),
Expand Down

0 comments on commit f415f7a

Please sign in to comment.