Mercurial > hg > ishara
view arrows/@mousepos/construct.m @ 0:672052bd81f8
Initial partial import.
author | samer |
---|---|
date | Wed, 19 Dec 2012 22:38:28 +0000 |
parents | |
children |
line wrap: on
line source
function u=construct(s,sizes_in) fg=fig(s); figure(fg); ax=gca; current_pos=get(ax,'CurrentPoint'); if ~isempty(s.opts.xlim), xlim(s.opts.xlim); end if ~isempty(s.opts.ylim), xlim(s.opts.ylim); end if isfield(s.opts,'ylabel'), ylabel(s.opts.ylabel); end if isfield(s.opts,'xlabel'), xlabel(s.opts.xlabel); end if isfield(s.opts,'box'), box(s.opts.box); end u=mkunit(s); u.process=@proc; u.sizes_out = {[2,1]}; u.dispose = @dispose; u.starting = @starting; u.stopping = @stopping; function starting set(ax,'ButtonDownFcn',@btndown); set(fg,'WindowButtonMotionFcn',[]); end function stopping set(ax,'ButtonDownFcn',[]); set(fg,'WindowButtonMotionFcn',[]); end function x=proc, % pos=get(ax,'CurrentPoint'); x=current_pos(1,1:2)'; end function btndown(a,b), set(fg,'WindowButtonMotionFcn',@move,'WindowButtonUpFcn',@btnup); current_pos=get(ax,'CurrentPoint'); end function btnup(a,b), set(fg,'WindowButtonMotionFcn',[]); end function move(a,b), current_pos=get(ax,'CurrentPoint'); end function dispose set(ax,'ButtonDownFcn',[]); set(fg,'WindowButtonMotionFcn',[]); end end