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

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.1 $  $Date: 1998/06/19 15:01:16 $

initialPosition = get(figH,'CurrentPoint');
myHG = get(aObj,'MyHGHandle');
myH = get(aObj,'MyHandle');
ud = getappdata(myHG,'ScribeObjectData');
% write current changes
ud.ObjectStore = aObj;
setappdata(myHG,'ScribeObjectData',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;
