view listeningTest/multiComp/MpushW.m @ 15:24be5e9ce25b tip

Update README
author Brecht De Man <brecht.deman@bcu.ac.uk>
date Thu, 20 Sep 2018 12:23:20 +0200
parents 4fd284285159
children
line wrap: on
line source
function MpushW(hf,typ)

switch typ
case '2D'
   sel=get(hf,'selectiontype');
   switch sel
      
   case 'normal'
      % create a box
      dat=get(hf,'userdata');
      pc=get(hf,'currentpoint');
      
      %display box
      pos=rbbox([pc(1) pc(2) 0 0]);
      x1=pos(1); x2=pos(3)+x1; y1=pos(2); y2=pos(4)+y1;
      grp=[];
      for noIc=1:length(dat.hIcon)
         posIc=get(dat.hIcon(noIc),'position');
         xic=posIc(1); yic=posIc(2);
         if ((xic>x1) & (xic<x2) & (yic>y1) & (yic<y2))
            grp(end+1)=noIc;
         end
      end
      if ~isempty(grp)
         dat.group{end+1}=grp;
         dat.com{end+1}=[];
         dat.hbox(end+1)=line([x1 x1 x2 x2 x1],[y1 y2 y2 y1 y1]);
         set(dat.hbox,'color','k');
         set(dat.hbox,'linestyle','--');
         set(dat.hbox,'linewidth',1);
      end   
      set(hf,'userdata',dat);
   end
end