/** * Finds the Interactive located at the specified pixel position. * * @param panel the drawing panel * @param xpix the x pixel position * @param ypix the y pixel position * @return the TPoint that is hit, or null */ public Interactive findInteractive(DrawingPanel panel, int xpix, int ypix) { boolean highlighted = (track.trackerPanel.getFrameNumber() == getFrameNumber()); AutoTracker autoTracker = track.trackerPanel.getAutoTracker(); TrackerPanel trackerPanel = (TrackerPanel) panel; setHitRectCenter(xpix, ypix); for (int i = 0; i < points.length; i++) { if (points[i] == null || Double.isNaN(points[i].getX())) continue; if (hitRect.contains(points[i].getScreenPosition(trackerPanel))) { if (highlighted && autoTracker.isDrawingKeyFrameFor(track, i)) return null; return points[i]; } } return null; }
/** * Draws this step. * * @param panel the drawing panel requesting the drawing * @param g the graphics context on which to draw */ public void draw(DrawingPanel panel, Graphics g) { if (track.trackerPanel == panel) { AutoTracker autoTracker = track.trackerPanel.getAutoTracker(); if (autoTracker.isInteracting(track)) return; } TrackerPanel trackerPanel = (TrackerPanel) panel; boolean highlighted = (trackerPanel.getFrameNumber() == n); if (trackerPanel.autoTracker != null && trackerPanel.autoTracker.getWizard().isVisible() && trackerPanel.autoTracker.getTrack() == track) { highlighted = false; } getMark(trackerPanel).draw((Graphics2D) g, highlighted); }