samer@0: % mousepos - Arrow that tracks the mouse position in some axes. samer@0: % samer@0: % mousepos :: samer@0: % options { samer@0: % fig :: handles / gcf ~'figure to track'; samer@0: % xlim :: [[1,2]] / [] ~'if not empty, set X limits of axes'; samer@0: % ylim :: [[1,2]] / [] ~'if not empty, set Y limits of axes' samer@0: % } samer@0: % -> arrow({},[[2,1]]),empty). samer@0: % samer@0: % The output of the mousepos arrow is a two element column vector samer@0: % containing the X and Y coordinates of the current point in axes samer@0: % coordinates. samer@0: samer@0: function o=mousepos(varargin) samer@37: s.opts=options('fig',[],'xlim',[],'ylim',[],varargin{:}); samer@0: if isempty(s.opts.fig), s.opts.fig=gcf; end samer@0: o=class(s,'mousepos',arrow(0,1)); samer@0: end samer@0: