;+ ; Update the plotter due to a mouse event's xdevice and ydevice ; values. ; ;

This updates the tracked position string on the plotter and, if ; the crosshair is active, moves the crosshar to this new position. ; This assumes that wset has already been done on the appropriate window. ; The input positions are converted to data coordinates and returned so ; that they can be used elsewhere. ; ; @param xdevice {in}{required}{type=integer} The mouse.x value. ; @param ydevice {in}{required}{type=integer} The mouse.y value. ; @returns data coordinates as 2-element vector. ; ; @version $Id: gbtcursormoved.pro,v 1.11 2005/04/21 19:55:36 bgarwood Exp $ ;- function gbtcursormoved, xdevice, ydevice,position_text=position_text compile_opt idl2 common gbtplot_common,mystate,xarray wset,mystate.win_id data_coord = convert_coord(xdevice,ydevice,/to_data,/device) position_text = string(data_coord[0],data_coord[1], format='(" X: ",g12.7,1x,"Y:",g12.7)') widget_control,mystate.xylabel,set_value=position_text if mystate.crosshair eq 1 then begin device,copy=[0,0,mystate.xsize,mystate.ysize,0,0,mystate.pix_id] plots,[0,mystate.xsize],[ydevice,ydevice],color=!g.crosshaircolor,/device plots,[xdevice,xdevice],[0,mystate.ysize],color=!g.crosshaircolor,/device ; draw 2x, counteract an apparent wset bug plots,[0,mystate.xsize],[ydevice,ydevice],color=!g.crosshaircolor,/device plots,[xdevice,xdevice],[0,mystate.ysize],color=!g.crosshaircolor,/device endif return, data_coord end