@@ -310,21 +310,36 @@ void BandPanel::resized()
310310 }
311311 else if (shapeSwitch.getToggleState ())
312312 {
313- auto distortionModeArea = knobsColumnArea.removeFromTop (knobsColumnArea.getHeight () / 5 );
313+ // --- Step 1: Center the main row of three knobs vertically ---
314+ // Create a rectangle for the three knobs and their spacing,
315+ // and center it within the entire available `knobsColumnArea`.
316+ juce::Rectangle<int > knobRow = knobsColumnArea.withSizeKeepingCentre (scaledKnobSize * 3 + 20 , scaledKnobSize);
317+
318+ // Now, place the sliders within this perfectly centered `knobRow`.
319+ // We need to keep a reference to the middle knob's bounds for later.
320+ auto tempKnobRow = knobRow; // Use a temporary copy for manipulation
321+ modulatableSliderComponents.at (REC_NAME)->setBounds (tempKnobRow.removeFromLeft (scaledKnobSize));
322+ tempKnobRow.removeFromLeft (10 );
323+ auto biasKnobBounds = tempKnobRow.removeFromLeft (scaledKnobSize);
324+ modulatableSliderComponents.at (BIAS_NAME)->setBounds (biasKnobBounds);
325+ tempKnobRow.removeFromLeft (10 );
326+ modulatableSliderComponents.at (SHAPE_MIX_NAME)->setBounds (tempKnobRow);
327+
328+ // --- Step 2: Place the other elements around the centered knobs ---
329+
330+ // Place the distortion mode boxes at the top of the area.
331+ // We use getFromTop() so it doesn't affect `knobsColumnArea` for centering logic.
332+ juce::Rectangle<int > distortionModeArea (knobsColumnArea.getX (),
333+ knobsColumnArea.getY (),
334+ knobsColumnArea.getWidth (),
335+ knobsColumnArea.getHeight () / 5 );
336+
314337 auto smallerDistortionModeArea = distortionModeArea.withSizeKeepingCentre (distortionModeArea.getWidth () / 2 , distortionModeArea.getHeight ());
315338 for (auto & modeBox : distortionModes)
316339 modeBox.setBounds (smallerDistortionModeArea.reduced (0 , distortionModeArea.getHeight () / 4 ));
317340
318- // Place 3 knobs in a row
319- juce::Rectangle<int > knobRow = knobsColumnArea.withSizeKeepingCentre (scaledKnobSize * 3 + 20 , scaledKnobSize);
320- modulatableSliderComponents.at (REC_NAME)->setBounds (knobRow.removeFromLeft (scaledKnobSize));
321- knobRow.removeFromLeft (10 );
322- auto biasKnobBounds = knobRow.removeFromLeft (scaledKnobSize);
323- modulatableSliderComponents.at (BIAS_NAME)->setBounds (biasKnobBounds);
324- knobRow.removeFromLeft (10 );
325- modulatableSliderComponents.at (SHAPE_MIX_NAME)->setBounds (knobRow);
326-
327- // DC Filter button below Bias knob
341+ // Place the DC Filter button below the (now centered) Bias knob.
342+ // Its position is relative to `biasKnobBounds`, which we saved earlier.
328343 const int dcButtonSize = (int ) (scaledKnobSize * 0 .3f );
329344 const int dcLabelWidth = (int ) (35 * scale);
330345 juce::Rectangle<int > dcArea (0 , 0 , dcButtonSize + dcLabelWidth, dcButtonSize);
@@ -727,4 +742,4 @@ void BandPanel::updateDistortionModeVisibility()
727742void BandPanel::updateRealtimeThreshold (float newThreshold)
728743{
729744 vuPanel.updateRealtimeThreshold (newThreshold);
730- }
745+ }
0 commit comments