Mercurial > hg > ishara
annotate arrows/@mousepos/mousepos.m @ 0:672052bd81f8
Initial partial import.
author | samer |
---|---|
date | Wed, 19 Dec 2012 22:38:28 +0000 |
parents | |
children | beb8a3f4a345 |
rev | line source |
---|---|
samer@0 | 1 % mousepos - Arrow that tracks the mouse position in some axes. |
samer@0 | 2 % |
samer@0 | 3 % mousepos :: |
samer@0 | 4 % options { |
samer@0 | 5 % fig :: handles / gcf ~'figure to track'; |
samer@0 | 6 % xlim :: [[1,2]] / [] ~'if not empty, set X limits of axes'; |
samer@0 | 7 % ylim :: [[1,2]] / [] ~'if not empty, set Y limits of axes' |
samer@0 | 8 % } |
samer@0 | 9 % -> arrow({},[[2,1]]),empty). |
samer@0 | 10 % |
samer@0 | 11 % The output of the mousepos arrow is a two element column vector |
samer@0 | 12 % containing the X and Y coordinates of the current point in axes |
samer@0 | 13 % coordinates. |
samer@0 | 14 |
samer@0 | 15 function o=mousepos(varargin) |
samer@0 | 16 s.opts=prefs('fig',[],'xlim',[],'ylim',[],varargin{:}); |
samer@0 | 17 if isempty(s.opts.fig), s.opts.fig=gcf; end |
samer@0 | 18 o=class(s,'mousepos',arrow(0,1)); |
samer@0 | 19 end |
samer@0 | 20 |