@Override public void mouseMoved(MouseEvent evt) { Point point = evt.getPoint(); updateCursor(editor.findView((Container) evt.getSource()), point); DrawingView view = editor.findView((Container) evt.getSource()); updateCursor(view, point); if (view == null || editor.getActiveView() != view) { clearHoverHandles(); } else { // Search first, if one of the selected figures contains // the current mouse location. Only then search for other // figures. This search sequence is consistent with the // search sequence of the SelectionTool. Figure figure = null; Point2D.Double p = view.viewToDrawing(point); for (Figure f : view.getSelectedFigures()) { if (f.contains(p)) { figure = f; } } if (figure == null) { figure = view.findFigure(point); Drawing drawing = view.getDrawing(); while (figure != null && !figure.isSelectable()) { figure = drawing.findFigureBehind(p, figure); } } updateHoverHandles(view, figure); } }
@Override public void mouseExited(MouseEvent evt) { DrawingView view = editor.findView((Container) evt.getSource()); updateHoverHandles(view, null); dragLocation = null; }