@@ -133,9 +133,9 @@ void Sidebar::paint(Graphics& g)
133133 Fonts::drawStyledText (g, panelName, Rectangle<int >(0 , 0 , getWidth () - 30 , 30 ), PlugDataColours::toolbarTextColour, Bold, 15 , Justification::centred);
134134
135135 if (inspectorButton.isInspectorPinned ()) {
136- auto inpectorPos = Point<int >(0 , dividerFactor * getHeight ());
136+ auto inpectorPos = Point<int >(0 , dividerFactor * ( getHeight () - getCommandInputHeight () ));
137137 if (inspector->isEmpty ())
138- inpectorPos.setY (getHeight () - 30 );
138+ inpectorPos.setY (getHeight () - getCommandInputHeight () - 30 );
139139 g.setColour (PlugDataColours::sidebarActiveBackgroundColour);
140140 g.fillRect (inpectorPos.x , inpectorPos.y , getWidth () - 30 , 30 );
141141 auto inspectorTitle = inspector->getTitle ();
@@ -146,6 +146,11 @@ void Sidebar::paint(Graphics& g)
146146 }
147147}
148148
149+ int Sidebar::getCommandInputHeight ()
150+ {
151+ return commandInput->isVisible () ? 46 : 0 ;
152+ }
153+
149154void Sidebar::paintOverChildren (Graphics& g)
150155{
151156 g.setColour (PlugDataColours::toolbarOutlineColour);
@@ -179,7 +184,7 @@ void Sidebar::resized()
179184 if (sidebarHidden) buttonBarBounds.translate (-24 , 0 );
180185
181186 if (SettingsFile::getInstance ()->getProperty <bool >(" centre_sidepanel_buttons" )) {
182- buttonBarBounds = buttonBarBounds.withSizeKeepingCentre (30 , 144 + 30 + 8 + 30 );
187+ buttonBarBounds = buttonBarBounds.withSizeKeepingCentre (30 , 144 + 30 + 30 + 8 + 30 );
183188 } else {
184189 buttonBarBounds = buttonBarBounds.withTrimmedTop (34 );
185190 }
@@ -204,13 +209,13 @@ void Sidebar::resized()
204209 extraSettingsButton->setBounds (panelTitleBarBounds);
205210 }
206211
207- auto const dividerPos = getHeight () * (1 .0f - dividerFactor);
208-
209212 if (commandInput->isVisible ())
210213 {
211- commandInput->setBounds (bounds.removeFromBottom (46 ).reduced (8 ));
214+ commandInput->setBounds (bounds.removeFromBottom (getCommandInputHeight () ).reduced (8 ));
212215 }
213216
217+ auto const dividerPos = (getHeight () - getCommandInputHeight ()) * (1 .0f - dividerFactor);
218+
214219 if (inspector->isVisible ()) {
215220 if (inspectorButton.isInspectorAuto ()) {
216221 if (extraSettingsButton)
@@ -221,7 +226,7 @@ void Sidebar::resized()
221226 }
222227 inspector->setBounds (bounds);
223228 } else {
224- auto bottomB = bounds.removeFromBottom (inspector->isEmpty () ? 30 : dividerPos);
229+ auto bottomB = bounds.removeFromBottom (inspector->isEmpty () ? ( 30 + getCommandInputHeight ()) : dividerPos);
225230 auto resetB = bottomB.removeFromTop (30 );
226231 inspector->setBounds (bottomB);
227232 auto const resetBounds = resetB.removeFromLeft (30 );
@@ -249,13 +254,16 @@ void Sidebar::resized()
249254bool Sidebar::hitTest (int x, int y)
250255{
251256 Rectangle<int > buttonBounds;
252- for (auto * button : StackArray<SidebarSelectorButton *, 5 >{
257+ for (auto * button : StackArray<Component *, 6 >{
253258 &consoleButton,
254259 &browserButton,
255260 &automationButton,
256261 &searchButton,
257- &paletteButton})
258- buttonBounds = buttonBounds.getUnion (button->getBounds ());
262+ &paletteButton,
263+ &inspectorButton})
264+ {
265+ if (button->isVisible ()) buttonBounds = buttonBounds.getUnion (button->getBounds ());
266+ }
259267
260268 return !isHidden () || buttonBounds.contains (x, y);
261269}
@@ -274,7 +282,7 @@ void Sidebar::mouseDown(MouseEvent const& e)
274282 draggingSidebar = false ;
275283 }
276284
277- dragOffset = static_cast <float >(e.getEventRelativeTo (this ).y ) - dividerFactor * getHeight ();
285+ dragOffset = static_cast <float >(e.getEventRelativeTo (this ).y ) - dividerFactor * ( getHeight () - getCommandInputHeight () );
278286}
279287
280288void Sidebar::mouseDrag (MouseEvent const & e)
@@ -290,7 +298,7 @@ void Sidebar::mouseDrag(MouseEvent const& e)
290298 getParentComponent ()->resized ();
291299 } else if (isDraggingDivider && !inspector->isEmpty ()) {
292300 auto const newDividerY = static_cast <float >(jlimit (30 , getHeight () - 30 , e.getEventRelativeTo (this ).getPosition ().y - dragOffset));
293- dividerFactor = newDividerY / getHeight ();
301+ dividerFactor = newDividerY / ( getHeight () - getCommandInputHeight () );
294302 resized ();
295303 repaint ();
296304 }
@@ -310,7 +318,7 @@ void Sidebar::mouseMove(MouseEvent const& e)
310318 bool const resizeCursor = e.getEventRelativeTo (this ).getPosition ().getX () < dragbarWidth && e.getEventRelativeTo (this ).getPosition ().getY () < getHeight () - 30 ;
311319
312320 auto const pos = e.getEventRelativeTo (this ).getPosition ();
313- bool const resizeVertical = pos.x > 5 && pos.y > dividerFactor * getHeight () + 3 && pos.y < dividerFactor * getHeight () + 30 - 6 ;
321+ bool const resizeVertical = pos.x > 5 && pos.y > dividerFactor * ( getHeight () - getCommandInputHeight ()) + 3 && pos.y < dividerFactor * ( getHeight () - getCommandInputHeight () ) + 30 - 6 ;
314322
315323 isDraggingDivider = false ;
316324
@@ -540,7 +548,7 @@ void Sidebar::renderButtonsOnCanvas(NVGcontext* nvg)
540548{
541549 Graphics g (*editor->getNanoLLGC ());
542550
543- auto b = editor->nvgSurface .getLocalArea (this , getLocalBounds ()).withSizeKeepingCentre (36 , 186 ).translated (-15 , -15 );
551+ auto b = editor->nvgSurface .getLocalArea (this , getLocalBounds ()).withSizeKeepingCentre (36 , 186 ).translated (-15 , -30 );
544552
545553 StackShadow::drawShadowForRect (g, b.reduced (3 .0f ), 10 , Corners::largeCornerRadius, 0 .4f , 1 );
546554
0 commit comments