samer@0
|
1 function u=construct(s,sizes_in)
|
samer@0
|
2 fg=fig(s); figure(fg);
|
samer@0
|
3 ax=gca;
|
samer@0
|
4
|
samer@0
|
5 current_pos=get(ax,'CurrentPoint');
|
samer@0
|
6
|
samer@0
|
7 if ~isempty(s.opts.xlim), xlim(s.opts.xlim); end
|
samer@0
|
8 if ~isempty(s.opts.ylim), xlim(s.opts.ylim); end
|
samer@0
|
9 if isfield(s.opts,'ylabel'), ylabel(s.opts.ylabel); end
|
samer@0
|
10 if isfield(s.opts,'xlabel'), xlabel(s.opts.xlabel); end
|
samer@0
|
11 if isfield(s.opts,'box'), box(s.opts.box); end
|
samer@0
|
12
|
samer@0
|
13 u=mkunit(s);
|
samer@0
|
14 u.process=@proc;
|
samer@0
|
15 u.sizes_out = {[2,1]};
|
samer@0
|
16 u.dispose = @dispose;
|
samer@0
|
17 u.starting = @starting;
|
samer@0
|
18 u.stopping = @stopping;
|
samer@0
|
19
|
samer@0
|
20 function starting
|
samer@0
|
21 set(ax,'ButtonDownFcn',@btndown);
|
samer@0
|
22 set(fg,'WindowButtonMotionFcn',[]);
|
samer@0
|
23 end
|
samer@0
|
24
|
samer@0
|
25 function stopping
|
samer@0
|
26 set(ax,'ButtonDownFcn',[]);
|
samer@0
|
27 set(fg,'WindowButtonMotionFcn',[]);
|
samer@0
|
28 end
|
samer@0
|
29
|
samer@0
|
30 function x=proc,
|
samer@0
|
31 % pos=get(ax,'CurrentPoint');
|
samer@0
|
32 x=current_pos(1,1:2)';
|
samer@0
|
33 end
|
samer@0
|
34
|
samer@0
|
35 function btndown(a,b),
|
samer@0
|
36 set(fg,'WindowButtonMotionFcn',@move,'WindowButtonUpFcn',@btnup);
|
samer@0
|
37 current_pos=get(ax,'CurrentPoint');
|
samer@0
|
38 end
|
samer@0
|
39 function btnup(a,b), set(fg,'WindowButtonMotionFcn',[]); end
|
samer@0
|
40 function move(a,b), current_pos=get(ax,'CurrentPoint'); end
|
samer@0
|
41
|
samer@0
|
42 function dispose
|
samer@0
|
43 set(ax,'ButtonDownFcn',[]);
|
samer@0
|
44 set(fg,'WindowButtonMotionFcn',[]);
|
samer@0
|
45 end
|
samer@0
|
46 end
|