diff arrows/@mousepos/mousepos.m @ 0:672052bd81f8

Initial partial import.
author samer
date Wed, 19 Dec 2012 22:38:28 +0000
parents
children beb8a3f4a345
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/arrows/@mousepos/mousepos.m	Wed Dec 19 22:38:28 2012 +0000
@@ -0,0 +1,20 @@
+% mousepos - Arrow that tracks the mouse position in some axes.
+%
+% mousepos ::
+%    options {
+%       fig :: handles / gcf ~'figure to track';
+%       xlim :: [[1,2]] / [] ~'if not empty, set X limits of axes';
+%       ylim :: [[1,2]] / [] ~'if not empty, set Y limits of axes'
+%    }
+% -> arrow({},[[2,1]]),empty).
+%
+% The output of the mousepos arrow is a two element column vector
+% containing the X and Y coordinates of the current point in axes
+% coordinates.
+
+function o=mousepos(varargin)
+	s.opts=prefs('fig',[],'xlim',[],'ylim',[],varargin{:});
+	if isempty(s.opts.fig), s.opts.fig=gcf; end
+	o=class(s,'mousepos',arrow(0,1));
+end
+