Skip to content

Commit

Permalink
Scale search result icons by ImageJ scale factor
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrueden committed Nov 11, 2024
1 parent aefa634 commit fa7b7c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@

<!-- NB: Deploy releases to the SciJava Maven repository. -->
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>

<scijava-search.version>3.0.0</scijava-search.version>
</properties>

<repositories>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/imagej/legacy/IJ1Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ public boolean isRMIEnabled() {
return Prefs.runSocketListener;
}

public double guiScale() {
return Prefs.getGuiScale();
}

private boolean batchMode;

void setBatchMode(final boolean batch) {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/net/imagej/legacy/search/SearchBarHacker.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public Object addSearchBar(final Object imagej, final IJ1Helper ij1Helper) {
resultLimit);
}

// Scale search result icons to match original ImageJ settings.
int iconSize = (int) (16 * ij1Helper.guiScale());

final Component[] ijc = ((Container) imagej).getComponents();
if (ijc.length < 2) return null;
final Component ijc1 = ijc[1];
Expand Down Expand Up @@ -168,6 +171,7 @@ protected void hidePanel(final Container p) {
}
searchBar.setMouseoverEnabled(mouseoverEnabled);
searchBar.setResultLimit(resultLimit);
searchBar.setIconSize(iconSize);

// add toolbar buttons
// NB: Unfortunately, the gear (\u2699) does not appear on MacOS.
Expand Down

0 comments on commit fa7b7c3

Please sign in to comment.