function aObj = dodrag(aObj, varargin);
%AXISOBJ/DODRAG

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.2 $  $Date: 2000/06/01 02:52:26 $
%   j.H. Roh 

figH = get(aObj,'Figure');

initialPosition = varargin{1};
myHG = get(aObj,'MyHGHandle');

% [savedState.iPoints, aObj] = selectpoints(aObj, X, Y, pointX, pointY);

dragConstraint = get(aObj,'DragConstraint');

savedState = struct(...
        'me', aObj,...
        'myOldUnits', get(aObj,'Units'),...
        'DragConstraint', dragConstraint,...
        'Fig', figH,...
        'PointX', initialPosition(1),...
        'PointY', initialPosition(2),...
        'SelType', get(figH,'SelectionType'));

set(aObj,'Units',get(figH,'Units'));
axPos = get(aObj,'Position');

savedState.OffsetX = savedState.PointX-axPos(1);
savedState.OffsetY = savedState.PointY-axPos(2);


aObj = set(aObj,'SavedState',savedState);
