diff --git a/ear-production-suite-plugins/plugins/direct_speakers/src/value_box_main.hpp b/ear-production-suite-plugins/plugins/direct_speakers/src/value_box_main.hpp index 4cae1352d..cacb77fbb 100644 --- a/ear-production-suite-plugins/plugins/direct_speakers/src/value_box_main.hpp +++ b/ear-production-suite-plugins/plugins/direct_speakers/src/value_box_main.hpp @@ -98,11 +98,7 @@ class ValueBoxMain : public Component { auto routingLabelArea = routingArea.withWidth(labelWidth_); routingLabel_->setBounds(routingLabelArea); if (routingInfoIcon_->isVisible()) { - auto routingInfoArea = routingArea.removeFromRight(13).withTrimmedTop( - 1); // Trimming 1 to get an odd height. Icon is odd height too, so - // ensures an integer number of pixels padding top and bottom to - // avoid blurring through anti-aliasing. - routingInfoIcon_->setBounds(routingInfoArea); + placeRoutingInfoIconRight(routingArea, routingInfoIcon_.get()); routingArea.removeFromRight(marginSmall_); } auto routingComboBoxArea = diff --git a/ear-production-suite-plugins/plugins/hoa/src/value_box_main.hpp b/ear-production-suite-plugins/plugins/hoa/src/value_box_main.hpp index bef64b34a..8988adcf0 100644 --- a/ear-production-suite-plugins/plugins/hoa/src/value_box_main.hpp +++ b/ear-production-suite-plugins/plugins/hoa/src/value_box_main.hpp @@ -114,8 +114,7 @@ class ValueBoxMain : public Component { auto routingLabelArea = routingArea.withWidth(labelWidth_); routingLabel_->setBounds(routingLabelArea); if (routingInfoIcon_->isVisible()) { - auto routingInfoArea = routingArea.removeFromRight(13).withTrimmedTop(1); // Trimming 1 to get an odd height. Icon is odd height too, so ensures an integer number of pixels padding top and bottom to avoid blurring through anti-aliasing. - routingInfoIcon_->setBounds(routingInfoArea); + placeRoutingInfoIconRight(routingArea, routingInfoIcon_.get()); routingArea.removeFromRight(marginSmall_); } auto routingComboBoxArea = diff --git a/ear-production-suite-plugins/plugins/object/src/value_box_main.hpp b/ear-production-suite-plugins/plugins/object/src/value_box_main.hpp index 4e553f55d..95c8f8b4e 100644 --- a/ear-production-suite-plugins/plugins/object/src/value_box_main.hpp +++ b/ear-production-suite-plugins/plugins/object/src/value_box_main.hpp @@ -87,8 +87,7 @@ class ValueBoxMain : public Component { auto routingLabelArea = routingArea.withWidth(labelWidth_); routingLabel_->setBounds(routingLabelArea); if (routingInfoIcon_->isVisible()) { - auto routingInfoArea = routingArea.removeFromRight(13).withTrimmedTop(1); // Trimming 1 to get an odd height. Icon is odd height too, so ensures an integer number of pixels padding top and bottom to avoid blurring through anti-aliasing. - routingInfoIcon_->setBounds(routingInfoArea); + placeRoutingInfoIconRight(routingArea, routingInfoIcon_.get()); routingArea.removeFromRight(marginSmall_); } auto routingComboBoxArea = diff --git a/shared/components/routing_info_icon.hpp b/shared/components/routing_info_icon.hpp index 735a68e57..ccbae4768 100644 --- a/shared/components/routing_info_icon.hpp +++ b/shared/components/routing_info_icon.hpp @@ -21,6 +21,16 @@ namespace ui { return std::move(routingIcon); } + inline void placeRoutingInfoIconRight(juce::Rectangle& area, ImageComponent* routingInfoIcon) { + auto routingInfoArea = area.removeFromRight(13); + // Need an odd height to avoid blurring through anti-aliasing + // (since icon is odd height too, so ensures integer padding when centring vertically) + if (routingInfoArea.getHeight() % 2 == 0) { + routingInfoArea.removeFromTop(1); + } + routingInfoIcon->setBounds(routingInfoArea); + } + } // namespace ui } // namespace plugin } // namespace ear