function aObj = dragconstrained(aObj, selType, figH)
%SCRIBEHGOBJ/DRAGCONSTRAINED

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.3 $  $Date: 2000/08/01 22:10:19 $

initialPosition = get(figH,'CurrentPoint');
myHG = get(aObj,'MyHGHandle');
myH = get(aObj,'MyHandle');
ud = getscribeobjectdata(myHG);
% write current changes
ud.ObjectStore = aObj;
setscribeobjectdata(myHG,ud);

dragConstraint = '';
fDoDrag = 1;

   % if ~get(aObj,'AutoDragConstraint')
   %   dragConstraint = get(aObj,'DragConstraint');
   % end

   switch dragConstraint
   case 'fixX'
      dragPointer = 'bottom';
   case 'fixY'
      dragPointer = 'left';
   case ''
      dragPointer = 'fleur';
   case 'nodrag'
      dragPointer = 'arrow';
      fDoDrag = 0;
   end

if fDoDrag
   set(figH,'Pointer',dragPointer);   
   prepdrag(0,initialPosition);
   set(figH,'WindowButtonMotionFcn','prepdrag start');
   set(figH,'WindowButtonUpFcn','prepdrag');
else
   % reset and deselect properly on button up.
   set(figH,'WindowButtonUpFcn','prepdrag');
end

aObj = myH.Object;
