Skip to content

Commit 815e7ea

Browse files
committed
Hide new/open space when searching
1 parent 9f7c080 commit 815e7ea

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Source/Components/WelcomePanel.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class WelcomePanel : public Component
2929
{
3030
auto* nvg = dynamic_cast<NanoVGGraphicsContext&>(g.getInternalContext()).getContext();
3131

32-
if(panel.currentTab == Home)
32+
if(panel.currentTab == Home && panel.searchQuery.isEmpty())
3333
{
3434
if(panel.recentlyOpenedTiles.isEmpty()) {
3535
nvgFontFace(nvg, "Inter-Bold");
@@ -471,7 +471,7 @@ class WelcomePanel : public Component
471471
void resized() override
472472
{
473473
auto bounds = getLocalBounds().reduced(24);
474-
auto rowBounds = bounds.removeFromTop(100);
474+
Rectangle<int> rowBounds;
475475

476476
int const desiredTileWidth = 190;
477477
int const tileSpacing = 4;
@@ -482,7 +482,9 @@ class WelcomePanel : public Component
482482
// Adjust the tile width to fit within the available width
483483
int actualTileWidth = (totalWidth - (numColumns - 1) * tileSpacing) / numColumns;
484484

485-
if (newPatchTile && openPatchTile && currentTab == Home) {
485+
auto showNewOpenTiles = newPatchTile && openPatchTile && currentTab == Home && searchQuery.isEmpty();
486+
if (showNewOpenTiles) {
487+
rowBounds = bounds.removeFromTop(100);
486488
// Position buttons centre if there are no recent items
487489
if (recentlyOpenedTiles.size() == 0) {
488490
int buttonWidth = 300;
@@ -509,7 +511,7 @@ class WelcomePanel : public Component
509511
int numRows = (tiles.size() + numColumns - 1) / numColumns;
510512
int totalHeight = (numRows * 160) + 200;
511513

512-
auto tilesBounds = Rectangle<int>(24, currentTab == Home ? 146 : 24, totalWidth + 24, totalHeight + 24);
514+
auto tilesBounds = Rectangle<int>(24, showNewOpenTiles ? 146 : 24, totalWidth + 24, totalHeight + 24);
513515

514516
contentComponent.setBounds(tiles.size() ? tilesBounds : bounds);
515517

0 commit comments

Comments
 (0)