function turnOffDefaultHitTestFigChildren(hFig)
%turnOffDefaultHitTestFigChildren Set default HitTest off for figure children.
%   turnOffDefaultHitTestFigChildren(HFIG) sets the default 'HitTest' to
%   'off' for any objects created in HFIG of type: uipanel, axes, image,
%   hggroup, light, line, patch, rectangle, surface, text.
% 
%   This utility function should be used immediately after creating a figure
%   where you may have multiple objects above each other in the graphical
%   view. Then, you should manually turn on the 'HitTest' property only for
%   those objects that have a nonempty 'ButtonDownFcn'.

%   Copyright 1993-2004 The MathWorks, Inc.  
%   $Revision $  $Date: 2004/12/18 07:36:38 $

  % Set default 'HitTest','off' as workaround to HG issue
  % We only want to manually turn on 'HitTest' for objects that will have
  % a 'ButtonDownFcn' set.
  set(hFig,'DefaultUipanelHitTest','off',...
           'DefaultAxesHitTest','off',...
           'DefaultHggroupHitTest','off',...           
           'DefaultImageHitTest','off',...
           'DefaultLightHitTest','off',...
           'DefaultLineHitTest','off',...
           'DefaultPatchHitTest','off',... 
           'DefaultRectangleHitTest','off',...
           'DefaultSurfaceHitTest','off',...
           'DefaultTextHitTest','off')
