/** * Returns the VisualItem located at the given point. * @param p the Point at which to look * @return the VisualItem located at the given point, if any */ public synchronized VisualItem findItem(Point p) { // transform mouse point from screen space to item space Point2D p2 = (m_itransform==null ? p : m_itransform.transform(p, m_tmpPoint)); // ensure that the picking queue has been z-sorted if ( !m_queue.psorted ) m_queue.sortPickingQueue(); // walk queue from front to back looking for hits for ( int i = m_queue.psize; --i >= 0; ) { VisualItem vi = m_queue.pitems[i]; if ( !vi.isValid() ) continue; // in case tuple went invalid Renderer r = vi.getRenderer(); if (r!=null && vi.isInteractive() && r.locatePoint(p2, vi)) { return vi; } } return null; }