Re: detecting which dataRef the mouse is over

Hi Paul,

> In a simple 2D plotter built with visad, I'd like to detect which
> line (or lines) the mouse is over.  I have registered a DisplayListener
> on the Display, but I am uncertain how to do two things:
>
>    - detect mouse motion events (now I just get MOUSE_PRESSED and RELEASEd)
>    - figure out which line the mouse is over
>    - display a small tooltip-like tranisent window on top of the display,
>      announcing the name of the line.
>
> Tips on any of these points will be most welcome!

You need to extend visad.MouseHelper to process mouse move
events in a similar way that it processes mouse right
button click events, then extend your MouseBehaviorJ*D
(either J2D or J3D) to use your extension of MouseHelper.
See:

  http://www.unidata.ucar.edu/glimpse/visad-list/2255

for a basic explanation of at least how to extend. Note
the findRay() method of MouseBehaviorJ*D will compute
a Ray in 3-D coordinates from a mouse screen location,
then you need to invert ScalarMap scalings and any
CoordinateSstems, as in visad.DataRenderer.drag_direct().

Its all a bit complex, I'm afraid.

If your users were willing to click right mouse buttons
on Data depictions, you could just use
visad.bom.PickManipulationRendererJ3D (asssuming you
are doing 2-D in a DisplayImplJ3D).

Good luck,
Bill


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: