handle no results

This commit is contained in:
bancika
2020-04-13 15:41:08 +02:00
parent f299106430
commit 73bc4b2776
2 changed files with 5 additions and 3 deletions
@@ -1014,7 +1014,8 @@ public class Presenter implements IPlugInPort {
} }
updateSelection(matching); updateSelection(matching);
messageDispatcher.dispatchMessage(EventType.REPAINT); messageDispatcher.dispatchMessage(EventType.REPAINT);
messageDispatcher.dispatchMessage(EventType.SCROLL_TO, getSelectionBounds(true)); if (matching.size() > 0)
messageDispatcher.dispatchMessage(EventType.SCROLL_TO, getSelectionBounds(true));
} }
@Override @Override
@@ -762,7 +762,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
case SCROLL_TO: case SCROLL_TO:
Rectangle visibleRect2 = canvasPanel.getVisibleRect(); Rectangle visibleRect2 = canvasPanel.getVisibleRect();
Rectangle2D targetRect = (Rectangle2D) params[0]; Rectangle2D targetRect = (Rectangle2D) params[0];
canvasPanel.scrollRectToVisible(new Rectangle((int)(targetRect.getCenterX() - visibleRect2.width / 2), if (targetRect != null)
canvasPanel.scrollRectToVisible(new Rectangle((int)(targetRect.getCenterX() - visibleRect2.width / 2),
(int)(targetRect.getCenterY() - visibleRect2.height / 2), visibleRect2.width, visibleRect2.height)); (int)(targetRect.getCenterY() - visibleRect2.height / 2), visibleRect2.width, visibleRect2.height));
break; break;
} }