Mercurial > hg > ishara
view arrows/@mousepos/construct.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | 672052bd81f8 |
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